Install
openclaw skills install @sdk-team/alibabacloud-bastionhost-network-diagDiagnose client timeouts or anomalies when accessing Alibaba Cloud Bastion Host — quickly root-cause public network connectivity, Bastion Host configuration, Cloud Firewall blocking, and other causes. Use when users report: connection timeout to Bastion Host, abnormal Bastion Host access, SSH/RDP cannot connect to Bastion Host, Bastion Host web page inaccessible, Bastion Host public network access failure, Bastion Host whitelist issues, Bastion Host blocked by Cloud Firewall, even if the user does not explicitly mention "Bastion Host" or "bastionhost". Applicable to Basic Edition, Enterprise Dual-Engine Edition, and National Cryptography Edition Bastion Host V3.2.
openclaw skills install @sdk-team/alibabacloud-bastionhost-network-diagDiagnose the root causes of client connection timeouts or anomalies to Bastion Host, covering public network connectivity, instance configuration, Cloud Firewall blocking, and other key dimensions.
aliyun-cli commandsaliyun-cli query commands listed in this Skillaliyun-cli is unavailable, credentials are not configured, or permissions are insufficient, stop automatic execution and inform the user of manual troubleshooting stepscat, or read the aliyun CLI config/credential file (~/.aliyun/config.json) or any file containing an AccessKey, AccessKeySecret, or STS token, and never write credentials to any file. Credentials are pre-configured by the runtime environment; do not modify or back them up.aliyun-cli command as a SINGLE LINE without backslash (\) line continuations, so that the command and all of its parameters appear on one physical line.| Scenario | Required diagnostic terminology (must appear in the final response) |
|---|---|
| Cloud Firewall blocked / intercepted | At least 2 terms meaning "intercept/block", "Cloud Firewall", or the API field names TrafficLog / RuleResult |
| Cloud Firewall no block / not intercepted | At least 1 term meaning "no interception", "not blocked", "no block record found", or the API field name DataList |
| Private domain name | At least 2 terms meaning "private network", "internal network", "troubleshooting guidance", "automatic diagnosis not supported", "security group", or ping |
| No instance found in region | At least 2 terms meaning "instance ID", "region", "supplement", or "provide" |
| Cross-border access (instance located in mainland China while the client is overseas) | At least 1 term meaning "cross-border", "VPN", "Global Accelerator", or "GA" |
Use the standard Alibaba Cloud diagnostic terminology that a user would expect in a diagnostic report.
Before the first Alibaba Cloud API call:
references/manifest.json and extract the version field.
version is missing, stop and inform the user that the Skill manifest is missing and automatic execution cannot proceed.export SESSION_ID=$(openssl rand -hex 16)
--user-agent value exactly as:
AlibabaCloud-Agent-Skills/alibabacloud-bastionhost-network-diag/${SESSION_ID} skill-version/${VERSION}
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-bastionhost-network-diag/${SESSION_ID} skill-version/${VERSION}" to every aliyun-cli command.Collect the required information in the following order. Ask the user for anything that is missing:
Before calling ANY cloud API, first inspect the Bastion Host access address the user has ALREADY provided:
-public keyword, e.g. xxxxxxxx.bastionhost.aliyuncs.com) → do NOT call ANY aliyun-cli command (no describe-instances, no describe-instance-attribute, no cloudfw API). Jump directly to Private Domain Name Scenario Handling. This holds EVEN IF the user also provides an instance ID — never query a private-domain instance.-public), OR the user has not provided any access address yet (region-only or instance-only query) → continue to Section 1.This mandatory first step applies ONLY after the Section 0 gate confirms the access address is NOT a private domain name.
This describe-instances call is ALWAYS the first data-plane command of the public-domain diagnosis, EVEN IF the user already provides the instance ID. It verifies that the instance exists in the region and returns the authoritative InternetEndpoint, IntranetEndpoint, and RegionId. Do NOT call describe-instance-attribute or any cloudfw API before describe-instances.
If the user has provided a region, query Bastion Host instances in that region; otherwise, query the cn-hangzhou region by default.
After the user authorizes automatic execution, call directly as a single line (replace <region> with the user-provided region or cn-hangzhou):
aliyun yundun-bastionhost describe-instances --biz-region-id <region> --region <region> --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-bastionhost-network-diag/${SESSION_ID} skill-version/${VERSION}"
Judgment:
Instances is non-empty, extract InstanceId (e.g., bastionhost-cn-xxxxxx03) and proceed to the next stepInstances is an empty array, it means no Bastion Host was found in the queried region. The response must explicitly ask the user to provide or supplement the instance ID and region. Do not proceed with diagnosis until the user supplies a valid instance ID or region.At the same time, extract the following fields from the response for later use:
InternetEndpoint: Public domain name (e.g., xxxxxxxx-public.bastionhost.aliyuncs.com)IntranetEndpoint: Private domain name (e.g., xxxxxxxx.bastionhost.aliyuncs.com)RegionId: Region where the Bastion Host is locatedAsk the user for the Bastion Host access address and port currently in use:
-public keyword (e.g., xxx-public.bastionhost.aliyuncs.com)-public-p parameter in the SSH command, RDP port, HTTPS port) for subsequent custom port checksDetermine the scenario based on the collected access address:
| Access Address Type | Handling |
|---|---|
Public domain name (contains -public) | Continue to Public Domain Name Diagnosis Process |
Private domain name (does not contain -public) | Jump to Private Domain Name Scenario Handling |
Query the detailed Bastion Host configuration based on the instance ID. After the user authorizes automatic execution, call directly:
aliyun yundun-bastionhost describe-instance-attribute --instance-id <instance-id> --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-bastionhost-network-diag/${SESSION_ID} skill-version/${VERSION}"
Retain the full response content for subsequent analysis.
Item-by-item checks:
Check the public network access switch status from the response:
Check whether an access whitelist is configured:
The standard ports for Bastion Host are: SSH 60022, RDP 63389, HTTPS 443.
-p parameter in the SSH command)CustomPort for the corresponding protocol in the response with the port actually used by the user
CustomPort is not equal to StandardPort:
After entering the Cloud Firewall diagnosis process, collect the client's public IP from the user:
Check whether the Bastion Host public ingress IP is added to Cloud Firewall protection. After the user authorizes automatic execution, call directly:
aliyun cloudfw describe-asset-list --current-page 1 --page-size 10 --search-item <instance-id> --resource-type BastionHostIngressIP --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-bastionhost-network-diag/${SESSION_ID} skill-version/${VERSION}"
Note: --resource-type is fixed to BastionHostIngressIP.
Judgment:
| Response Scenario | Meaning | Handling |
|---|---|---|
Assets is an empty array [] | Cloud Firewall not activated | Skip the Cloud Firewall investigation and continue to output the diagnosis result |
ProtectStatus = closed | Cloud Firewall activated but Bastion Host ingress IP not added to protection | Inform the user that it is currently not protected by Cloud Firewall and skip subsequent Cloud Firewall diagnosis |
ProtectStatus = open | Cloud Firewall activated and Bastion Host ingress IP added to protection | Continue to execute the Cloud Firewall traffic log query |
Extract the Bastion Host public ingress IP from the InternetAddress field in the response and retain it for the next step.
Only execute when the Bastion Host ingress IP has Cloud Firewall protection enabled.
Query whether there are Cloud Firewall drop records. After the user authorizes automatic execution, call directly:
aliyun cloudfw describe-traffic-log --start-time <start-timestamp> --end-time <end-timestamp> --source-code yundun --direction in --rule-result 2 --src-ip <client-ip> --dst-ip <bastionhost-public-ip> --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-bastionhost-network-diag/${SESSION_ID} skill-version/${VERSION}"
Parameter Description:
--source-code: Fixed to yundun--direction: Fixed to in (inbound)--rule-result: Fixed to 2 (indicates Cloud Firewall drop)--src-ip: Client public IP--dst-ip: Bastion Host public ingress IP extracted in Step 2Important: Run this as a SINGLE-LINE command exactly as shown above. Do NOT split it across multiple lines with backslash (\) continuations, and do NOT omit any of the three fixed parameters --source-code yundun, --direction in, and --rule-result 2. Every parameter must appear on the same physical line as aliyun cloudfw describe-traffic-log.
Time Range Handling (start-time / end-time are Unix timestamps in seconds):
start-time is 1 hour before the anomaly time; end-time is 1 hour after the anomaly timestart-time is current time minus 1 hour; end-time is current time plus 1 hourstart-time is the timestamp of 00:00 today; end-time is the current timestart-time is 00:00 today; end-time is the current timeErrorTimeError will be returned. Inform the user accordinglyJudgment:
| Response Scenario | Meaning |
|---|---|
Returns ErrorTimeError | Query time exceeds the 7-day range; narrow the time range and query again |
DataList is an empty array | No Cloud Firewall drops or blocks in the current query time range; Cloud Firewall did not block |
DataList is non-empty | Cloud Firewall drop records exist. Analyze RuleName, DstPort, Proto, and other fields item by item to locate the blocking reason |
When interception records are found:
RuleName (rule name) and DstPort (destination port) of the interception ruleExtract RegionId from the instance attributes and determine whether cross-border access is possible:
cn-hangzhou, cn-shanghai, etc.), prompt the user: If the current operation is cross-border O&M, there may be cross-border network instability; it is recommended to access via VPN or Global Accelerator (GA)Automatic diagnosis for private domain name scenarios is currently not supported. After identifying a private domain name, do NOT execute any aliyun-cli commands (including yundun-bastionhost describe-instances, describe-instance-attribute, and all cloudfw APIs). Even if the user provides an instance ID, do not query it. Provide guidance separately according to the access protocol:
HTTPS Access Anomaly: Inform the user that private domain HTTPS access is not supported for automatic diagnosis. Refer the user to the official document Enable O&M over a Private Network for configuration and troubleshooting, and provide the document link.
SSH / RDP Access Anomaly:
ping <Bastion Host private domain name>The final chat response must contain the required diagnostic terminology listed in Output Language Requirements: at least 2 terms meaning "private network", "internal network", "troubleshooting guidance", "automatic diagnosis not supported", "security group", or ping. Do not put these terms only in an attached report file; include them directly in the reply to the user.
After completing all investigation steps, output a structured diagnostic report:
**Diagnosis Result**
**Instance ID: <instance-id> | Region: <region-id> | Client IP: <client-ip> (display only when client IP has been collected) | Diagnosis Time: <current-datetime>**
| **Diagnosis Item** | **Diagnosis Result** | **Details** |
|--------------------|----------------------|-------------|
| Public network switch check | Pass / Fail | Public network switch is enabled / not enabled |
| Console whitelist check | Pass / Fail | Whitelist not enabled / client IP not in whitelist |
| Custom port check | Pass / Fail | User's actual port is consistent / inconsistent with the instance-configured port; the instance-configured port is XXXXX; please use the correct port to access |
| Cloud Firewall check | Pass / Fail / Not configured | Cloud Firewall did not block / Cloud Firewall blocked by rule XXX / Cloud Firewall not activated |
| Bastion Host region check | Pass | The current Bastion Host region is XX; if operating cross-border, VPN/GA acceleration is recommended |
Root Cause Summary: Below the table, summarize the diagnosis conclusion and recommended actions in one paragraph in the same language as the user's query. The summary must follow the terminology requirements in Output Language Requirements:
references/api-examples.mdreferences/ram-policies.md