@mtndev/cli 1.1.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -0
- package/cjs/__chunks/VH7oDXx4.cjs +28 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.cjs +261 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
- package/cjs/commands/aws/ec2/allow-ip/index.cjs +25 -0
- package/cjs/commands/aws/ec2/allow-ip/index.d.ts +3 -0
- package/cjs/commands/aws/ec2/allow-ip/schema.cjs +33 -0
- package/cjs/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
- package/cjs/commands/aws/ec2/allow-ip/utils.cjs +379 -0
- package/cjs/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
- package/cjs/commands/aws/iam/admin-group.cjs +111 -0
- package/cjs/commands/aws/iam/admin-group.d.ts +55 -0
- package/cjs/commands/aws/iam/break-glass/handler.cjs +127 -0
- package/cjs/commands/aws/iam/break-glass/handler.d.ts +7 -0
- package/cjs/commands/aws/iam/break-glass/index.cjs +7 -0
- package/cjs/commands/aws/iam/break-glass/index.d.ts +2 -0
- package/cjs/commands/aws/iam/break-glass/schema.cjs +21 -0
- package/cjs/commands/aws/iam/break-glass/schema.d.ts +25 -0
- package/cjs/commands/aws/iam/check-admin/handler.cjs +89 -0
- package/cjs/commands/aws/iam/check-admin/handler.d.ts +5 -0
- package/cjs/commands/aws/iam/check-admin/index.cjs +7 -0
- package/cjs/commands/aws/iam/check-admin/index.d.ts +2 -0
- package/cjs/commands/aws/iam/check-admin/schema.cjs +19 -0
- package/cjs/commands/aws/iam/check-admin/schema.d.ts +19 -0
- package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
- package/cjs/commands/aws/iam/policies/sts-federation.json +11 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
- package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
- package/cjs/commands/aws/iam/policies/user-admins-write-list.json +117 -0
- package/cjs/commands/aws/iam/remove-admin/handler.cjs +120 -0
- package/cjs/commands/aws/iam/remove-admin/handler.d.ts +6 -0
- package/cjs/commands/aws/iam/remove-admin/index.cjs +7 -0
- package/cjs/commands/aws/iam/remove-admin/index.d.ts +2 -0
- package/cjs/commands/aws/iam/remove-admin/schema.cjs +22 -0
- package/cjs/commands/aws/iam/remove-admin/schema.d.ts +28 -0
- package/cjs/commands/aws/iam/setup-acl/handler.cjs +227 -0
- package/cjs/commands/aws/iam/setup-acl/handler.d.ts +6 -0
- package/cjs/commands/aws/iam/setup-acl/index.cjs +13 -0
- package/cjs/commands/aws/iam/setup-acl/index.d.ts +3 -0
- package/cjs/commands/aws/iam/setup-acl/schema.cjs +19 -0
- package/cjs/commands/aws/iam/setup-acl/schema.d.ts +24 -0
- package/cjs/commands/aws/iam/setup-acl/utils.cjs +305 -0
- package/cjs/commands/aws/iam/setup-acl/utils.d.ts +61 -0
- package/cjs/commands/aws/iam/users/handler.cjs +59 -0
- package/cjs/commands/aws/iam/users/handler.d.ts +5 -0
- package/cjs/commands/aws/iam/users/index.cjs +18 -0
- package/cjs/commands/aws/iam/users/index.d.ts +3 -0
- package/cjs/commands/aws/iam/users/schema.cjs +17 -0
- package/cjs/commands/aws/iam/users/schema.d.ts +18 -0
- package/cjs/commands/aws/iam/users/utils.cjs +454 -0
- package/cjs/commands/aws/iam/users/utils.d.ts +119 -0
- package/cjs/commands/aws/index.cjs +223 -0
- package/cjs/commands/aws/index.d.ts +14 -0
- package/cjs/commands/aws/route53/add-record/handler.cjs +264 -0
- package/cjs/commands/aws/route53/add-record/handler.d.ts +36 -0
- package/cjs/commands/aws/route53/add-record/index.cjs +26 -0
- package/cjs/commands/aws/route53/add-record/index.d.ts +3 -0
- package/cjs/commands/aws/route53/add-record/schema.cjs +43 -0
- package/cjs/commands/aws/route53/add-record/schema.d.ts +45 -0
- package/cjs/commands/aws/route53/add-record/utils.cjs +404 -0
- package/cjs/commands/aws/route53/add-record/utils.d.ts +216 -0
- package/cjs/commands/aws/route53/remove-record/handler.cjs +114 -0
- package/cjs/commands/aws/route53/remove-record/handler.d.ts +6 -0
- package/cjs/commands/aws/route53/remove-record/index.cjs +5 -0
- package/cjs/commands/aws/route53/remove-record/index.d.ts +2 -0
- package/cjs/commands/aws/route53/remove-record/schema.cjs +22 -0
- package/cjs/commands/aws/route53/remove-record/schema.d.ts +30 -0
- package/cjs/commands/aws/schema.cjs +19 -0
- package/cjs/commands/aws/schema.d.ts +13 -0
- package/cjs/commands/aws/ses/send-email/handler.cjs +73 -0
- package/cjs/commands/aws/ses/send-email/handler.d.ts +5 -0
- package/cjs/commands/aws/ses/send-email/index.cjs +9 -0
- package/cjs/commands/aws/ses/send-email/index.d.ts +3 -0
- package/cjs/commands/aws/ses/send-email/schema.cjs +24 -0
- package/cjs/commands/aws/ses/send-email/schema.d.ts +39 -0
- package/cjs/commands/aws/ses/send-email/utils.cjs +87 -0
- package/cjs/commands/aws/ses/send-email/utils.d.ts +47 -0
- package/cjs/commands/aws/ses/smtp-password.cjs +72 -0
- package/cjs/commands/aws/ses/smtp-password.d.ts +21 -0
- package/cjs/commands/aws/utils/exec-aws.cjs +145 -0
- package/cjs/commands/aws/utils/exec-aws.d.ts +79 -0
- package/cjs/commands/aws/utils/resolve-policy-path.cjs +15 -0
- package/cjs/commands/aws/utils/resolve-policy-path.d.ts +8 -0
- package/cjs/commands/aws/utils/resolve-profile.cjs +93 -0
- package/cjs/commands/aws/utils/resolve-profile.d.ts +28 -0
- package/cjs/commands/aws/utils/tty.cjs +54 -0
- package/cjs/commands/aws/utils/tty.d.ts +24 -0
- package/cjs/commands/db/create-readonly-user/handler.cjs +254 -0
- package/cjs/commands/db/create-readonly-user/handler.d.ts +5 -0
- package/cjs/commands/db/create-readonly-user/index.cjs +18 -0
- package/cjs/commands/db/create-readonly-user/index.d.ts +3 -0
- package/cjs/commands/db/create-readonly-user/mysql.cjs +102 -0
- package/cjs/commands/db/create-readonly-user/mysql.d.ts +33 -0
- package/cjs/commands/db/create-readonly-user/postgres.cjs +209 -0
- package/cjs/commands/db/create-readonly-user/postgres.d.ts +31 -0
- package/cjs/commands/db/create-readonly-user/schema.cjs +39 -0
- package/cjs/commands/db/create-readonly-user/schema.d.ts +55 -0
- package/cjs/commands/db/create-readonly-user/utils.cjs +160 -0
- package/cjs/commands/db/create-readonly-user/utils.d.ts +112 -0
- package/cjs/commands/db/index.cjs +46 -0
- package/cjs/commands/db/index.d.ts +6 -0
- package/cjs/commands/doppler/handler.cjs +95 -9
- package/cjs/commands/doppler/index.cjs +33 -41
- package/cjs/commands/doppler/index.d.ts +1 -0
- package/cjs/commands/doppler/schema.cjs +130 -6
- package/cjs/commands/doppler/schema.d.ts +233 -17
- package/cjs/commands/doppler/set-secret.cjs +378 -0
- package/cjs/commands/doppler/set-secret.d.ts +113 -0
- package/cjs/commands/doppler/utils/exec.cjs +106 -12
- package/cjs/commands/doppler/utils.cjs +412 -30
- package/cjs/commands/doppler/utils.d.ts +32 -8
- package/cjs/commands/icons/handler.cjs +82 -8
- package/cjs/commands/icons/index.cjs +15 -31
- package/cjs/commands/icons/schema.cjs +101 -13
- package/cjs/commands/icons/schema.d.ts +1 -1
- package/cjs/commands/icons/utils.cjs +131 -13
- package/cjs/commands/index.cjs +54 -82
- package/cjs/commands/schema.cjs +25 -8
- package/cjs/index.cjs +3 -4
- package/esm/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
- package/esm/commands/aws/ec2/allow-ip/handler.js +258 -0
- package/esm/commands/aws/ec2/allow-ip/index.d.ts +3 -0
- package/esm/commands/aws/ec2/allow-ip/index.js +4 -0
- package/esm/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
- package/esm/commands/aws/ec2/allow-ip/schema.js +29 -0
- package/esm/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
- package/esm/commands/aws/ec2/allow-ip/utils.js +363 -0
- package/esm/commands/aws/iam/admin-group.d.ts +55 -0
- package/esm/commands/aws/iam/admin-group.js +104 -0
- package/esm/commands/aws/iam/break-glass/handler.d.ts +7 -0
- package/esm/commands/aws/iam/break-glass/handler.js +124 -0
- package/esm/commands/aws/iam/break-glass/index.d.ts +2 -0
- package/esm/commands/aws/iam/break-glass/index.js +4 -0
- package/esm/commands/aws/iam/break-glass/schema.d.ts +25 -0
- package/esm/commands/aws/iam/break-glass/schema.js +19 -0
- package/esm/commands/aws/iam/check-admin/handler.d.ts +5 -0
- package/esm/commands/aws/iam/check-admin/handler.js +86 -0
- package/esm/commands/aws/iam/check-admin/index.d.ts +2 -0
- package/esm/commands/aws/iam/check-admin/index.js +4 -0
- package/esm/commands/aws/iam/check-admin/schema.d.ts +19 -0
- package/esm/commands/aws/iam/check-admin/schema.js +17 -0
- package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
- package/esm/commands/aws/iam/policies/sts-federation.json +11 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
- package/esm/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
- package/esm/commands/aws/iam/policies/user-admins-write-list.json +117 -0
- package/esm/commands/aws/iam/remove-admin/handler.d.ts +6 -0
- package/esm/commands/aws/iam/remove-admin/handler.js +117 -0
- package/esm/commands/aws/iam/remove-admin/index.d.ts +2 -0
- package/esm/commands/aws/iam/remove-admin/index.js +4 -0
- package/esm/commands/aws/iam/remove-admin/schema.d.ts +28 -0
- package/esm/commands/aws/iam/remove-admin/schema.js +20 -0
- package/esm/commands/aws/iam/setup-acl/handler.d.ts +6 -0
- package/esm/commands/aws/iam/setup-acl/handler.js +224 -0
- package/esm/commands/aws/iam/setup-acl/index.d.ts +3 -0
- package/esm/commands/aws/iam/setup-acl/index.js +4 -0
- package/esm/commands/aws/iam/setup-acl/schema.d.ts +24 -0
- package/esm/commands/aws/iam/setup-acl/schema.js +18 -0
- package/esm/commands/aws/iam/setup-acl/utils.d.ts +61 -0
- package/esm/commands/aws/iam/setup-acl/utils.js +298 -0
- package/esm/commands/aws/iam/users/handler.d.ts +5 -0
- package/esm/commands/aws/iam/users/handler.js +56 -0
- package/esm/commands/aws/iam/users/index.d.ts +3 -0
- package/esm/commands/aws/iam/users/index.js +4 -0
- package/esm/commands/aws/iam/users/schema.d.ts +18 -0
- package/esm/commands/aws/iam/users/schema.js +16 -0
- package/esm/commands/aws/iam/users/utils.d.ts +119 -0
- package/esm/commands/aws/iam/users/utils.js +440 -0
- package/esm/commands/aws/index.d.ts +14 -0
- package/esm/commands/aws/index.js +142 -0
- package/esm/commands/aws/route53/add-record/handler.d.ts +36 -0
- package/esm/commands/aws/route53/add-record/handler.js +258 -0
- package/esm/commands/aws/route53/add-record/index.d.ts +3 -0
- package/esm/commands/aws/route53/add-record/index.js +4 -0
- package/esm/commands/aws/route53/add-record/schema.d.ts +45 -0
- package/esm/commands/aws/route53/add-record/schema.js +40 -0
- package/esm/commands/aws/route53/add-record/utils.d.ts +216 -0
- package/esm/commands/aws/route53/add-record/utils.js +389 -0
- package/esm/commands/aws/route53/remove-record/handler.d.ts +6 -0
- package/esm/commands/aws/route53/remove-record/handler.js +111 -0
- package/esm/commands/aws/route53/remove-record/index.d.ts +2 -0
- package/esm/commands/aws/route53/remove-record/index.js +3 -0
- package/esm/commands/aws/route53/remove-record/schema.d.ts +30 -0
- package/esm/commands/aws/route53/remove-record/schema.js +21 -0
- package/esm/commands/aws/schema.d.ts +13 -0
- package/esm/commands/aws/schema.js +16 -0
- package/esm/commands/aws/ses/send-email/handler.d.ts +5 -0
- package/esm/commands/aws/ses/send-email/handler.js +70 -0
- package/esm/commands/aws/ses/send-email/index.d.ts +3 -0
- package/esm/commands/aws/ses/send-email/index.js +4 -0
- package/esm/commands/aws/ses/send-email/schema.d.ts +39 -0
- package/esm/commands/aws/ses/send-email/schema.js +23 -0
- package/esm/commands/aws/ses/send-email/utils.d.ts +47 -0
- package/esm/commands/aws/ses/send-email/utils.js +84 -0
- package/esm/commands/aws/ses/smtp-password.d.ts +21 -0
- package/esm/commands/aws/ses/smtp-password.js +69 -0
- package/esm/commands/aws/utils/exec-aws.d.ts +79 -0
- package/esm/commands/aws/utils/exec-aws.js +137 -0
- package/esm/commands/aws/utils/resolve-policy-path.d.ts +8 -0
- package/esm/commands/aws/utils/resolve-policy-path.js +14 -0
- package/esm/commands/aws/utils/resolve-profile.d.ts +28 -0
- package/esm/commands/aws/utils/resolve-profile.js +88 -0
- package/esm/commands/aws/utils/tty.d.ts +24 -0
- package/esm/commands/aws/utils/tty.js +51 -0
- package/esm/commands/db/create-readonly-user/handler.d.ts +5 -0
- package/esm/commands/db/create-readonly-user/handler.js +251 -0
- package/esm/commands/db/create-readonly-user/index.d.ts +3 -0
- package/esm/commands/db/create-readonly-user/index.js +4 -0
- package/esm/commands/db/create-readonly-user/mysql.d.ts +33 -0
- package/esm/commands/db/create-readonly-user/mysql.js +98 -0
- package/esm/commands/db/create-readonly-user/postgres.d.ts +31 -0
- package/esm/commands/db/create-readonly-user/postgres.js +205 -0
- package/esm/commands/db/create-readonly-user/schema.d.ts +55 -0
- package/esm/commands/db/create-readonly-user/schema.js +35 -0
- package/esm/commands/db/create-readonly-user/utils.d.ts +112 -0
- package/esm/commands/db/create-readonly-user/utils.js +151 -0
- package/esm/commands/db/index.d.ts +6 -0
- package/esm/commands/db/index.js +31 -0
- package/esm/commands/doppler/handler.js +92 -9
- package/esm/commands/doppler/index.d.ts +1 -0
- package/esm/commands/doppler/index.js +6 -41
- package/esm/commands/doppler/schema.d.ts +233 -17
- package/esm/commands/doppler/schema.js +125 -7
- package/esm/commands/doppler/set-secret.d.ts +113 -0
- package/esm/commands/doppler/set-secret.js +370 -0
- package/esm/commands/doppler/utils/exec.js +100 -12
- package/esm/commands/doppler/utils.d.ts +32 -8
- package/esm/commands/doppler/utils.js +396 -30
- package/esm/commands/icons/handler.js +79 -8
- package/esm/commands/icons/index.js +4 -31
- package/esm/commands/icons/schema.d.ts +1 -1
- package/esm/commands/icons/schema.js +97 -15
- package/esm/commands/icons/utils.js +125 -13
- package/esm/commands/index.js +49 -78
- package/esm/commands/schema.js +22 -7
- package/esm/index.js +3 -4
- package/package.json +12 -2
- package/vitest.config.ts +11 -0
- package/cjs/__chunks/4GFJUCSP.cjs +0 -52
- package/cjs/__chunks/4SFWHCB3.cjs +0 -133
- package/cjs/__chunks/B2KFW7T7.cjs +0 -1
- package/cjs/__chunks/EMMC33QA.cjs +0 -401
- package/cjs/__chunks/INFOPAHN.cjs +0 -117
- package/cjs/__chunks/J36P6UNE.cjs +0 -75
- package/cjs/__chunks/NIMXXHJQ.cjs +0 -92
- package/cjs/__chunks/NSRFG4DF.cjs +0 -100
- package/cjs/__chunks/WNJ3ZYLI.cjs +0 -1
- package/cjs/__chunks/ZMDIOZPT.cjs +0 -22
- package/esm/__chunks/46HGXFME.js +0 -0
- package/esm/__chunks/6G4PXXKF.js +0 -75
- package/esm/__chunks/6L5RNR7G.js +0 -100
- package/esm/__chunks/FL7AILGH.js +0 -133
- package/esm/__chunks/HJSXC6HP.js +0 -117
- package/esm/__chunks/O262GK4B.js +0 -401
- package/esm/__chunks/O3CCA76Q.js +0 -22
- package/esm/__chunks/SJXQJ7RS.js +0 -92
- package/esm/__chunks/SNCKIAOR.js +0 -0
- package/esm/__chunks/X3R5PSWH.js +0 -52
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function bound to a profile's working credential mode (direct or aws-vault).
|
|
3
|
+
* @typedef {(args: string[], options?: { expectJson?: boolean }) => any} ProfileRunner
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* List aws-vault profiles that have stored credentials.
|
|
7
|
+
* @returns {string[]}
|
|
8
|
+
*/
|
|
9
|
+
export function listVaultProfiles(): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Resolve which profiles to scan for admin-group commands.
|
|
12
|
+
* Uses `--profile`, then `AWS_PROFILE`, for a single profile unless `--all` is set.
|
|
13
|
+
* @param {{ profile?: string; all?: boolean }} params
|
|
14
|
+
* @returns {string[]}
|
|
15
|
+
*/
|
|
16
|
+
export function resolveAdminScanProfiles({ profile, all }: {
|
|
17
|
+
profile?: string;
|
|
18
|
+
all?: boolean;
|
|
19
|
+
}): string[];
|
|
20
|
+
/**
|
|
21
|
+
* @param {{ Users?: Array<{ UserName: string }> }} group
|
|
22
|
+
* @returns {string[]}
|
|
23
|
+
*/
|
|
24
|
+
export function groupUserNames(group: {
|
|
25
|
+
Users?: Array<{
|
|
26
|
+
UserName: string;
|
|
27
|
+
}>;
|
|
28
|
+
}): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Resolve a working credential runner for a profile and read the admin group.
|
|
31
|
+
* Tries stored credentials first, then falls back to `aws-vault exec`.
|
|
32
|
+
* The returned `run` reuses whichever mode worked, so callers can perform
|
|
33
|
+
* follow-up mutations (e.g. remove-user-from-group) with the same credentials.
|
|
34
|
+
* @param {{ profile: string; verbose?: boolean }} params
|
|
35
|
+
* @returns {{ accountId: string; arn: string; users: string[]; run: ProfileRunner } | null} Null when the profile is skipped
|
|
36
|
+
*/
|
|
37
|
+
export function resolveProfileScan(params: {
|
|
38
|
+
profile: string;
|
|
39
|
+
verbose?: boolean;
|
|
40
|
+
}): {
|
|
41
|
+
accountId: string;
|
|
42
|
+
arn: string;
|
|
43
|
+
users: string[];
|
|
44
|
+
run: ProfileRunner;
|
|
45
|
+
} | null;
|
|
46
|
+
/**
|
|
47
|
+
* The IAM group that grants break-glass admin access and should normally be empty.
|
|
48
|
+
*/
|
|
49
|
+
export const ADMIN_GROUP_NAME: "acl-admin-do-not-use";
|
|
50
|
+
/**
|
|
51
|
+
* A function bound to a profile's working credential mode (direct or aws-vault).
|
|
52
|
+
*/
|
|
53
|
+
export type ProfileRunner = (args: string[], options?: {
|
|
54
|
+
expectJson?: boolean;
|
|
55
|
+
}) => any;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("../../../../__chunks/VH7oDXx4.cjs");
|
|
3
|
+
const require_commands_aws_utils_tty = require("../../utils/tty.cjs");
|
|
4
|
+
const require_commands_aws_utils_exec_aws = require("../../utils/exec-aws.cjs");
|
|
5
|
+
const require_commands_aws_utils_resolve_profile = require("../../utils/resolve-profile.cjs");
|
|
6
|
+
const require_commands_aws_iam_admin_group = require("../admin-group.cjs");
|
|
7
|
+
const require_commands_aws_iam_break_glass_schema = require("./schema.cjs");
|
|
8
|
+
let chalk = require("chalk");
|
|
9
|
+
chalk = require_rolldown_runtime.__toESM(chalk, 1);
|
|
10
|
+
let zod = require("zod");
|
|
11
|
+
//#region src/commands/aws/iam/break-glass/handler.js
|
|
12
|
+
/**
|
|
13
|
+
* Derive an IAM user name from a caller-identity ARN.
|
|
14
|
+
* Returns null for non-user ARNs (assumed roles, root, etc.).
|
|
15
|
+
* @param {string} arn
|
|
16
|
+
* @returns {string | null}
|
|
17
|
+
*/
|
|
18
|
+
function userNameFromArn(arn) {
|
|
19
|
+
const index = arn.indexOf(":user/");
|
|
20
|
+
if (index === -1) return null;
|
|
21
|
+
const name = arn.slice(index + 6).split("/").pop();
|
|
22
|
+
return name && name.length > 0 ? name : null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* `aws iam break-glass` handler: grant break-glass admin access by adding a user
|
|
26
|
+
* to the acl-admin-do-not-use group for a single profile. Defaults to the
|
|
27
|
+
* caller's own IAM user when no --user is given.
|
|
28
|
+
* @param {unknown} options
|
|
29
|
+
*/
|
|
30
|
+
async function breakGlassCommand(options) {
|
|
31
|
+
try {
|
|
32
|
+
const { profile, user, yes, dryRun, verbose } = require_commands_aws_iam_break_glass_schema.breakGlassOptionsSchema.parse(options);
|
|
33
|
+
require_commands_aws_utils_exec_aws.requireCommands(["aws"]);
|
|
34
|
+
const targetProfile = await require_commands_aws_utils_resolve_profile.resolveProfile({ profile });
|
|
35
|
+
if (!targetProfile) {
|
|
36
|
+
console.error(chalk.default.red("No profile specified. Pass --profile <name> or set AWS_PROFILE."));
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
const scan = require_commands_aws_iam_admin_group.resolveProfileScan({
|
|
40
|
+
profile: targetProfile,
|
|
41
|
+
verbose
|
|
42
|
+
});
|
|
43
|
+
if (!scan) {
|
|
44
|
+
console.error(chalk.default.red(`\n❌ Could not read ${require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME} for profile "${targetProfile}".`));
|
|
45
|
+
console.error(chalk.default.yellow(" Check your credentials, and run `mtn aws iam setup-acl` first if the group does not exist yet.\n"));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
/** @type {string[]} */
|
|
49
|
+
let targets = user;
|
|
50
|
+
if (targets.length === 0) {
|
|
51
|
+
const derived = userNameFromArn(scan.arn);
|
|
52
|
+
if (!derived) {
|
|
53
|
+
console.error(chalk.default.red(`\n❌ Could not determine your IAM user from the caller identity:\n ${scan.arn}`));
|
|
54
|
+
console.error(chalk.default.yellow(" Pass --user <name> to choose who to grant.\n"));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
targets = [derived];
|
|
58
|
+
}
|
|
59
|
+
const alreadyMembers = new Set(scan.users);
|
|
60
|
+
const toGrant = targets.filter((name) => !alreadyMembers.has(name));
|
|
61
|
+
const existing = targets.filter((name) => alreadyMembers.has(name));
|
|
62
|
+
console.log(chalk.default.blue(`\n==> Break-glass admin (${require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME}) — profile ${targetProfile} (${scan.accountId})\n`));
|
|
63
|
+
for (const name of existing) console.log(chalk.default.dim(`-- ${name} already has break-glass access`));
|
|
64
|
+
if (toGrant.length === 0) {
|
|
65
|
+
console.log(chalk.default.green("\nNothing to do — all target user(s) already have break-glass access.\n"));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
console.log(chalk.default.red.bold(`⚠ This grants AdministratorAccess to ${toGrant.length} user(s): ${toGrant.join(", ")}`));
|
|
69
|
+
if (dryRun) {
|
|
70
|
+
for (const name of toGrant) console.log(chalk.default.yellow(` [dry-run] would add ${name} to ${require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME}`));
|
|
71
|
+
console.log(chalk.default.yellow("\n[dry-run] Re-run without --dry-run to apply.\n"));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let confirmed = yes;
|
|
75
|
+
if (!confirmed) confirmed = await require_commands_aws_utils_tty.promptYesNo({
|
|
76
|
+
message: ` Grant break-glass admin to ${toGrant.length} user(s) in ${targetProfile}?`,
|
|
77
|
+
defaultYes: false
|
|
78
|
+
});
|
|
79
|
+
if (!confirmed) {
|
|
80
|
+
console.log(chalk.default.dim(" aborted (not confirmed)\n"));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
let granted = 0;
|
|
84
|
+
for (const name of toGrant) try {
|
|
85
|
+
scan.run([
|
|
86
|
+
"iam",
|
|
87
|
+
"add-user-to-group",
|
|
88
|
+
"--group-name",
|
|
89
|
+
require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME,
|
|
90
|
+
"--user-name",
|
|
91
|
+
name
|
|
92
|
+
], { expectJson: false });
|
|
93
|
+
console.log(chalk.default.green(` granted ${name}`));
|
|
94
|
+
granted += 1;
|
|
95
|
+
} catch (grantError) {
|
|
96
|
+
const reason = grantError instanceof Error ? grantError.message.split("\n")[0] ?? "" : String(grantError);
|
|
97
|
+
console.log(chalk.default.red(` failed to grant ${name}: ${reason}`));
|
|
98
|
+
}
|
|
99
|
+
console.log(chalk.default.blue("\n==> Summary"));
|
|
100
|
+
console.log(` Profile: ${targetProfile} (${scan.accountId})`);
|
|
101
|
+
console.log(` Users granted: ${granted}`);
|
|
102
|
+
console.log(` Already had it: ${existing.length}`);
|
|
103
|
+
console.log(chalk.default.yellow("\n💡 Revoke with `mtn aws iam remove-admin` when you are done."));
|
|
104
|
+
console.log(chalk.default.dim(" You may need a fresh session (e.g. clear the aws-vault cache) before the new permissions apply.\n"));
|
|
105
|
+
} catch (error) {
|
|
106
|
+
if (error instanceof zod.ZodError) {
|
|
107
|
+
console.error(chalk.default.red("\n❌ Invalid command options:"));
|
|
108
|
+
error.errors.forEach((err) => {
|
|
109
|
+
console.error(chalk.default.red(` ${err.path.join(".")}: ${err.message}`));
|
|
110
|
+
});
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
const verbose = options?.verbose || false;
|
|
114
|
+
console.error(chalk.default.red("\n❌ break-glass failed:"));
|
|
115
|
+
if (error instanceof Error) {
|
|
116
|
+
console.error(chalk.default.red(` ${error.message}`));
|
|
117
|
+
if (verbose && error.stack) {
|
|
118
|
+
console.error(chalk.default.gray("\nStack trace:"));
|
|
119
|
+
console.error(chalk.default.gray(error.stack));
|
|
120
|
+
}
|
|
121
|
+
} else console.error(chalk.default.red(` ${String(error)}`));
|
|
122
|
+
console.error(chalk.default.yellow("\n💡 Requires the AWS CLI and iam:AddUserToGroup on the target profile.\n"));
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
exports.breakGlassCommand = breakGlassCommand;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aws iam break-glass` handler: grant break-glass admin access by adding a user
|
|
3
|
+
* to the acl-admin-do-not-use group for a single profile. Defaults to the
|
|
4
|
+
* caller's own IAM user when no --user is given.
|
|
5
|
+
* @param {unknown} options
|
|
6
|
+
*/
|
|
7
|
+
export function breakGlassCommand(options: unknown): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_iam_admin_group = require("../admin-group.cjs");
|
|
3
|
+
const require_commands_aws_iam_break_glass_schema = require("./schema.cjs");
|
|
4
|
+
const require_commands_aws_iam_break_glass_handler = require("./handler.cjs");
|
|
5
|
+
exports.ADMIN_GROUP_NAME = require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME;
|
|
6
|
+
exports.breakGlassCommand = require_commands_aws_iam_break_glass_handler.breakGlassCommand;
|
|
7
|
+
exports.breakGlassOptionsSchema = require_commands_aws_iam_break_glass_schema.breakGlassOptionsSchema;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_schema = require("../../schema.cjs");
|
|
3
|
+
const require_commands_aws_iam_admin_group = require("../admin-group.cjs");
|
|
4
|
+
let zod = require("zod");
|
|
5
|
+
//#region src/commands/aws/iam/break-glass/schema.js
|
|
6
|
+
/**
|
|
7
|
+
* Zod schema for `aws iam break-glass` options.
|
|
8
|
+
*/
|
|
9
|
+
const breakGlassOptionsSchema = zod.z.object({
|
|
10
|
+
profile: require_commands_aws_schema.profileField,
|
|
11
|
+
user: zod.z.array(zod.z.string()).optional().default([]).describe("Grant break-glass to this user (repeatable). Default: your own IAM user"),
|
|
12
|
+
yes: zod.z.boolean().optional().default(false).describe("Skip the confirmation prompt"),
|
|
13
|
+
dryRun: zod.z.boolean().optional().default(false).describe("Preview the grant without changing anything"),
|
|
14
|
+
verbose: require_commands_aws_schema.verboseField
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {z.infer<typeof breakGlassOptionsSchema>} BreakGlassOptions
|
|
18
|
+
*/
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.ADMIN_GROUP_NAME = require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME;
|
|
21
|
+
exports.breakGlassOptionsSchema = breakGlassOptionsSchema;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { ADMIN_GROUP_NAME } from "../admin-group.js";
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for `aws iam break-glass` options.
|
|
4
|
+
*/
|
|
5
|
+
export const breakGlassOptionsSchema: z.ZodObject<{
|
|
6
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
7
|
+
user: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
8
|
+
yes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
9
|
+
dryRun: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
10
|
+
verbose: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
verbose: boolean;
|
|
13
|
+
yes: boolean;
|
|
14
|
+
user: string[];
|
|
15
|
+
dryRun: boolean;
|
|
16
|
+
profile?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
profile?: string | undefined;
|
|
19
|
+
verbose?: boolean | undefined;
|
|
20
|
+
yes?: boolean | undefined;
|
|
21
|
+
user?: string[] | undefined;
|
|
22
|
+
dryRun?: boolean | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export type BreakGlassOptions = z.infer<typeof breakGlassOptionsSchema>;
|
|
25
|
+
import { z } from "zod";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("../../../../__chunks/VH7oDXx4.cjs");
|
|
3
|
+
const require_commands_aws_utils_exec_aws = require("../../utils/exec-aws.cjs");
|
|
4
|
+
const require_commands_aws_iam_admin_group = require("../admin-group.cjs");
|
|
5
|
+
const require_commands_aws_iam_check_admin_schema = require("./schema.cjs");
|
|
6
|
+
let chalk = require("chalk");
|
|
7
|
+
chalk = require_rolldown_runtime.__toESM(chalk, 1);
|
|
8
|
+
let zod = require("zod");
|
|
9
|
+
//#region src/commands/aws/iam/check-admin/handler.js
|
|
10
|
+
/**
|
|
11
|
+
* `aws iam check-admin` handler: alert if anyone is a member of acl-admin-do-not-use.
|
|
12
|
+
* @param {unknown} options
|
|
13
|
+
*/
|
|
14
|
+
async function checkAdminCommand(options) {
|
|
15
|
+
try {
|
|
16
|
+
const { profile, all, verbose } = require_commands_aws_iam_check_admin_schema.checkAdminOptionsSchema.parse(options);
|
|
17
|
+
require_commands_aws_utils_exec_aws.requireCommands(["aws"]);
|
|
18
|
+
if (all || !(profile ?? process.env.AWS_PROFILE)) require_commands_aws_utils_exec_aws.requireCommands(["aws-vault"]);
|
|
19
|
+
/** @type {string[]} */
|
|
20
|
+
let profiles;
|
|
21
|
+
try {
|
|
22
|
+
profiles = require_commands_aws_iam_admin_group.resolveAdminScanProfiles({
|
|
23
|
+
profile,
|
|
24
|
+
all
|
|
25
|
+
});
|
|
26
|
+
} catch (resolveError) {
|
|
27
|
+
if (resolveError instanceof Error && resolveError.message === "No aws-vault profiles with credentials found.") {
|
|
28
|
+
console.error(chalk.default.red(resolveError.message));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
throw resolveError;
|
|
32
|
+
}
|
|
33
|
+
console.log(chalk.default.blue(`\n==> Checking ${profiles.length} profile(s) for ${require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME}\n`));
|
|
34
|
+
let ok = 0;
|
|
35
|
+
let alert = 0;
|
|
36
|
+
let skip = 0;
|
|
37
|
+
for (const candidate of profiles) {
|
|
38
|
+
const scan = require_commands_aws_iam_admin_group.resolveProfileScan({
|
|
39
|
+
profile: candidate,
|
|
40
|
+
verbose
|
|
41
|
+
});
|
|
42
|
+
if (!scan) {
|
|
43
|
+
skip += 1;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (scan.users.length === 0) {
|
|
47
|
+
console.log(chalk.default.green(`OK ${candidate} (${scan.accountId}) — ${require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME}: 0 users`));
|
|
48
|
+
ok += 1;
|
|
49
|
+
} else {
|
|
50
|
+
console.log(chalk.default.red(`ALERT ${candidate} (${scan.accountId}) — ${require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME}: ${scan.users.length} user(s): ${scan.users.join(", ")}`));
|
|
51
|
+
alert += 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
console.log(chalk.default.blue("\n==> Summary"));
|
|
55
|
+
console.log(` Profiles scanned: ${profiles.length}`);
|
|
56
|
+
console.log(` OK (empty group): ${ok}`);
|
|
57
|
+
console.log(` ALERT (has users): ${alert}`);
|
|
58
|
+
console.log(` Skipped (silent): ${skip}`);
|
|
59
|
+
if (alert > 0) {
|
|
60
|
+
console.log(chalk.default.red(`\nRemove users from ${require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME} when break-glass access is no longer needed.`));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
if (ok === 0) {
|
|
64
|
+
console.log(chalk.default.yellow(`\nNo profiles returned IAM access for ${require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME}.`));
|
|
65
|
+
console.log(chalk.default.yellow(" Use a profile with iam:GetGroup (e.g. md-*-iam-admin) or run with --verbose."));
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
if (error instanceof zod.ZodError) {
|
|
69
|
+
console.error(chalk.default.red("\n❌ Invalid command options:"));
|
|
70
|
+
error.errors.forEach((err) => {
|
|
71
|
+
console.error(chalk.default.red(` ${err.path.join(".")}: ${err.message}`));
|
|
72
|
+
});
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
const verbose = options?.verbose || false;
|
|
76
|
+
console.error(chalk.default.red("\n❌ check-admin failed:"));
|
|
77
|
+
if (error instanceof Error) {
|
|
78
|
+
console.error(chalk.default.red(` ${error.message}`));
|
|
79
|
+
if (verbose && error.stack) {
|
|
80
|
+
console.error(chalk.default.gray("\nStack trace:"));
|
|
81
|
+
console.error(chalk.default.gray(error.stack));
|
|
82
|
+
}
|
|
83
|
+
} else console.error(chalk.default.red(` ${String(error)}`));
|
|
84
|
+
console.error(chalk.default.yellow("\n💡 Requires the AWS CLI, and aws-vault when scanning multiple profiles.\n"));
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
exports.checkAdminCommand = checkAdminCommand;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_iam_admin_group = require("../admin-group.cjs");
|
|
3
|
+
const require_commands_aws_iam_check_admin_schema = require("./schema.cjs");
|
|
4
|
+
const require_commands_aws_iam_check_admin_handler = require("./handler.cjs");
|
|
5
|
+
exports.ADMIN_GROUP_NAME = require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME;
|
|
6
|
+
exports.checkAdminCommand = require_commands_aws_iam_check_admin_handler.checkAdminCommand;
|
|
7
|
+
exports.checkAdminOptionsSchema = require_commands_aws_iam_check_admin_schema.checkAdminOptionsSchema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_commands_aws_schema = require("../../schema.cjs");
|
|
3
|
+
const require_commands_aws_iam_admin_group = require("../admin-group.cjs");
|
|
4
|
+
let zod = require("zod");
|
|
5
|
+
//#region src/commands/aws/iam/check-admin/schema.js
|
|
6
|
+
/**
|
|
7
|
+
* Zod schema for `aws iam check-admin` options.
|
|
8
|
+
*/
|
|
9
|
+
const checkAdminOptionsSchema = zod.z.object({
|
|
10
|
+
profile: require_commands_aws_schema.profileField,
|
|
11
|
+
all: zod.z.boolean().optional().default(false).describe("Scan every aws-vault profile (default only when --profile and AWS_PROFILE are unset)"),
|
|
12
|
+
verbose: require_commands_aws_schema.verboseField
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {z.infer<typeof checkAdminOptionsSchema>} CheckAdminOptions
|
|
16
|
+
*/
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.ADMIN_GROUP_NAME = require_commands_aws_iam_admin_group.ADMIN_GROUP_NAME;
|
|
19
|
+
exports.checkAdminOptionsSchema = checkAdminOptionsSchema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { ADMIN_GROUP_NAME } from "../admin-group.js";
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for `aws iam check-admin` options.
|
|
4
|
+
*/
|
|
5
|
+
export const checkAdminOptionsSchema: z.ZodObject<{
|
|
6
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
7
|
+
all: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
|
+
verbose: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
verbose: boolean;
|
|
11
|
+
all: boolean;
|
|
12
|
+
profile?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
profile?: string | undefined;
|
|
15
|
+
verbose?: boolean | undefined;
|
|
16
|
+
all?: boolean | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export type CheckAdminOptions = z.infer<typeof checkAdminOptionsSchema>;
|
|
19
|
+
import { z } from "zod";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Version": "2012-10-17",
|
|
3
|
+
"Statement": [
|
|
4
|
+
{
|
|
5
|
+
"Sid": "DenyNonS3Services",
|
|
6
|
+
"Effect": "Deny",
|
|
7
|
+
"NotAction": [
|
|
8
|
+
"s3:*",
|
|
9
|
+
"logs:*",
|
|
10
|
+
"sts:AssumeRole",
|
|
11
|
+
"iam:PassRole",
|
|
12
|
+
"kms:Decrypt",
|
|
13
|
+
"kms:GenerateDataKey",
|
|
14
|
+
"kms:DescribeKey",
|
|
15
|
+
"lambda:InvokeFunction"
|
|
16
|
+
],
|
|
17
|
+
"Resource": "*"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Version": "2012-10-17",
|
|
3
|
+
"Statement": [
|
|
4
|
+
{
|
|
5
|
+
"Sid": "DenyAIServices",
|
|
6
|
+
"Effect": "Deny",
|
|
7
|
+
"Action": [
|
|
8
|
+
"bedrock:*",
|
|
9
|
+
"sagemaker:*",
|
|
10
|
+
"comprehend:*",
|
|
11
|
+
"comprehendmedical:*",
|
|
12
|
+
"rekognition:*",
|
|
13
|
+
"textract:*",
|
|
14
|
+
"personalize:*",
|
|
15
|
+
"forecast:*",
|
|
16
|
+
"lex:*",
|
|
17
|
+
"polly:*",
|
|
18
|
+
"translate:*",
|
|
19
|
+
"transcribe:*",
|
|
20
|
+
"kendra:*",
|
|
21
|
+
"q:*"
|
|
22
|
+
],
|
|
23
|
+
"Resource": "*"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"Sid": "DenyOrgAndAccountWrites",
|
|
27
|
+
"Effect": "Deny",
|
|
28
|
+
"Action": [
|
|
29
|
+
"organizations:*",
|
|
30
|
+
"account:CloseAccount",
|
|
31
|
+
"account:DeleteAlternateContact",
|
|
32
|
+
"account:PutAlternateContact",
|
|
33
|
+
"account:PutChallengeQuestions",
|
|
34
|
+
"account:EnableRegion",
|
|
35
|
+
"account:DisableRegion",
|
|
36
|
+
"account:PutAccountName"
|
|
37
|
+
],
|
|
38
|
+
"Resource": "*"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"Sid": "DenyBillingMutations",
|
|
42
|
+
"Effect": "Deny",
|
|
43
|
+
"Action": [
|
|
44
|
+
"aws-portal:Modify*",
|
|
45
|
+
"billing:Update*",
|
|
46
|
+
"billing:Put*",
|
|
47
|
+
"billing:Delete*",
|
|
48
|
+
"budgets:Modify*",
|
|
49
|
+
"budgets:Create*",
|
|
50
|
+
"budgets:Delete*",
|
|
51
|
+
"savingsplans:Create*",
|
|
52
|
+
"savingsplans:Delete*",
|
|
53
|
+
"supportplans:Create*",
|
|
54
|
+
"supportplans:Delete*",
|
|
55
|
+
"purchase-orders:Modify*",
|
|
56
|
+
"purchase-orders:Create*",
|
|
57
|
+
"cur:Put*",
|
|
58
|
+
"cur:Delete*"
|
|
59
|
+
],
|
|
60
|
+
"Resource": "*"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"Sid": "DenyCloudTrailTampering",
|
|
64
|
+
"Effect": "Deny",
|
|
65
|
+
"Action": [
|
|
66
|
+
"cloudtrail:StopLogging",
|
|
67
|
+
"cloudtrail:DeleteTrail",
|
|
68
|
+
"cloudtrail:UpdateTrail",
|
|
69
|
+
"cloudtrail:PutEventSelectors",
|
|
70
|
+
"cloudtrail:DeleteEventDataStore"
|
|
71
|
+
],
|
|
72
|
+
"Resource": "*"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"Sid": "DenyExpensiveServices",
|
|
76
|
+
"Effect": "Deny",
|
|
77
|
+
"Action": [
|
|
78
|
+
"airflow:CreateEnvironment",
|
|
79
|
+
"airflow:UpdateEnvironment",
|
|
80
|
+
"mwaa:*",
|
|
81
|
+
"transfer:CreateServer",
|
|
82
|
+
"transfer:UpdateServer",
|
|
83
|
+
"transfer:StartServer",
|
|
84
|
+
"shield:CreateSubscription",
|
|
85
|
+
"shield:CreateProtection",
|
|
86
|
+
"shield:CreateProtectionGroup"
|
|
87
|
+
],
|
|
88
|
+
"Resource": "*"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"Sid": "DenyKMSDestruction",
|
|
92
|
+
"Effect": "Deny",
|
|
93
|
+
"Action": [
|
|
94
|
+
"kms:ScheduleKeyDeletion",
|
|
95
|
+
"kms:DisableKey",
|
|
96
|
+
"kms:DisableKeyRotation"
|
|
97
|
+
],
|
|
98
|
+
"Resource": "*"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"Sid": "DenyNeptuneViaRds",
|
|
102
|
+
"Effect": "Deny",
|
|
103
|
+
"Action": [
|
|
104
|
+
"rds:CreateDBCluster",
|
|
105
|
+
"rds:CreateDBInstance",
|
|
106
|
+
"rds:ModifyDBCluster",
|
|
107
|
+
"rds:ModifyDBInstance",
|
|
108
|
+
"rds:RestoreDBClusterFromSnapshot",
|
|
109
|
+
"rds:RestoreDBInstanceFromDBSnapshot"
|
|
110
|
+
],
|
|
111
|
+
"Resource": "*",
|
|
112
|
+
"Condition": {
|
|
113
|
+
"StringEquals": {
|
|
114
|
+
"rds:DatabaseEngine": "neptune"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"Sid": "DenyExpensiveGpuEc2",
|
|
120
|
+
"Effect": "Deny",
|
|
121
|
+
"Action": [
|
|
122
|
+
"ec2:RunInstances",
|
|
123
|
+
"ec2:RequestSpotInstances",
|
|
124
|
+
"ec2:RequestSpotFleet",
|
|
125
|
+
"ec2:ModifyInstanceAttribute"
|
|
126
|
+
],
|
|
127
|
+
"Resource": "*",
|
|
128
|
+
"Condition": {
|
|
129
|
+
"StringLike": {
|
|
130
|
+
"ec2:InstanceType": [
|
|
131
|
+
"p2.*",
|
|
132
|
+
"p3.*",
|
|
133
|
+
"p4d.*",
|
|
134
|
+
"p4de.*",
|
|
135
|
+
"p5.*",
|
|
136
|
+
"p5d.*",
|
|
137
|
+
"p5e.*",
|
|
138
|
+
"p5en.*",
|
|
139
|
+
"p6*",
|
|
140
|
+
"g3.*",
|
|
141
|
+
"g3s.*",
|
|
142
|
+
"g4dn.*",
|
|
143
|
+
"g4ad.*",
|
|
144
|
+
"g5.*",
|
|
145
|
+
"g5g.*",
|
|
146
|
+
"g6.*",
|
|
147
|
+
"g6e.*",
|
|
148
|
+
"g6f.*",
|
|
149
|
+
"inf1.*",
|
|
150
|
+
"inf2.*",
|
|
151
|
+
"trn1.*",
|
|
152
|
+
"trn1n.*",
|
|
153
|
+
"trn2.*",
|
|
154
|
+
"trn2a.*",
|
|
155
|
+
"trn2i.*",
|
|
156
|
+
"dl1.*",
|
|
157
|
+
"dl2q.*",
|
|
158
|
+
"f1.*",
|
|
159
|
+
"f2.*",
|
|
160
|
+
"vt1.*",
|
|
161
|
+
"hpc6id.*",
|
|
162
|
+
"u-12tb1.metal",
|
|
163
|
+
"u-18tb1.metal",
|
|
164
|
+
"u-24tb1.metal",
|
|
165
|
+
"u-6tb1.56xlarge",
|
|
166
|
+
"u-9tb1.112xlarge",
|
|
167
|
+
"x2iedn.*",
|
|
168
|
+
"x2idn.*",
|
|
169
|
+
"x2iezn.*"
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Version": "2012-10-17",
|
|
3
|
+
"Statement": [
|
|
4
|
+
{
|
|
5
|
+
"Sid": "DenyNonApprovedRegions",
|
|
6
|
+
"Effect": "Deny",
|
|
7
|
+
"NotAction": [
|
|
8
|
+
"iam:*",
|
|
9
|
+
"organizations:*",
|
|
10
|
+
"route53:*",
|
|
11
|
+
"route53domains:*",
|
|
12
|
+
"cloudfront:*",
|
|
13
|
+
"waf:*",
|
|
14
|
+
"wafv2:*",
|
|
15
|
+
"shield:*",
|
|
16
|
+
"globalaccelerator:*",
|
|
17
|
+
"sts:*",
|
|
18
|
+
"support:*",
|
|
19
|
+
"supportplans:*",
|
|
20
|
+
"trustedadvisor:*",
|
|
21
|
+
"health:*",
|
|
22
|
+
"budgets:*",
|
|
23
|
+
"ce:*",
|
|
24
|
+
"cur:*",
|
|
25
|
+
"account:*",
|
|
26
|
+
"billing:*",
|
|
27
|
+
"aws-portal:*",
|
|
28
|
+
"tag:*",
|
|
29
|
+
"resource-groups:*",
|
|
30
|
+
"ram:*",
|
|
31
|
+
"cloudshell:*"
|
|
32
|
+
],
|
|
33
|
+
"Resource": "*",
|
|
34
|
+
"Condition": {
|
|
35
|
+
"StringNotEquals": {
|
|
36
|
+
"aws:RequestedRegion": ["us-east-1", "us-east-2", "us-west-2"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|