← 返回 Skills 市场
sdk-team

Alibabacloud Sas Multiaccount Manage

作者 alibabacloud-skills-team · GitHub ↗ · v0.0.1 · MIT-0
cross-platform ✓ 安全检测通过
91
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install alibabacloud-sas-multiaccount-manage
功能描述
Manage multiple Alibaba Cloud accounts and batch-export Security Center (SAS) baseline and vulnerability reports via the aliyun CLI and Python scripts. Suppo...
使用说明 (SKILL.md)

Alibaba Cloud Security Center Multi-Account Management and Baseline Report Export

Use aliyun CLI and Python scripts to manage multiple Alibaba Cloud accounts in a resource directory and batch-export Security Center baseline reports for each account.

Prerequisites and Environment Setup

1. Install Alibaba Cloud CLI

# macOS
brew install aliyun-cli

# Or download from GitHub: https://github.com/aliyun/aliyun-cli/releases

Check credentials:

aliyun sts get-caller-identity

If the call fails, instruct the user to run aliyun configure and set up credentials (interactive step, must be completed by the user).

1.1 Configure AI mode and plugin mode (required)

This skill requires aliyun CLI plugin mode commands (kebab-case) and a fixed User-Agent declaration.

# Keep plugins up to date
aliyun plugin update

# Install required product plugins if missing
aliyun plugin install --names aliyun-cli-sts,aliyun-cli-sas

# Enable AI mode and set required UA segment
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent AlibabaCloud-Agent-Skills

# Optional checks / rollback
aliyun configure ai-mode show
aliyun configure ai-mode disable

2. Install Python ≥ 3.6

# Check version
python3 --version  # Requires 3.6+, 3.9+ recommended

3. Create Virtual Environment and Install Dependencies

Create a virtual environment in \x3Cskill-path>/scripts/ and install dependencies declared in pyproject.toml:

cd scripts/

# Option A: use venv
python3 -m venv .venv
.venv/bin/pip install -e .

# Option B: use uv (optional)
uv sync

# Option C: if current Python version is unsupported, install as system dependencies
pip install -r requirements.txt

4. Run Commands

All scripts must be executed with Python from the virtual environment (whether created via venv, uv, conda, etc.). This document uses .venv/bin/python in examples; replace it with your actual virtual environment path.


Working Directory

accounts.json and exported Excel files are saved in the agent's current working directory (the directory where the command is executed). Script files themselves are located in \x3Cskill-path>/scripts/. Do not switch into the scripts directory when running commands, or accounts.json location may shift unexpectedly.

# Example: run from any directory
.venv/bin/python /path/to/scripts/accounts.py refresh

Feature 1: Account Management (accounts.py)

Workflow

  1. First use: run refresh to fetch account list from the resource directory.
  2. Filter as needed: use search to find target accounts and get AccountId.
  3. Enable/disable control: use enable / disable to decide which accounts participate in batch export.

Quick Start

Refresh account list

Fetch the latest account list from Alibaba Cloud resource directory and write to accounts.json. Existing enable states are preserved; new accounts are enabled by default.

.venv/bin/python accounts.py refresh

List all accounts

.venv/bin/python accounts.py list

Sample output:

1225574417218097    cwx                     [enabled]
1234567890123456    prod-account            [disabled]

Search accounts

Fuzzy-search by DisplayName, returning AccountId and enable status.

.venv/bin/python accounts.py search cwx
.venv/bin/python accounts.py search prod

Enable / disable accounts

Control whether an account participates in subsequent batch exports.

.venv/bin/python accounts.py enable 1225574417218097
.venv/bin/python accounts.py disable 1234567890123456

accounts.json Structure

[
  {
    "AccountId": "1225574417218097",
    "DisplayName": "cwx",
    "FolderId": "r-1Q4pqB",
    "IsMaAccount": "NO",
    "SasVersion": "0",
    "enable": true
  }
]

Feature 2: Batch Baseline Export (baseline.py)

Launch export tasks concurrently for all accounts with enable=true. After polling completion, files are downloaded, extracted, and merged into a single Excel file.

Workflow

  1. Concurrent submission: submit export-record requests for all enabled accounts (QPS ≤ 5).
  2. Concurrent polling: poll describe-export-info for each account until export completes.
  3. Download and extract: download zip and extract xlsx.
  4. Merge output: merge all account xlsx files into one file via merge.py, appending a “Resource Directory Account” column.
  5. Cleanup temporary files: delete per-account temporary xlsx files after merge.

Prerequisites

  • accounts.py refresh has been executed and account enable/disable configuration is complete.
  • aliyun CLI is configured with valid credentials and has SAS export-record and describe-export-info permissions.
  • Accounts must have Security Center purchased (free edition accounts are skipped automatically).

Export cloud platform configuration check results (CSPM)

Export baselineCspm results for all enabled accounts and merge into baseline-cspm-merged-{date}.xlsx.

# Export for all enabled accounts
.venv/bin/python baseline.py export-cspm

# Export for one specific account
.venv/bin/python baseline.py export-cspm --account-id 1225574417218097

Export system baseline risk list

Export exportHcWarning risk list (high/medium/low, all statuses) for all enabled accounts and merge into system-warning-merged-{date}.xlsx.

# Export for all enabled accounts
.venv/bin/python baseline.py export-system-warning

# Export for one specific account
.venv/bin/python baseline.py export-system-warning --account-id 1225574417218097

Output Files

File Description
baseline-cspm-merged-{date}.xlsx Merged cloud platform configuration check results, including “Resource Directory Account” column
system-warning-merged-{date}.xlsx Merged system baseline risk list, including “Resource Directory Account” column

Error Handling

Scenario Behavior
FreeVersionNotPermit Silently skip this account and continue others
NoPermission / Forbidden Silently skip this account
Export failed (server-side error) Print [failed] message and continue with other accounts
All accounts skipped Print message and exit without output file

Feature 3: Batch Vulnerability Export (vuln.py)

Launch vulnerability export tasks concurrently for all accounts with enable=true. Supports four vulnerability types. After polling completion, files are downloaded, extracted, and merged automatically.

Workflow

  1. Concurrent submission: submit export-vul --force requests for all enabled accounts (QPS ≤ 5).
  2. Concurrent polling: poll describe-vul-export-info --force for each account until export completes.
  3. Download and extract: download zip and extract xlsx.
  4. Merge output: merge all account xlsx files into one file via merge.py, appending a “Resource Directory Account” column.
  5. Cleanup temporary files: delete per-account temporary xlsx files after merge.

When the current account is the same as the caller's primary account, --ResourceDirectoryAccountId is omitted automatically.

Prerequisites

  • accounts.py refresh has been executed and account enable/disable configuration is complete.
  • aliyun CLI is configured with valid credentials and has SAS export-vul and describe-vul-export-info permissions.
  • Accounts must have Security Center purchased (free edition accounts are skipped automatically).

Export Linux software vulnerabilities (CVE)

Export unresolved Linux software vulnerabilities (high/medium/low priority) for all enabled accounts and merge into vul-cve-merged-{date}.xlsx.

# Export for all enabled accounts
.venv/bin/python vuln.py export-cve

# Export for one specific account
.venv/bin/python vuln.py export-cve --account-id 1225574417218097

Export Windows system vulnerabilities

Export unresolved Windows system vulnerabilities (high/medium/low priority) for all enabled accounts and merge into vul-sys-merged-{date}.xlsx.

.venv/bin/python vuln.py export-sys
.venv/bin/python vuln.py export-sys --account-id 1225574417218097

Export application vulnerabilities (including SCA)

Export unresolved application vulnerabilities (ECS + container, including software composition analysis) for all enabled accounts and merge into vul-app-merged-{date}.xlsx.

.venv/bin/python vuln.py export-app
.venv/bin/python vuln.py export-app --account-id 1225574417218097

Export emergency vulnerabilities

Export emergency vulnerabilities (at-risk status) for all enabled accounts and merge into vul-emg-merged-{date}.xlsx.

.venv/bin/python vuln.py export-emg
.venv/bin/python vuln.py export-emg --account-id 1225574417218097

Output Files

File Description
vul-cve-merged-{date}.xlsx Merged Linux software vulnerability list, including “Resource Directory Account” column
vul-sys-merged-{date}.xlsx Merged Windows system vulnerability list, including “Resource Directory Account” column
vul-app-merged-{date}.xlsx Merged application vulnerability list (including SCA), including “Resource Directory Account” column
vul-emg-merged-{date}.xlsx Merged emergency vulnerability list, including “Resource Directory Account” column

Export Parameter Details

Type export-vul parameters
export-cve --Type cve --Necessity asap,later,nntf --Dealed n
export-sys --Type sys --Necessity asap,later,nntf --Dealed n
export-app --Type app --Necessity asap,later,nntf --AttachTypes sca --AssetType ECS,CONTAINER --Dealed n
export-emg --Type emg --RiskStatus y --Dealed n

Error Handling

Scenario Behavior
FreeVersionNotPermit Silently skip this account and continue others
NoPermission / Forbidden Silently skip this account
Export failed (server-side error) Print [failed] message and continue with other accounts
All accounts skipped Print message and exit without output file

Notes

  • Scripts must run in a virtual environment. Examples use .venv/bin/python; replace with your actual virtual environment path.
  • Manage aliyun CLI credentials with aliyun configure; do not hardcode AK/SK.
  • SAS API supports only two endpoints: cn-shanghai (China mainland) and ap-southeast-1 (outside China mainland).
安全使用建议
This package appears coherent for its stated purpose, but take these precautions before running it: (1) review the included Python scripts yourself (they are bundled and readable) and only run them if you trust them; (2) run in a safe/isolated working directory (they create accounts.json and write merged XLSX files); (3) use a least-privilege RAM role or credentials that are appropriate for cross-account SAS exports (the included references/ram-policies.md describes needed actions); (4) be aware SKILL.md asks you to enable aliyun CLI 'ai-mode' and set a User-Agent — that changes your local aliyun CLI config and will affect future CLI calls unless reverted; (5) prefer running in a virtual environment and consider testing on a non-production account first. Overall the code and instructions align with the described functionality.
功能分析
Type: OpenClaw Skill Name: alibabacloud-sas-multiaccount-manage Version: 0.0.1 The skill bundle is a legitimate utility for managing Alibaba Cloud Security Center (SAS) across multiple accounts. It uses the official Alibaba Cloud CLI (aliyun) to automate the process of fetching account lists, triggering security report exports, and downloading/merging Excel results. The Python scripts (accounts.py, baseline.py, vuln.py) use standard subprocess calls and asynchronous tasks to interact with the cloud provider's APIs. While requirements.txt contains a non-existent version of numpy (2.4.4), this package is not imported or used in the code, suggesting a typo rather than malicious intent. The behavior is consistent with the stated purpose of multi-account security reporting.
能力评估
Purpose & Capability
Name/description match the included Python scripts and SKILL.md: the tooling calls the aliyun CLI and uses exported links to download SAS baseline/vulnerability reports, merges XLSX files, and manages accounts.json. Nothing requested (no extra env vars, no unrelated binaries) appears out of scope for multi-account SAS exports.
Instruction Scope
SKILL.md instructs installing aliyun CLI, creating a Python venv, and running the provided scripts. It also instructs enabling 'ai-mode' and setting a fixed User-Agent in the aliyun CLI (via aliyun configure ai-mode set-user-agent). These CLI config changes are relevant to the skill's use of plugin-mode and adding a UA segment, but they do alter the user's CLI configuration (affects subsequent aliyun CLI calls). Scripts read/write accounts.json and write merged Excel files to the agent's current working directory — the user should run them in a safe location.
Install Mechanism
This is an instruction-only skill with bundled Python scripts; there is no automated install that downloads arbitrary code. SKILL.md recommends installing aliyun CLI from Homebrew or the official GitHub releases and creating a venv to install declared Python dependencies (openpyxl etc.). No suspicious network download URLs or archive extraction from unknown hosts appear in the package.
Credentials
The skill does not declare or require unrelated environment variables or credentials. It expects the user to have configured aliyun CLI credentials (aliyun configure) and to run with credentials that have the SAS/STS actions listed in the included RAM policy doc. That credential need is proportional to the stated functionality (multi-account SAS exports).
Persistence & Privilege
The skill does not request 'always: true' and does not modify other skills or system-wide agent settings. The only configuration change the docs suggest is modifying the aliyun CLI ai-mode/user-agent setting (a local CLI config change), which is plausible for plugin-mode usage but should be applied intentionally by the user.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alibabacloud-sas-multiaccount-manage
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alibabacloud-sas-multiaccount-manage 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.1
alibabacloud-sas-multiaccount-manage v0.0.1 - Initial release with Python and aliyun CLI integration for Alibaba Cloud Security Center multi-account management. - Manage multiple Alibaba Cloud accounts: auto-fetch account list, enable/disable accounts, and search/filter accounts. - Batch-export and merge Security Center baseline (cloud config check, system baseline risk) and vulnerability (Linux/Windows/app/emergency) reports across all enabled accounts. - Supports concurrent export, polling, merging to Excel, and robust error handling for unsupported or permission-restricted accounts. - Output includes merged Excel reports with “Resource Directory Account” column for easy multi-account compliance review.
元数据
Slug alibabacloud-sas-multiaccount-manage
版本 0.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Alibabacloud Sas Multiaccount Manage 是什么?

Manage multiple Alibaba Cloud accounts and batch-export Security Center (SAS) baseline and vulnerability reports via the aliyun CLI and Python scripts. Suppo... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 91 次。

如何安装 Alibabacloud Sas Multiaccount Manage?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install alibabacloud-sas-multiaccount-manage」即可一键安装,无需额外配置。

Alibabacloud Sas Multiaccount Manage 是免费的吗?

是的,Alibabacloud Sas Multiaccount Manage 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Alibabacloud Sas Multiaccount Manage 支持哪些平台?

Alibabacloud Sas Multiaccount Manage 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Alibabacloud Sas Multiaccount Manage?

由 alibabacloud-skills-team(@sdk-team)开发并维护,当前版本 v0.0.1。

💬 留言讨论