alibabacloud-waf-protectionconfig-backup

aliyun/alibabacloud-aiops-skills

Экспорт и резервное копирование конфигураций Alibaba Cloud WAF 3.0 и 2.0 в Excel.

Звёзды298
Форки40
Авторaliyun
Обновлённоя 18 2026

Установка

SKILL.md

WAF Protection Config Backup

Export and backup all WAF protection configurations as Excel workbooks (.xlsx) for disaster recovery, auditing, configuration migration, or compliance review. Each data module is saved as a separate sheet within the workbook.

Architecture

Alibaba Cloud WAF Instance
├── WAF 3.0 (API 2021-10-01)
│   ├── Defense Resources
│   ├── Defense Resource Groups
│   ├── Defense Templates → Rules → Resource Bindings
│   │   └── 20 DefenseScene types (waf_group, cc, custom_acl, ip_blacklist, ...)
│   ├── Major Protection Black IPs
│   └── Address Books
│
└── WAF 2.0 (API 2019-09-10)
    └── Per-Domain Protection Rules
        └── 16 DefenseType types (ac_custom, whitelist, tamperproof, ...)
            ├── Rules / Status / Mode
            └── Domain Rule Group

Regions: cn-hangzhou (China) | ap-southeast-1 (International)
Output: waf3-{region}.xlsx (8 sheets) | waf2-{region}.xlsx (5 sheets)

Installation

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 detailed instructions.

Pre-check: Aliyun CLI plugin update required

[MUST] run aliyun configure set --auto-plugin-install true to enable automatic plugin installation. [MUST] run aliyun plugin update to ensure that any existing plugins are always up-to-date.

Pre-check: Python openpyxl library required

Excel (.xlsx) output requires the openpyxl Python library.

pip3 install openpyxl

Environment Variables

No environment variables are required. All parameters are provided via CLI flags or confirmed interactively.

Authentication

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
aliyun configure list

Check the output for a valid profile (AK, STS, or OAuth identity).

If no valid profile exists, STOP here.

  1. Obtain credentials from Alibaba Cloud Console
  2. Configure credentials outside of this session (via aliyun configure in terminal or environment variables in shell profile)
  3. Return and re-run after aliyun configure list shows a valid profile

RAM Policy

This skill requires read-only permissions for WAF APIs. See references/ram-policies.md for the full IAM policy JSON.

ActionWAF VersionDescription
waf:DescribeInstance3.0Query instance info
waf:DescribeDefenseResources3.0List defense resources
waf:DescribeDefenseResourceGroups3.0List resource groups
waf:DescribeDefenseTemplates3.0List defense templates
waf:DescribeDefenseRules3.0List defense rules
waf:DescribeTemplateResources3.0List template-resource bindings
waf:DescribeMajorProtectionBlackIps3.0List major protection black IPs
waf:DescribeAddresses3.0List address book entries
waf:DescribeInstanceInfo2.0Query instance info
waf:DescribeDomainNames2.0List domains
waf:DescribeProtectionModuleRules2.0List protection rules
waf:DescribeProtectionModuleStatus2.0Query module status
waf:DescribeProtectionModuleMode2.0Query module mode
waf:DescribeDomainRuleGroup2.0Query domain rule group

[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:

  1. Read references/ram-policies.md to get the full list of permissions required by this SKILL
  2. Use ram-permission-diagnose skill to guide the user through requesting the necessary permissions
  3. Pause and wait until the user confirms that the required permissions have been granted

Observability (MUST follow for every aliyun command)

Upon loading this skill, generate a random session ID (32-char lowercase hex string) once for the entire session. Use it as {session-id} below.

Rule: Every aliyun CLI command that calls a cloud API MUST include the --user-agent flag. Local utility commands (e.g. configure, plugin, version) do not support this flag and should be excluded.

--user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-protectionconfig-backup/{session-id}

Example (assuming session-id is a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6):

aliyun waf-openapi describe-instance --region cn-hangzhou --biz-region-id cn-hangzhou --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-protectionconfig-backup/a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6

Do not skip, alter the format, or omit --user-agent on any aliyun API command invocation.

Parameter Confirmation

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.

ParameterRequiredDescriptionDefault
REGIONSOptionalRegions to scancn-hangzhou,ap-southeast-1
BACKUP_DIROptionalOutput directory path./waf-backup-{YYYYMMDD-HHmmss}
WAF_VERSIONOptionalTarget WAF version: 3.0, 2.0, or autoauto

Core Workflow

Phase 1: Initialize

BACKUP_DIR="./waf-backup-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$BACKUP_DIR"

Phase 2: Detect WAF Version (per region)

For each region in [cn-hangzhou, ap-southeast-1]:

Try WAF 3.0:

aliyun waf-openapi describe-instance \
  --region {region} \
  --biz-region-id {region} \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-protectionconfig-backup/{session-id}

If response contains a valid InstanceId → WAF 3.0 detected. Parse response and write to "instance" sheet of {BACKUP_DIR}/waf3-{region}.xlsx.

Try WAF 2.0:

aliyun waf-openapi describe-instance-info \
  --api-version 2019-09-10 \
  --region {region} \
  --biz-region-id {region} \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-protectionconfig-backup/{session-id}

If response contains valid instance info → WAF 2.0 detected. Parse response and write to "instance-info" sheet of {BACKUP_DIR}/waf2-{region}.xlsx.

If neither returns results, skip this region.

Phase 3: WAF 3.0 Backup

For each region with WAF 3.0 detected, follow the detailed steps in references/waf3-backup-workflow.md:

All data is written to {BACKUP_DIR}/waf3-{region}.xlsx with each module as a separate sheet:

  1. Backup Defense Resources — describe-defense-resources with --pager → sheet "defense-resources"
  2. Backup Defense Resource Groups — describe-defense-resource-groups with --pager → sheet "defense-resource-groups"
  3. Backup Defense Templates & Rules — Iterate all 20 DefenseScene values:<!-- -->
    • For each scene: list templates → for each template: get rules + resource bindings
    • Aggregate all templates into sheet "defense-templates", all rules into sheet "defense-rules", all bindings into sheet "template-resource-bindings"
    • See references/defense-scene-values.md for the full enum list
  4. Backup Major Protection Black IPs — describe-major-protection-black-ips with --pager → sheet "major-protection-black-ips"
  5. Backup Address Books — describe-addresses with --pager → sheet "addresses"

Phase 4: WAF 2.0 Backup

For each region with WAF 2.0 detected, follow the detailed steps in references/waf2-backup-workflow.md:

All data is written to {BACKUP_DIR}/waf2-{region}.xlsx with each module as a separate sheet:

  1. List Domains — describe-domain-names --api-version 2019-09-10 → sheet "domain-names"
  2. Per-Domain Backup — For each domain, iterate all 16 DefenseType values:<!-- -->
    • describe-protection-module-rules → append to sheet "protection-rules"
    • describe-protection-module-status + describe-protection-module-mode → append to sheet "protection-status"
    • See references/defense-scene-values.md for the full enum list
  3. Backup Domain Rule Group — describe-domain-rule-group per domain → append to sheet "domain-rule-groups"

CRITICAL: All WAF 2.0 commands MUST include --api-version 2019-09-10 and --region {region}. The --region flag sets the API endpoint region. Without it, non-China-mainland instances (e.g., ap-southeast-1) will not be found — the API defaults to cn-hangzhou and returns the China mainland instance instead.

Phase 5: Generate Manifest

Create {BACKUP_DIR}/manifest.json containing:

  • backupTime — ISO 8601 timestamp
  • regions — object with per-region details (WAF version, instance ID, sheet counts)
  • totalFiles — total number of backup Excel (.xlsx) files

Success Verification

  1. Verify manifest.json exists and is valid JSON
  2. Compare Excel file count against totalFiles in manifest
  3. Spot-check: open waf3-{region}.xlsx and verify "defense-resources" sheet has data rows (WAF 3.0), or open waf2-{region}.xlsx and verify "domain-names" sheet has data rows (WAF 2.0)
  4. Validate all Excel files: find {BACKUP_DIR} -name "*.xlsx" -exec python3 -c "import openpyxl; openpyxl.load_workbook('{}'); print('OK: {}')" \;

See references/verification-method.md for detailed verification steps.

Cleanup

This is a read-only backup skill. No cloud resources are created or modified.

To remove backup files:

rm -rf {BACKUP_DIR}

Command Tables

See references/related-commands.md for the complete CLI command reference.

CategoryKey CommandsVersion
Instance Detectiondescribe-instance, describe-instance-info3.0 / 2.0
Defense Resourcesdescribe-defense-resources, describe-defense-resource-groups3.0
Defense Rulesdescribe-defense-templates, describe-defense-rules, describe-template-resources3.0
Major Protectiondescribe-major-protection-black-ips3.0
Address Bookdescribe-addresses3.0
Domain Rulesdescribe-protection-module-rules, describe-protection-module-status, describe-protection-module-mode2.0
Domain Rule Groupdescribe-domain-rule-group2.0

Best Practices

  1. Run backups on a regular schedule (daily or weekly) for disaster recovery
  2. Store backup files in OSS with versioning enabled for long-term retention
  3. Use auto version detection to support mixed WAF 2.0/3.0 environments
  4. Always scan both cn-hangzhou and ap-southeast-1 to capture all instances
  5. Validate backup integrity using manifest.json file counts after each run
  6. Keep at least 7 days of backup history before pruning old backups
  7. Use --pager flag to handle large datasets without manual pagination
  8. Compress backup directories (tar -czf) for archival storage

Reference Links

ReferenceDescription
references/cli-installation-guide.mdAliyun CLI installation guide
references/ram-policies.mdComplete RAM policy JSON
references/waf3-backup-workflow.mdWAF 3.0 detailed backup workflow
references/waf2-backup-workflow.mdWAF 2.0 detailed backup workflow
references/defense-scene-values.mdDefenseScene / DefenseType enum reference
references/related-commands.mdComplete CLI command reference
references/verification-method.mdBackup verification procedures
references/acceptance-criteria.mdTesting acceptance criteria

Вставить в README

Ссылка на карточку для вашего README — без картинок и счётчиков.

[DarkPlay: alibabacloud-waf-protectionconfig-backup](https://darkplay.ru/ai/skills/aliyun-alibabacloud-aiops-skills-alibabacloud-waf-protectionconfig-backup)

Похожие скиллы и другие разделы каталога

Популярное в разделе «Скиллы»

Самые востребованные скиллов раздела по установкам и звёздам.

find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
4 400 000 устан.
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
1 600 000 устан.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
1 600 000 устан.
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
1 600 000 устан.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
1 600 000 устан.
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
1 500 000 устан.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
1 400 000 устан.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
1 300 000 устан.
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
1 300 000 устан.
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.
1 300 000 устан.
Похожее в других разделах каталога

Соседние разделы каталога: возможно, нужный инструмент живёт там.

clickhouseanthropics · Подключение Claude к базам данных ClickHouse Cloud. Просмотр организаций, сервисов, баз…
100 комп.
sap-hana-clianthropics · Более 150 инструментов для работы с базой данных SAP HANA для AI-ассистентов. Запросы к…
100 комп.
zillizanthropics · Плагин управления Zilliz Cloud с 14 навыками: жизненный цикл кластера, схема коллекций…
100 комп.
Zcf Config ArchitectUfoMiao · Архитектор управления конфигурацией и систем резервного копирования для ZCF.
6 064 ★
claude-backupanthropics · Резервное копирование и восстановление окружения Claude Code.
38 комп.
clickhouseanthropics · Подключение Claude к базам ClickHouse Cloud: просмотр организаций, сервисов, баз и схем…
38 комп.
rehydrateanthropics · Плагин резервного копирования и восстановления для Mac-разработчиков: сохраняет только…
38 комп.
sap-hana-clianthropics · Более 150 инструментов для работы с SAP HANA в Claude Code: схемы, запросы…
38 комп.
session-backupanthropics · Ежедневный бэкап сессий, навыков и конфигов Claude в облако без настройки.
38 комп.
skill-validatoranthropics · Проверка работоспособности навыков и команд Claude Code. Ищет битые ссылки на файлы…
38 комп.

Лучшие ИИ-инструменты для генерации видео

Генерация видео

Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,

VEED.IOVeed
По запросу
5.0
MootionMootion
По запросу
5.0
FlyviFlyvi
Есть бесплатный тариф
4.9
Google Veo 3.1Google
Платно
4.9
Sora (OpenAI)OpenAI
Платно
4.9
PikaPika
Платно
4.9
captions space
Есть бесплатный тариф
4.8
Клайп
Есть бесплатный тариф
4.8
viralpulse.appViralpulse
По запросу
4.8
Viral Maker AIViral-maker
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации текста и копирайтинга

Генерация текста и копирайтинг

Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра

NeuroscribeNeuroscribe
Есть бесплатный тариф
5.0
GoGPTGogpt
По запросу
5.0
ChatsonicChatsonic
По запросу
4.9
НейроТекстерNeuro-texter
По запросу
4.9
ChatGPTOpenAI
По подписке
4.9
Редактум
Есть бесплатный тариф
4.8
ChadGPTChadgpt
По запросу
4.8
Cosmo ScribeCosmoscribe
Есть бесплатный тариф
4.8
Memo HelperCopilot33
По запросу
4.8
LibraChatLibrachat
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации изображений

Генерация изображений

Подборка нейросетей для генерации изображений от фотореализма до концепт-арта. Сервисы, которые экономят часы ручной работы, создавая визуал для блогов, рекламы и дизайна за минуты

MagviMagvi
По запросу
5.0
DALL-E 3OpenAI
По подписке
5.0
SupaLabSupalab
По запросу
5.0
Freestyling.aiFreestyling
Есть бесплатный тариф
4.9
ArtGeneration.meArtgeneration
Есть бесплатный тариф
4.9
BigjpgBigjpg
По запросу
4.9
Художник от VKVK
Бесплатно
4.9
Wonderink — ИИ-книги
Есть бесплатный тариф
4.8
Avato AI12ai
По запросу
4.8
Virton AIVirton
По запросу
4.8