Manage Alibaba Cloud Security Center agent installation, version authorization, asset queries, and security risk detection via the aliyun CLI.
Architecture: Security Center (SAS) + ECS + Cloud Assistant + Proxy Cluster (optional)
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 versionto verify >= 3.3.3. If not installed or version too low, runcurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashto install/update, or seereferences/cli-installation-guide.mdfor installation instructions. Then [MUST] runaliyun configure set --auto-plugin-install trueto enable automatic plugin installation. Then [MUST] runaliyun plugin updateto 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_IDis FORBIDDEN)- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure setwith literal credential values- ONLY use
aliyun configure listto check credential statusbash
aliyun configure listCheck the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
- Obtain credentials from Alibaba Cloud Console
- Configure credentials outside of this session (via
aliyun configurein terminal or environment variables in shell profile)- Return and re-run after
aliyun configure listshows a valid profile
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.mdto get the full list of permissions required by this SKILL- Use
ram-permission-diagnoseskill 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:
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-sas-install-agent"
[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
All APIs are invoked via the aliyun CLI. Every aliyun command MUST include --user-agent AlibabaCloud-Agent-Skills/alibabacloud-sas-install-agent.
CLI CommandPurposealiyun sas describe-cloud-center-instancesQuery server client status by instance ID/IPaliyun ecs describe-instancesQuery ECS instance info and running statusaliyun ecs describe-cloud-assistant-statusCheck if cloud assistant is onlinealiyun ecs run-commandRemote install command execution (write)aliyun ecs invoke-commandTrigger existing command on instances (write)aliyun ecs describe-invocation-resultsQuery command execution resultsaliyun sas refresh-assetsSync latest asset dataaliyun sas describe-install-codesGet existing install code listaliyun sas add-install-codeGenerate new install code (write)aliyun sas create-or-update-asset-groupCreate or update asset group (write)aliyun sas get-auth-summaryGet authorization quota and usage per versionaliyun sas describe-version-configGet version, feature modules, expirationaliyun sas get-serverless-auth-summaryGet pay-as-you-go serverless statusaliyun sas modify-post-pay-module-switchToggle pay-as-you-go module switches (write)aliyun sas bind-auth-to-machineBind/unbind authorization version (write)aliyun sas update-post-paid-bind-relChange pay-as-you-go version binding or downgrade to free version (write)aliyun sas describe-property-sca-detailQuery software info on serversaliyun sas add-uninstall-clients-by-uuidsUninstall agent from specified servers (write)aliyun sas modify-push-all-taskDispatch security check tasks to servers (write) — use this for targeted single-server scansaliyun sas modify-start-vul-scanTrigger global full-scan across ALL servers (write) — NEVER use for targeted single-server scansaliyun sas describe-grouped-vulQuery grouped vulnerability statisticsaliyun sas exec-strategyExecute baseline check strategy (write)aliyun sas describe-strategyQuery baseline check strategy listaliyun sas list-check-item-warning-summaryGet baseline check risk statisticsaliyun sas describe-susp-eventsQuery security alert eventsaliyun sas generate-once-taskTrigger full asset fingerprint collection (write)aliyun sas create-asset-selection-configCreate virus scan asset selection (write)aliyun sas add-asset-selection-criteriaAdd assets to selection config (write)aliyun sas update-selection-key-by-typeAssociate selection to virus scan (write)aliyun sas create-virus-scan-once-taskCreate one-time virus scan task (write)aliyun sas get-virus-scan-latest-task-statisticQuery latest virus scan task statsaliyun sas list-virus-scan-machineQuery machines involved in virus scanaliyun sas list-virus-scan-machine-eventQuery virus events on a specific machinealiyun sas describe-once-taskPoll vulnerability scan task progress
Detailed API parameters:
references/api-reference.md. RAM permissions:references/ram-policies.md. Full command list:references/related-commands.md.
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
Display as table: install code, OS, vendor, group, image flag, expiration.
Step 2: Ask user to choose
User can select an existing matching unexpired code, or request a new one.
Step 3: Confirm new install code config (creation only)
ConfigParameterNotesOS--oslinux or windowsVendor--vendor-nameDetermined by network access method (see below)Asset Group--group-idTarget group; create via create-or-update-asset-group if neededExpiration--expired-date13-digit timestamp; defaults if omittedImage Install--only-imageWhether 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 AccessVendorNameReasonDirect line (leased line)ALIYUNUses internal domain jsrv2.aegis.aliyun.comPublic network (Alibaba Cloud ECS)ALIYUNECS uses internal networkPublic network (third-party cloud/IDC)OTHERUses 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.
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:
Trigger: User confirms the server is an Alibaba Cloud ECS instance.
Summary:
Detailed steps and CLI commands:
references/install-scenarios.md#scenario-1-alibaba-cloud-ecs-onboarding
Trigger: On-premises IDC or third-party cloud server with public or leased-line connectivity.
Summary:
references/agent-install-guide.mdDetailed steps:
references/install-scenarios.md#scenario-2-on-premises-idc-direct-connection
Trigger: User mentions image deployment, batch server creation with pre-installed agent, template creation.
Summary:
Detailed steps and caveats:
references/install-scenarios.md#scenario-3-image-based-batch-installation
Trigger: User reports installation failure, agent offline, or connection issues.
Strategy: Do not call tools; provide troubleshooting guidance directly:
Detailed troubleshooting steps:
references/install-scenarios.md#scenario-4-network-troubleshooting
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-instanceswith AuthVersion filter instead — this is an asset query, NOT a version query.
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
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-instanceswith criteria filters. When viewing/modifying a specific named server's version, follow the full Scenario 6 flow below.
Summary:
Version=1 in --bind-actionKey constraints:
Detailed steps:
references/manage-scenarios.md#scenario-6-query-or-modify-asset-authorization
Trigger: User wants to find servers with a specific software installed.
Summary:
Detailed steps:
references/manage-scenarios.md#scenario-7-query-assets-with-specific-software
Trigger: User wants to uninstall the Security Center agent from a specific server.
Summary:
Key constraints:
Detailed steps:
references/manage-scenarios.md#scenario-8-uninstall-security-center-agent
Trigger: User wants to detect security risks, trigger vulnerability scans, execute baseline checks, view security alerts, or get risk results.
Summary:
modify-push-all-task with the target UUID for ALL scan types (vulnerability + baseline + fingerprint). NEVER use modify-start-vul-scan for targeted scans.modify-start-vul-scan (vulnerability), exec-strategy (baseline), generate-once-task (fingerprint), create-virus-scan-once-task (virus)Key constraints:
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.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 firstAuthVersion > 1); free version ( AuthVersion <= 1) servers cannot be scannedDetailed steps:
references/manage-scenarios.md#scenario-9-security-risk-detection-and-query
Trigger: No scenario matched, or the request exceeds this skill's capability.
Strategy: Honestly inform the user this is not currently supported; recommend referring to official documentation or submitting a support ticket.
describe-cloud-center-instances, describe-instances, describe-cloud-assistant-status, describe-invocation-results, describe-install-codes, refresh-assets, get-auth-summary, describe-version-config, get-serverless-auth-summary, describe-property-sca-detail, describe-grouped-vul, list-check-item-warning-summary, describe-susp-events, describe-strategy, get-virus-scan-latest-task-statistic, list-virus-scan-machine, list-virus-scan-machine-event, describe-once-task
Briefly state intent (1-2 sentences) before calling.
add-install-code, run-command, invoke-command, create-or-update-asset-group, modify-post-pay-module-switch, bind-auth-to-machine, update-post-paid-bind-rel, add-uninstall-clients-by-uuids, modify-push-all-task, modify-start-vul-scan, exec-strategy, generate-once-task, create-asset-selection-config, add-asset-selection-criteria, update-selection-key-by-type, create-virus-scan-once-task
Flow: Display operation details -> Wait for user confirmation -> Execute -> Report result.
Module classification, estimation formulas, and display formats:
references/manage-scenarios.mdcost estimation section.
Enter summary when any of the following conditions is met:
Summary format adapts to the scenario. Core elements: operation result, key information (server/version/status), follow-up recommendations.
This skill references the following documents, loaded on demand:
ReferenceDescriptionreferences/install-scenarios.mdDetailed execution steps for installation scenarios (1, 2, 3, 4)references/manage-scenarios.mdDetailed execution steps for management/query scenarios (5, 6, 7, 8, 9)references/agent-install-guide.mdAgent install commands and verification methodsreferences/api-reference.mdAll API parameter details and CLI examplesreferences/ram-policies.mdRAM permission manifestreferences/cli-installation-guide.mdAlibaba Cloud CLI installation guidereferences/related-commands.mdComplete CLI command reference tablereferences/verification-method.mdSuccess verification methods for each scenarioreferences/acceptance-criteria.mdSkill acceptance criteria and test patterns