Alibaba Cloud Security Center (SAS) agent onboarding and management assistant. Use this skill when the user wants to onboard servers to Security Center, install the security agent, deploy cloud security protection, connect via proxy, troubleshoot agent offline or installation failures, create image templates with pre-installed agent, view Security Center version and expiration, check authorization quota, upgrade or switch server protection versions, toggle pay-as-you-go feature modules, uninstall the Security Center agent from a server, find servers with specific software installed (e.g. Nginx, MySQL, Redis), or detect security risks (vulnerability scanning, baseline checks, security alert queries).
Execution model: read operations execute directly (ReAct), write operations display details and require user confirmation before execution (Command). Keep analysis concise -- output a brief reasoning for each action.
Pre-check: Aliyun CLI >= 3.3.3 required
Run aliyun version to verify >= 3.3.3. If not installed or version too low,
run curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash to install/update,
or see references/cli-installation-guide.md for installation instructions.
Then [MUST] run aliyun configure set --auto-plugin-install true to enable automatic plugin installation.
Then [MUST] run aliyun plugin update to ensure that any existing plugins on your local machine are always up-to-date.
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
NEVER read, echo, or print AK/SK values (e.g., echo $ALIBABA_CLOUD_ACCESS_KEY_ID is FORBIDDEN)
NEVER ask the user to input AK/SK directly in the conversation or command line
NEVER use aliyun configure set with literal credential values
ONLY use aliyun configure list to check credential status
bash
aliyun configure list
Check the output for a valid profile (AK, STS, or OAuth identity).
Configure credentials outside of this session (via aliyun configure in terminal or environment variables in shell profile)
Return and re-run after aliyun configure list shows a valid profile
Security Guidelines
Never expose sensitive information (AccessKey, passwords) in output, because leaking credentials could compromise the account
Never call any Delete-class API, because delete operations are irreversible and may disrupt protection
Write operations (create install codes, create clusters, install proxies, run commands via cloud assistant, bind authorization, modify switches) must display operation details and wait for user confirmation before execution, because these operations modify live resources
Display the full command content before dispatching commands via cloud assistant, because executing arbitrary commands on production servers is high-risk
RAM Policy
Detailed permissions required by this skill: references/ram-policies.md
[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
Read references/ram-policies.md to get the full list of permissions required by this SKILL
Use ram-permission-diagnose skill to guide the user through requesting the necessary permissions
Pause and wait until the user confirms that the required permissions have been granted
IMPORTANT: Parameter Confirmation — Before executing any command or API call,
ALL user-customizable parameters (e.g., RegionId, instance names, CIDR blocks,
passwords, domain names, resource specifications, etc.) MUST be confirmed with the
user. Do NOT assume or use default values without explicit user approval.
At the start of the Core Workflow (before any CLI invocation):
[MUST] Enable AI-Mode — AI-mode is required for Agent Skill execution.
Run the following commands before any CLI invocation:
[MUST] Disable AI-Mode at EVERY exit point — Before delivering the final response for ANY reason, always disable AI-mode first. This applies to ALL exit paths: workflow success, workflow failure, error/exception, user cancellation, session end, or any other scenario where no further CLI commands will be executed.
AI-mode is only used for Agent Skill invocation scenarios and MUST NOT remain enabled after the skill stops running.
bash
aliyun configure ai-mode disable
Tool Inventory
All APIs are invoked via the aliyun CLI. Every aliyun command MUST include --user-agent AlibabaCloud-Agent-Skills/alibabacloud-sas-install-agent.
CLI Command
Purpose
aliyun sas describe-cloud-center-instances
Query server client status by instance ID/IP
aliyun ecs describe-instances
Query ECS instance info and running status
aliyun ecs describe-cloud-assistant-status
Check if cloud assistant is online
aliyun ecs run-command
Remote install command execution (write)
aliyun ecs invoke-command
Trigger existing command on instances (write)
aliyun ecs describe-invocation-results
Query command execution results
aliyun sas refresh-assets
Sync latest asset data
aliyun sas describe-install-codes
Get existing install code list
aliyun sas add-install-code
Generate new install code (write)
aliyun sas create-or-update-asset-group
Create or update asset group (write)
aliyun sas get-auth-summary
Get authorization quota and usage per version
aliyun sas describe-version-config
Get version, feature modules, expiration
aliyun sas get-serverless-auth-summary
Get pay-as-you-go serverless status
aliyun sas modify-post-pay-module-switch
Toggle pay-as-you-go module switches (write)
aliyun sas bind-auth-to-machine
Bind/unbind authorization version (write)
aliyun sas update-post-paid-bind-rel
Change pay-as-you-go version binding or downgrade to free version (write)
aliyun sas describe-property-sca-detail
Query software info on servers
aliyun sas add-uninstall-clients-by-uuids
Uninstall agent from specified servers (write)
aliyun sas modify-push-all-task
Dispatch security check tasks to servers (write) — use this for targeted single-server scans
aliyun sas modify-start-vul-scan
Trigger global full-scan across ALL servers (write) — NEVER use for targeted single-server scans
aliyun sas describe-grouped-vul
Query grouped vulnerability statistics
aliyun sas exec-strategy
Execute baseline check strategy (write)
aliyun sas describe-strategy
Query baseline check strategy list
aliyun sas list-check-item-warning-summary
Get baseline check risk statistics
aliyun sas describe-susp-events
Query security alert events
aliyun sas generate-once-task
Trigger full asset fingerprint collection (write)
aliyun sas create-asset-selection-config
Create virus scan asset selection (write)
aliyun sas add-asset-selection-criteria
Add assets to selection config (write)
aliyun sas update-selection-key-by-type
Associate selection to virus scan (write)
aliyun sas create-virus-scan-once-task
Create one-time virus scan task (write)
aliyun sas get-virus-scan-latest-task-statistic
Query latest virus scan task stats
aliyun sas list-virus-scan-machine
Query machines involved in virus scan
aliyun sas list-virus-scan-machine-event
Query virus events on a specific machine
aliyun sas describe-once-task
Poll vulnerability scan task progress
Detailed API parameters: references/api-reference.md. RAM permissions: references/ram-policies.md. Full command list: references/related-commands.md.
Common Flow: Get or Create Install Code
When any installation scenario requires an install code, follow this unified flow.
Step 1: Query existing install codes
bash
aliyun sas describe-install-codes --user-agent AlibabaCloud-Agent-Skills/alibabacloud-sas-install-agent
User can select an existing matching unexpired code, or request a new one.
Step 3: Confirm new install code config (creation only)
Config
Parameter
Notes
OS
--os
linux or windows
Vendor
--vendor-name
Determined by network access method (see below)
Asset Group
--group-id
Target group; create via create-or-update-asset-group if needed
Expiration
--expired-date
13-digit timestamp; defaults if omitted
Image Install
--only-image
Whether for image template creation
VendorName and network access method mapping:
The vendor parameter determines the connection domain used by the install command. Using the wrong value causes the agent to fail connecting to the server:
Network Access
VendorName
Reason
Direct line (leased line)
ALIYUN
Uses internal domain jsrv2.aegis.aliyun.com
Public network (Alibaba Cloud ECS)
ALIYUN
ECS uses internal network
Public network (third-party cloud/IDC)
OTHER
Uses public domain jsrv.aegis.aliyun.com
When the scenario already identifies the network access method, auto-fill VendorName without asking the user.
After confirmation, execute creation (pass only user-specified parameters). This is a write operation requiring confirmation.
Step 4: Get install command
After creation, re-query the install code list to get the new CaptchaCode for building the install command.
Scenario Routing
Scenario 0: Initial Consultation
Trigger: User vaguely says "onboard to Security Center", "install security agent", "deploy cloud security".
Strategy: Do not call any tools. Collect information through questions, then route:
Server type:
Alibaba Cloud ECS -> Scenario 1
Third-party cloud / On-premises IDC -> Continue to question 2
Network access method:
Public or leased-line direct -> Scenario 2
Image deployment -> Scenario 3
Scenario 1: Alibaba Cloud ECS Onboarding
Trigger: User confirms the server is an Alibaba Cloud ECS instance.
Summary:
Get ECS info, query instance and client status
Based on ClientStatus + ClientSubStatus: online = no action needed, uninstalled = install, offline = troubleshoot
Get or create install code (common flow)
If cloud assistant is online, dispatch remotely; otherwise provide manual install command
Verify onboarding
Detailed steps and CLI commands: references/install-scenarios.md#scenario-1-alibaba-cloud-ecs-onboarding
Scenario 2: On-Premises IDC Direct Connection (Public/Leased Line)
Trigger: On-premises IDC or third-party cloud server with public or leased-line connectivity.
Summary:
Get or create install code (common flow, VendorName auto-determined by network type)
Select install command based on network situation (public/leased-line/overseas), refer to references/agent-install-guide.md
Trigger: User wants to know about account-level version, authorization quota, enabled features, or pay-as-you-go status.
[MUST] Routing distinction: Scenario 5 is for account-level queries ("我们的版本是什么", "配额还剩多少", "过期时间"). When the user asks about specific servers ("哪些服务器未授权", "哪些机器是免费版", "未绑定付费版本的服务器"), route to describe-cloud-center-instances with AuthVersion filter instead — this is an asset query, NOT a version query.
Summary:
Query version details (describe-version-config)
Query authorization usage (get-auth-summary)
Optionally query Serverless status (get-serverless-auth-summary)
[MUST] The MergedVersion field in describe-version-config response is a sensitive internal field — NEVER display, output, save to file, or include it in any response exposed to the user. Strip it before any output. Use Version and HighestVersion instead.
Detailed steps and field mappings: references/manage-scenarios.md#scenario-5-query-version-and-feature-info
Scenario 6: Query or Modify Asset Authorization Version
Trigger: User wants to view or change a specific server's authorization version, or list servers filtered by authorization status (e.g. "哪些服务器未授权", "免费版的机器有哪些").
When listing/filtering servers by authorization status, use describe-cloud-center-instances with criteria filters. When viewing/modifying a specific named server's version, follow the full Scenario 6 flow below.
Summary:
Query asset current status and authorization version
Confirm operation type (view/bind/unbind/change pay-as-you-go version/downgrade to free)
Pay-as-you-go version change or downgrade to free (update-post-paid-bind-rel, write operation). Downgrade to free version uses Version=1 in --bind-action
Verify change
Key constraints:
Subscription binding cannot be unbound within 30 days, because authorization resources have a lock period
K8s/ACK cluster assets only support Ultimate edition, because other editions do not cover container runtime protection
Targeted scan (specific server): Use modify-push-all-task with the target UUID for ALL scan types (vulnerability + baseline + fingerprint). NEVER use modify-start-vul-scan for targeted scans.
Full scan (all servers): Use modify-start-vul-scan (vulnerability), exec-strategy (baseline), generate-once-task (fingerprint), create-virus-scan-once-task (virus)
After dispatching, poll progress: vulnerability scan (describe-once-task), baseline check (describe-strategy.ExecStatus), virus scan (get-virus-scan-latest-task-statistic); query risk results after all complete
Key constraints:
[HARD GATE] NEVER use modify-start-vul-scan for targeted scans: modify-start-vul-scan triggers a global full-scan across ALL servers in the entire account, not just the target. When scanning a specific server (targeted scan), you MUST use modify-push-all-task with the server's UUID — this is the ONLY correct command for targeted vulnerability scans. modify-start-vul-scan is reserved exclusively for full-scan scenarios where no specific target is specified.
[HARD GATE] Client online required for ALL scans: ALL scan dispatch operations (modify-push-all-task, modify-start-vul-scan, exec-strategy, create-virus-scan-once-task) are host-based and require the target server's Security Center agent ClientStatus=online. If the agent is not installed or offline, scans CANNOT be dispatched and WILL produce NO results. There is NO agentless scanning mode in this skill. Do NOT proceed with any scan dispatch if the client is not online — instead, guide the user to install or bring the agent online first
[HARD GATE] Paid authorization required for scans: The target server must be bound to a paid authorization version (AuthVersion > 1); free version (AuthVersion <= 1) servers cannot be scanned
Querying existing risk results (describe-grouped-vul, list-check-item-warning-summary, describe-susp-events) is a READ operation that queries historical data in Security Center's database — this does NOT trigger new scans and does NOT require the agent to be online
Before full scan, query all asset statuses first, show the user ready/not-ready asset breakdown, and confirm before dispatching
Targeted asset scans are fully automated with the prerequisite chain (authorization + client), only authorization binding requires user confirmation
Baseline detection (HEALTH_CHECK / exec-strategy) requires a pre-paid host protection version (Version > 1) or enabled Cloud Security Posture Management (CSPM); skip baseline detection if neither is met
Scan operations are write operations; full scans require confirmation before execution