@mtndev/cli 0.0.0-dev-20260626045346 → 0.0.0-pr-20-20261020022402
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 +86 -1
- package/cjs/__chunks/2FSYDFUV.cjs +146 -0
- package/cjs/__chunks/3A5ZYU5M.cjs +105 -0
- package/cjs/__chunks/3NOHGUCF.cjs +9 -0
- package/cjs/__chunks/3T2LXW7J.cjs +387 -0
- package/cjs/__chunks/4XT5JEAS.cjs +1 -0
- package/cjs/__chunks/AZEB4H4I.cjs +208 -0
- package/cjs/__chunks/B5ENMOCD.cjs +288 -0
- package/cjs/__chunks/B6XM5KSF.cjs +338 -0
- package/cjs/__chunks/BDU2UCE5.cjs +1 -0
- package/cjs/__chunks/BLMSMR5E.cjs +46 -0
- package/cjs/__chunks/CMUD7LLN.cjs +47 -0
- package/cjs/__chunks/DTQ2LB3I.cjs +49 -0
- package/cjs/__chunks/FM5MVRQF.cjs +23 -0
- package/cjs/__chunks/FRHST54J.cjs +135 -0
- package/cjs/__chunks/FU4VP2LN.cjs +1 -0
- package/cjs/__chunks/G5K4PVIL.cjs +26 -0
- package/cjs/__chunks/{NSRFG4DF.cjs → GU3R54MK.cjs} +45 -18
- package/cjs/__chunks/GUL36IFZ.cjs +61 -0
- package/cjs/__chunks/GZMTNK5N.cjs +1 -0
- package/cjs/__chunks/H74JSDBU.cjs +30 -0
- package/cjs/__chunks/{EMMC33QA.cjs → JB7T7PKQ.cjs} +170 -33
- package/cjs/__chunks/JSL2JDMW.cjs +1 -0
- package/cjs/__chunks/K4QNHRTP.cjs +163 -0
- package/cjs/__chunks/KU76LC42.cjs +192 -0
- package/cjs/__chunks/LFDSHANP.cjs +34 -0
- package/cjs/__chunks/LHE24ECK.cjs +192 -0
- package/cjs/__chunks/LIKQ3SI4.cjs +1 -0
- package/cjs/__chunks/LXDF5QVZ.cjs +313 -0
- package/cjs/__chunks/LXOOJR2R.cjs +74 -0
- package/cjs/__chunks/N5MXFOQZ.cjs +167 -0
- package/cjs/__chunks/N7D56LPP.cjs +25 -0
- package/cjs/__chunks/NFXQNOQH.cjs +393 -0
- package/cjs/__chunks/NLKJIUEX.cjs +126 -0
- package/cjs/__chunks/NT2XXAI6.cjs +89 -0
- package/cjs/__chunks/NWZGFHKH.cjs +121 -0
- package/cjs/__chunks/R3GUC7O7.cjs +110 -0
- package/cjs/__chunks/RPVAXPJ4.cjs +1 -0
- package/cjs/__chunks/S3LVCWPN.cjs +23 -0
- package/cjs/__chunks/SBBNW2BF.cjs +249 -0
- package/cjs/__chunks/T2A7TN4F.cjs +81 -0
- package/cjs/__chunks/TKNNDDIB.cjs +97 -0
- package/cjs/__chunks/TNSRDJPR.cjs +1 -0
- package/cjs/__chunks/UWHPE2GI.cjs +20 -0
- package/cjs/__chunks/W6K7BV74.cjs +1 -0
- package/cjs/__chunks/WBOQ6AUN.cjs +320 -0
- package/cjs/__chunks/WHGN5PZI.cjs +299 -0
- package/cjs/__chunks/WOYF2L6T.cjs +11 -0
- package/cjs/__chunks/X26XY2N6.cjs +18 -0
- package/cjs/__chunks/XMKOKRXZ.cjs +16 -0
- package/cjs/__chunks/XTJPQ3EX.cjs +1 -0
- package/cjs/__chunks/YRHFKTW2.cjs +63 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.cjs +12 -0
- package/cjs/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
- package/cjs/commands/aws/ec2/allow-ip/index.cjs +55 -0
- package/cjs/commands/aws/ec2/allow-ip/index.d.ts +3 -0
- package/cjs/commands/aws/ec2/allow-ip/schema.cjs +13 -0
- package/cjs/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
- package/cjs/commands/aws/ec2/allow-ip/utils.cjs +39 -0
- package/cjs/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
- package/cjs/commands/aws/iam/admin-group.cjs +15 -0
- package/cjs/commands/aws/iam/admin-group.d.ts +55 -0
- package/cjs/commands/aws/iam/break-glass/handler.cjs +12 -0
- package/cjs/commands/aws/iam/break-glass/handler.d.ts +7 -0
- package/cjs/commands/aws/iam/break-glass/index.cjs +19 -0
- package/cjs/commands/aws/iam/break-glass/index.d.ts +2 -0
- package/cjs/commands/aws/iam/break-glass/schema.cjs +12 -0
- package/cjs/commands/aws/iam/break-glass/schema.d.ts +25 -0
- package/cjs/commands/aws/iam/check-admin/handler.cjs +10 -0
- package/cjs/commands/aws/iam/check-admin/handler.d.ts +5 -0
- package/cjs/commands/aws/iam/check-admin/index.cjs +17 -0
- package/cjs/commands/aws/iam/check-admin/index.d.ts +2 -0
- package/cjs/commands/aws/iam/check-admin/schema.cjs +12 -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.cjs +28 -0
- package/cjs/commands/aws/iam/policies/sts-federation.cjs +19 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-list.cjs +183 -0
- package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.cjs +49 -0
- package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.cjs +64 -0
- package/cjs/commands/aws/iam/policies/user-admins-write-list.cjs +125 -0
- package/cjs/commands/aws/iam/remove-admin/handler.cjs +11 -0
- package/cjs/commands/aws/iam/remove-admin/handler.d.ts +6 -0
- package/cjs/commands/aws/iam/remove-admin/index.cjs +18 -0
- package/cjs/commands/aws/iam/remove-admin/index.d.ts +2 -0
- package/cjs/commands/aws/iam/remove-admin/schema.cjs +12 -0
- package/cjs/commands/aws/iam/remove-admin/schema.d.ts +28 -0
- package/cjs/commands/aws/iam/setup-acl/handler.cjs +14 -0
- package/cjs/commands/aws/iam/setup-acl/handler.d.ts +6 -0
- package/cjs/commands/aws/iam/setup-acl/index.cjs +33 -0
- package/cjs/commands/aws/iam/setup-acl/index.d.ts +3 -0
- package/cjs/commands/aws/iam/setup-acl/schema.cjs +7 -0
- package/cjs/commands/aws/iam/setup-acl/schema.d.ts +24 -0
- package/cjs/commands/aws/iam/setup-acl/utils.cjs +20 -0
- package/cjs/commands/aws/iam/setup-acl/utils.d.ts +61 -0
- package/cjs/commands/aws/iam/users/handler.cjs +12 -0
- package/cjs/commands/aws/iam/users/handler.d.ts +5 -0
- package/cjs/commands/aws/iam/users/index.cjs +41 -0
- package/cjs/commands/aws/iam/users/index.d.ts +3 -0
- package/cjs/commands/aws/iam/users/schema.cjs +7 -0
- package/cjs/commands/aws/iam/users/schema.d.ts +18 -0
- package/cjs/commands/aws/iam/users/utils.cjs +30 -0
- package/cjs/commands/aws/iam/users/utils.d.ts +119 -0
- package/cjs/commands/aws/index.cjs +229 -0
- package/cjs/commands/aws/index.d.ts +14 -0
- package/cjs/commands/aws/route53/add-record/handler.cjs +18 -0
- package/cjs/commands/aws/route53/add-record/handler.d.ts +36 -0
- package/cjs/commands/aws/route53/add-record/index.cjs +57 -0
- package/cjs/commands/aws/route53/add-record/index.d.ts +3 -0
- package/cjs/commands/aws/route53/add-record/schema.cjs +11 -0
- package/cjs/commands/aws/route53/add-record/schema.d.ts +45 -0
- package/cjs/commands/aws/route53/add-record/utils.cjs +37 -0
- package/cjs/commands/aws/route53/add-record/utils.d.ts +216 -0
- package/cjs/commands/aws/route53/remove-record/handler.cjs +14 -0
- package/cjs/commands/aws/route53/remove-record/handler.d.ts +6 -0
- package/cjs/commands/aws/route53/remove-record/index.cjs +18 -0
- package/cjs/commands/aws/route53/remove-record/index.d.ts +2 -0
- package/cjs/commands/aws/route53/remove-record/schema.cjs +8 -0
- package/cjs/commands/aws/route53/remove-record/schema.d.ts +30 -0
- package/cjs/commands/aws/schema.cjs +10 -0
- package/cjs/commands/aws/schema.d.ts +13 -0
- package/cjs/commands/aws/ses/send-email/handler.cjs +12 -0
- package/cjs/commands/aws/ses/send-email/handler.d.ts +5 -0
- package/cjs/commands/aws/ses/send-email/index.cjs +23 -0
- package/cjs/commands/aws/ses/send-email/index.d.ts +3 -0
- package/cjs/commands/aws/ses/send-email/schema.cjs +7 -0
- package/cjs/commands/aws/ses/send-email/schema.d.ts +39 -0
- package/cjs/commands/aws/ses/send-email/utils.cjs +11 -0
- package/cjs/commands/aws/ses/send-email/utils.d.ts +47 -0
- package/cjs/commands/aws/ses/smtp-password.cjs +10 -0
- package/cjs/commands/aws/ses/smtp-password.d.ts +21 -0
- package/cjs/commands/aws/utils/exec-aws.cjs +16 -0
- package/cjs/commands/aws/utils/exec-aws.d.ts +79 -0
- package/cjs/commands/aws/utils/resolve-policy-path.cjs +6 -0
- package/cjs/commands/aws/utils/resolve-policy-path.d.ts +8 -0
- package/cjs/commands/aws/utils/resolve-profile.cjs +11 -0
- package/cjs/commands/aws/utils/resolve-profile.d.ts +28 -0
- package/cjs/commands/aws/utils/tty.cjs +10 -0
- package/cjs/commands/aws/utils/tty.d.ts +24 -0
- package/cjs/commands/db/create-readonly-user/handler.cjs +11 -0
- package/cjs/commands/db/create-readonly-user/handler.d.ts +5 -0
- package/cjs/commands/db/create-readonly-user/index.cjs +40 -0
- package/cjs/commands/db/create-readonly-user/index.d.ts +3 -0
- package/cjs/commands/db/create-readonly-user/mysql.cjs +9 -0
- package/cjs/commands/db/create-readonly-user/mysql.d.ts +33 -0
- package/cjs/commands/db/create-readonly-user/postgres.cjs +9 -0
- package/cjs/commands/db/create-readonly-user/postgres.d.ts +31 -0
- package/cjs/commands/db/create-readonly-user/schema.cjs +12 -0
- package/cjs/commands/db/create-readonly-user/schema.d.ts +55 -0
- package/cjs/commands/db/create-readonly-user/utils.cjs +22 -0
- package/cjs/commands/db/create-readonly-user/utils.d.ts +112 -0
- package/cjs/commands/db/index.cjs +44 -0
- package/cjs/commands/db/index.d.ts +6 -0
- package/cjs/commands/doppler/handler.cjs +6 -4
- package/cjs/commands/doppler/index.cjs +32 -5
- package/cjs/commands/doppler/index.d.ts +1 -0
- package/cjs/commands/doppler/schema.cjs +10 -2
- package/cjs/commands/doppler/schema.d.ts +233 -17
- package/cjs/commands/doppler/set-secret.cjs +19 -0
- package/cjs/commands/doppler/set-secret.d.ts +113 -0
- package/cjs/commands/doppler/utils.cjs +6 -2
- package/cjs/commands/doppler/utils.d.ts +32 -8
- package/cjs/commands/icons/schema.d.ts +1 -1
- package/cjs/commands/index.cjs +91 -12
- package/esm/__chunks/2FTTEFEK.js +97 -0
- package/esm/__chunks/33UYMUQD.js +338 -0
- package/esm/__chunks/3BKWTHLJ.js +25 -0
- package/esm/__chunks/3HE4BEJX.js +105 -0
- package/esm/__chunks/3QLI5BDL.js +387 -0
- package/esm/__chunks/5GIUAFXL.js +89 -0
- package/esm/__chunks/73BJG53F.js +11 -0
- package/esm/__chunks/7VF4Q43Q.js +0 -0
- package/esm/__chunks/AEDEAYF5.js +0 -0
- package/esm/__chunks/AZCP3SFJ.js +0 -0
- package/esm/__chunks/B2DVQ2UL.js +61 -0
- package/esm/__chunks/CVQVHLW5.js +0 -0
- package/esm/__chunks/D62SPZXC.js +0 -0
- package/esm/__chunks/DLEJ25GZ.js +121 -0
- package/esm/__chunks/DMYFNF54.js +192 -0
- package/esm/__chunks/DNFTUMGD.js +23 -0
- package/esm/__chunks/DVKD6YSR.js +49 -0
- package/esm/__chunks/EMSH4P76.js +20 -0
- package/esm/__chunks/FFKFVMIE.js +167 -0
- package/esm/__chunks/FNXUONAV.js +110 -0
- package/esm/__chunks/G4NJHFFU.js +320 -0
- package/esm/__chunks/IEOGAQYI.js +46 -0
- package/esm/__chunks/IZFGBYGE.js +34 -0
- package/esm/__chunks/J34UVKLA.js +26 -0
- package/esm/__chunks/JZPBBBIG.js +74 -0
- package/esm/__chunks/KWUJP5MG.js +135 -0
- package/esm/__chunks/M35URMT4.js +313 -0
- package/esm/__chunks/NF3M2L6C.js +81 -0
- package/esm/__chunks/PNPPDYKC.js +299 -0
- package/esm/__chunks/QFXN4EHM.js +393 -0
- package/esm/__chunks/QKDDLIWD.js +146 -0
- package/esm/__chunks/QSE66AKY.js +208 -0
- package/esm/__chunks/QUF7PS4R.js +18 -0
- package/esm/__chunks/S7IJPJ4R.js +126 -0
- package/esm/__chunks/SD3E3EPH.js +163 -0
- package/esm/__chunks/T3TTUHTW.js +30 -0
- package/esm/__chunks/TIOVE6HR.js +0 -0
- package/esm/__chunks/TXKMEIDQ.js +0 -0
- package/esm/__chunks/U7HAE2RF.js +288 -0
- package/esm/__chunks/UXWY7BYE.js +63 -0
- package/esm/__chunks/VKAKISRG.js +192 -0
- package/esm/__chunks/WD2YR6I7.js +0 -0
- package/esm/__chunks/WOZFZKFY.js +0 -0
- package/esm/__chunks/XI7GZDE2.js +0 -0
- package/esm/__chunks/XOUWDB3T.js +249 -0
- package/esm/__chunks/XQN2TA4S.js +23 -0
- package/esm/__chunks/XXK32TIM.js +16 -0
- package/esm/__chunks/{O262GK4B.js → YGWTVPZE.js} +164 -27
- package/esm/__chunks/{6L5RNR7G.js → YRG7PT33.js} +44 -17
- package/esm/__chunks/ZHKVJO2U.js +47 -0
- package/esm/__chunks/ZO55YUSY.js +9 -0
- package/esm/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
- package/esm/commands/aws/ec2/allow-ip/handler.js +12 -0
- package/esm/commands/aws/ec2/allow-ip/index.d.ts +3 -0
- package/esm/commands/aws/ec2/allow-ip/index.js +55 -0
- package/esm/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
- package/esm/commands/aws/ec2/allow-ip/schema.js +13 -0
- package/esm/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
- package/esm/commands/aws/ec2/allow-ip/utils.js +39 -0
- package/esm/commands/aws/iam/admin-group.d.ts +55 -0
- package/esm/commands/aws/iam/admin-group.js +15 -0
- package/esm/commands/aws/iam/break-glass/handler.d.ts +7 -0
- package/esm/commands/aws/iam/break-glass/handler.js +12 -0
- package/esm/commands/aws/iam/break-glass/index.d.ts +2 -0
- package/esm/commands/aws/iam/break-glass/index.js +19 -0
- package/esm/commands/aws/iam/break-glass/schema.d.ts +25 -0
- package/esm/commands/aws/iam/break-glass/schema.js +12 -0
- package/esm/commands/aws/iam/check-admin/handler.d.ts +5 -0
- package/esm/commands/aws/iam/check-admin/handler.js +10 -0
- package/esm/commands/aws/iam/check-admin/index.d.ts +2 -0
- package/esm/commands/aws/iam/check-admin/index.js +17 -0
- package/esm/commands/aws/iam/check-admin/schema.d.ts +19 -0
- package/esm/commands/aws/iam/check-admin/schema.js +12 -0
- package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.js +28 -0
- package/esm/commands/aws/iam/policies/sts-federation.js +19 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-list.js +183 -0
- package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.js +49 -0
- package/esm/commands/aws/iam/policies/user-admins-self-service-iam.js +64 -0
- package/esm/commands/aws/iam/policies/user-admins-write-list.js +125 -0
- package/esm/commands/aws/iam/remove-admin/handler.d.ts +6 -0
- package/esm/commands/aws/iam/remove-admin/handler.js +11 -0
- package/esm/commands/aws/iam/remove-admin/index.d.ts +2 -0
- package/esm/commands/aws/iam/remove-admin/index.js +18 -0
- package/esm/commands/aws/iam/remove-admin/schema.d.ts +28 -0
- package/esm/commands/aws/iam/remove-admin/schema.js +12 -0
- package/esm/commands/aws/iam/setup-acl/handler.d.ts +6 -0
- package/esm/commands/aws/iam/setup-acl/handler.js +14 -0
- package/esm/commands/aws/iam/setup-acl/index.d.ts +3 -0
- package/esm/commands/aws/iam/setup-acl/index.js +33 -0
- package/esm/commands/aws/iam/setup-acl/schema.d.ts +24 -0
- package/esm/commands/aws/iam/setup-acl/schema.js +7 -0
- package/esm/commands/aws/iam/setup-acl/utils.d.ts +61 -0
- package/esm/commands/aws/iam/setup-acl/utils.js +20 -0
- package/esm/commands/aws/iam/users/handler.d.ts +5 -0
- package/esm/commands/aws/iam/users/handler.js +12 -0
- package/esm/commands/aws/iam/users/index.d.ts +3 -0
- package/esm/commands/aws/iam/users/index.js +41 -0
- package/esm/commands/aws/iam/users/schema.d.ts +18 -0
- package/esm/commands/aws/iam/users/schema.js +7 -0
- package/esm/commands/aws/iam/users/utils.d.ts +119 -0
- package/esm/commands/aws/iam/users/utils.js +30 -0
- package/esm/commands/aws/index.d.ts +14 -0
- package/esm/commands/aws/index.js +229 -0
- package/esm/commands/aws/route53/add-record/handler.d.ts +36 -0
- package/esm/commands/aws/route53/add-record/handler.js +18 -0
- package/esm/commands/aws/route53/add-record/index.d.ts +3 -0
- package/esm/commands/aws/route53/add-record/index.js +57 -0
- package/esm/commands/aws/route53/add-record/schema.d.ts +45 -0
- package/esm/commands/aws/route53/add-record/schema.js +11 -0
- package/esm/commands/aws/route53/add-record/utils.d.ts +216 -0
- package/esm/commands/aws/route53/add-record/utils.js +37 -0
- package/esm/commands/aws/route53/remove-record/handler.d.ts +6 -0
- package/esm/commands/aws/route53/remove-record/handler.js +14 -0
- package/esm/commands/aws/route53/remove-record/index.d.ts +2 -0
- package/esm/commands/aws/route53/remove-record/index.js +18 -0
- package/esm/commands/aws/route53/remove-record/schema.d.ts +30 -0
- package/esm/commands/aws/route53/remove-record/schema.js +8 -0
- package/esm/commands/aws/schema.d.ts +13 -0
- package/esm/commands/aws/schema.js +10 -0
- package/esm/commands/aws/ses/send-email/handler.d.ts +5 -0
- package/esm/commands/aws/ses/send-email/handler.js +12 -0
- package/esm/commands/aws/ses/send-email/index.d.ts +3 -0
- package/esm/commands/aws/ses/send-email/index.js +23 -0
- package/esm/commands/aws/ses/send-email/schema.d.ts +39 -0
- package/esm/commands/aws/ses/send-email/schema.js +7 -0
- package/esm/commands/aws/ses/send-email/utils.d.ts +47 -0
- package/esm/commands/aws/ses/send-email/utils.js +11 -0
- package/esm/commands/aws/ses/smtp-password.d.ts +21 -0
- package/esm/commands/aws/ses/smtp-password.js +10 -0
- package/esm/commands/aws/utils/exec-aws.d.ts +79 -0
- package/esm/commands/aws/utils/exec-aws.js +16 -0
- package/esm/commands/aws/utils/resolve-policy-path.d.ts +8 -0
- package/esm/commands/aws/utils/resolve-policy-path.js +6 -0
- package/esm/commands/aws/utils/resolve-profile.d.ts +28 -0
- package/esm/commands/aws/utils/resolve-profile.js +11 -0
- package/esm/commands/aws/utils/tty.d.ts +24 -0
- package/esm/commands/aws/utils/tty.js +10 -0
- package/esm/commands/db/create-readonly-user/handler.d.ts +5 -0
- package/esm/commands/db/create-readonly-user/handler.js +11 -0
- package/esm/commands/db/create-readonly-user/index.d.ts +3 -0
- package/esm/commands/db/create-readonly-user/index.js +40 -0
- package/esm/commands/db/create-readonly-user/mysql.d.ts +33 -0
- package/esm/commands/db/create-readonly-user/mysql.js +9 -0
- package/esm/commands/db/create-readonly-user/postgres.d.ts +31 -0
- package/esm/commands/db/create-readonly-user/postgres.js +9 -0
- package/esm/commands/db/create-readonly-user/schema.d.ts +55 -0
- package/esm/commands/db/create-readonly-user/schema.js +12 -0
- package/esm/commands/db/create-readonly-user/utils.d.ts +112 -0
- package/esm/commands/db/create-readonly-user/utils.js +22 -0
- package/esm/commands/db/index.d.ts +6 -0
- package/esm/commands/db/index.js +44 -0
- package/esm/commands/doppler/handler.js +5 -3
- package/esm/commands/doppler/index.d.ts +1 -0
- package/esm/commands/doppler/index.js +32 -5
- package/esm/commands/doppler/schema.d.ts +233 -17
- package/esm/commands/doppler/schema.js +11 -3
- package/esm/commands/doppler/set-secret.d.ts +113 -0
- package/esm/commands/doppler/set-secret.js +19 -0
- package/esm/commands/doppler/utils.d.ts +32 -8
- package/esm/commands/doppler/utils.js +5 -1
- package/esm/commands/icons/schema.d.ts +1 -1
- package/esm/commands/index.js +86 -7
- package/package.json +13 -3
- package/vitest.config.ts +11 -0
- package/cjs/__chunks/4GFJUCSP.cjs +0 -52
- package/esm/__chunks/X3R5PSWH.js +0 -52
- /package/cjs/__chunks/{WNJ3ZYLI.cjs → 3BY5Y4W7.cjs} +0 -0
- /package/esm/__chunks/{46HGXFME.js → 5ZBVGSOK.js} +0 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_ROAMING_NAME,
|
|
3
|
+
SSH_PORT
|
|
4
|
+
} from "./J34UVKLA.js";
|
|
5
|
+
import {
|
|
6
|
+
runAws
|
|
7
|
+
} from "./FNXUONAV.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/aws/ec2/allow-ip/utils.js
|
|
10
|
+
async function getCurrentPublicIp() {
|
|
11
|
+
const urls = ["https://checkip.amazonaws.com", "https://api.ipify.org"];
|
|
12
|
+
for (const url of urls) {
|
|
13
|
+
try {
|
|
14
|
+
const controller = new AbortController();
|
|
15
|
+
const timeout = setTimeout(() => controller.abort(), 8e3);
|
|
16
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
17
|
+
clearTimeout(timeout);
|
|
18
|
+
if (!response.ok) continue;
|
|
19
|
+
const ip = (await response.text()).trim();
|
|
20
|
+
if (ip && ip.includes(".")) {
|
|
21
|
+
return ip;
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
throw new Error("Could not determine your current public IP address");
|
|
28
|
+
}
|
|
29
|
+
function listEnabledRegions(params) {
|
|
30
|
+
const { profile, region, verbose } = params;
|
|
31
|
+
const data = runAws({
|
|
32
|
+
profile,
|
|
33
|
+
region,
|
|
34
|
+
args: [
|
|
35
|
+
"ec2",
|
|
36
|
+
"describe-regions",
|
|
37
|
+
"--query",
|
|
38
|
+
"Regions[?OptInStatus!=`not-opted-in`].RegionName"
|
|
39
|
+
],
|
|
40
|
+
verbose
|
|
41
|
+
});
|
|
42
|
+
const regions = Array.isArray(data) ? data : [];
|
|
43
|
+
return regions.map((value) => String(value)).sort();
|
|
44
|
+
}
|
|
45
|
+
function listInstances(params) {
|
|
46
|
+
const { profile, region, verbose } = params;
|
|
47
|
+
const data = runAws({
|
|
48
|
+
profile,
|
|
49
|
+
region,
|
|
50
|
+
args: ["ec2", "describe-instances"],
|
|
51
|
+
verbose
|
|
52
|
+
});
|
|
53
|
+
const instances = [];
|
|
54
|
+
for (const reservation of data.Reservations ?? []) {
|
|
55
|
+
for (const raw of reservation.Instances ?? []) {
|
|
56
|
+
const state = raw.State?.Name ?? "unknown";
|
|
57
|
+
if (state === "terminated" || state === "shutting-down") {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
let name = "";
|
|
61
|
+
for (const tag of raw.Tags ?? []) {
|
|
62
|
+
if (tag.Key === "Name") {
|
|
63
|
+
name = tag.Value ?? "";
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const securityGroupIds = (raw.SecurityGroups ?? []).map((group) => group.GroupId).filter((id) => Boolean(id));
|
|
68
|
+
instances.push({
|
|
69
|
+
instanceId: raw.InstanceId,
|
|
70
|
+
name,
|
|
71
|
+
state,
|
|
72
|
+
instanceType: raw.InstanceType ?? "unknown",
|
|
73
|
+
publicIp: raw.PublicIpAddress ?? null,
|
|
74
|
+
securityGroupIds
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
instances.sort(
|
|
79
|
+
(a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()) || a.instanceId.localeCompare(b.instanceId)
|
|
80
|
+
);
|
|
81
|
+
return instances;
|
|
82
|
+
}
|
|
83
|
+
function describeSecurityGroups(params) {
|
|
84
|
+
const { profile, region, groupIds, verbose } = params;
|
|
85
|
+
if (groupIds.length === 0) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
const data = runAws({
|
|
89
|
+
profile,
|
|
90
|
+
region,
|
|
91
|
+
args: ["ec2", "describe-security-groups", "--group-ids", ...groupIds],
|
|
92
|
+
verbose
|
|
93
|
+
});
|
|
94
|
+
const groups = (data.SecurityGroups ?? []).map((raw) => ({
|
|
95
|
+
groupId: raw.GroupId,
|
|
96
|
+
groupName: raw.GroupName ?? "",
|
|
97
|
+
description: raw.Description ?? ""
|
|
98
|
+
}));
|
|
99
|
+
groups.sort((a, b) => a.groupName.localeCompare(b.groupName));
|
|
100
|
+
return groups;
|
|
101
|
+
}
|
|
102
|
+
function getSecurityGroupDetails(params) {
|
|
103
|
+
const { profile, region, groupId, verbose } = params;
|
|
104
|
+
const data = runAws({
|
|
105
|
+
profile,
|
|
106
|
+
region,
|
|
107
|
+
args: ["ec2", "describe-security-groups", "--group-ids", groupId],
|
|
108
|
+
verbose
|
|
109
|
+
});
|
|
110
|
+
const securityGroups = data.SecurityGroups ?? [];
|
|
111
|
+
if (securityGroups.length === 0) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return securityGroups[0];
|
|
115
|
+
}
|
|
116
|
+
function isSingleHostCidr(cidrIp) {
|
|
117
|
+
return cidrIp.endsWith("/32") && cidrIp !== "0.0.0.0/0";
|
|
118
|
+
}
|
|
119
|
+
function portAllowsSsh(permission) {
|
|
120
|
+
const protocol = permission.IpProtocol;
|
|
121
|
+
if (protocol !== "tcp" && protocol !== "6") {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
const fromPort = permission.FromPort;
|
|
125
|
+
const toPort = permission.ToPort;
|
|
126
|
+
if (fromPort === void 0 && toPort === void 0) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
if (fromPort === void 0 || toPort === void 0) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
return fromPort <= SSH_PORT && SSH_PORT <= toPort;
|
|
133
|
+
}
|
|
134
|
+
function listSshIngressRules(securityGroup) {
|
|
135
|
+
const rules = [];
|
|
136
|
+
for (const permission of securityGroup.IpPermissions ?? []) {
|
|
137
|
+
if (!portAllowsSsh(permission)) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const fromPort = permission.FromPort ?? SSH_PORT;
|
|
141
|
+
const toPort = permission.ToPort ?? SSH_PORT;
|
|
142
|
+
const ipProtocol = permission.IpProtocol ?? "tcp";
|
|
143
|
+
for (const ipRange of permission.IpRanges ?? []) {
|
|
144
|
+
const cidrIp = ipRange.CidrIp;
|
|
145
|
+
if (!cidrIp || !isSingleHostCidr(cidrIp)) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
rules.push({
|
|
149
|
+
cidrIp,
|
|
150
|
+
description: ipRange.Description ?? "",
|
|
151
|
+
fromPort,
|
|
152
|
+
toPort,
|
|
153
|
+
ipProtocol
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return rules;
|
|
158
|
+
}
|
|
159
|
+
function extractRoamingFirstName(params) {
|
|
160
|
+
const { profile, identity } = params;
|
|
161
|
+
const arn = identity.Arn ?? "";
|
|
162
|
+
const username = arn.includes("/") ? arn.split("/").pop() ?? "" : "";
|
|
163
|
+
for (const candidate of [username, profile ?? ""]) {
|
|
164
|
+
if (!candidate) continue;
|
|
165
|
+
const match = /^md-([^-]+)-/.exec(candidate);
|
|
166
|
+
if (match && match[1]) {
|
|
167
|
+
return match[1].charAt(0).toUpperCase() + match[1].slice(1).toLowerCase();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return DEFAULT_ROAMING_NAME;
|
|
171
|
+
}
|
|
172
|
+
function roamingRuleDescription(firstName) {
|
|
173
|
+
return `${firstName} Roaming`;
|
|
174
|
+
}
|
|
175
|
+
function resolveRoamingRule(sshRules, ruleDescription) {
|
|
176
|
+
const target = ruleDescription.toLowerCase();
|
|
177
|
+
for (const rule of sshRules) {
|
|
178
|
+
if (rule.description.trim().toLowerCase() === target) {
|
|
179
|
+
return rule;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
function ruleAlreadyAllowsIp(sshRules, newCidr) {
|
|
185
|
+
for (const rule of sshRules) {
|
|
186
|
+
if (rule.cidrIp === newCidr) {
|
|
187
|
+
return rule;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
function buildIpPermissions(params) {
|
|
193
|
+
const {
|
|
194
|
+
cidrIp,
|
|
195
|
+
description,
|
|
196
|
+
fromPort = SSH_PORT,
|
|
197
|
+
toPort = SSH_PORT,
|
|
198
|
+
ipProtocol = "tcp"
|
|
199
|
+
} = params;
|
|
200
|
+
return JSON.stringify([
|
|
201
|
+
{
|
|
202
|
+
IpProtocol: ipProtocol,
|
|
203
|
+
FromPort: fromPort,
|
|
204
|
+
ToPort: toPort,
|
|
205
|
+
IpRanges: [{ CidrIp: cidrIp, Description: description }]
|
|
206
|
+
}
|
|
207
|
+
]);
|
|
208
|
+
}
|
|
209
|
+
function authorizeRule(params) {
|
|
210
|
+
const { profile, region, groupId, verbose, ...rule } = params;
|
|
211
|
+
runAws({
|
|
212
|
+
profile,
|
|
213
|
+
region,
|
|
214
|
+
args: [
|
|
215
|
+
"ec2",
|
|
216
|
+
"authorize-security-group-ingress",
|
|
217
|
+
"--group-id",
|
|
218
|
+
groupId,
|
|
219
|
+
"--ip-permissions",
|
|
220
|
+
buildIpPermissions(rule)
|
|
221
|
+
],
|
|
222
|
+
expectJson: false,
|
|
223
|
+
verbose
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function revokeRule(params) {
|
|
227
|
+
const { profile, region, groupId, rule, verbose } = params;
|
|
228
|
+
runAws({
|
|
229
|
+
profile,
|
|
230
|
+
region,
|
|
231
|
+
args: [
|
|
232
|
+
"ec2",
|
|
233
|
+
"revoke-security-group-ingress",
|
|
234
|
+
"--group-id",
|
|
235
|
+
groupId,
|
|
236
|
+
"--ip-permissions",
|
|
237
|
+
buildIpPermissions({
|
|
238
|
+
cidrIp: rule.cidrIp,
|
|
239
|
+
description: rule.description,
|
|
240
|
+
fromPort: rule.fromPort,
|
|
241
|
+
toPort: rule.toPort,
|
|
242
|
+
ipProtocol: rule.ipProtocol
|
|
243
|
+
})
|
|
244
|
+
],
|
|
245
|
+
expectJson: false,
|
|
246
|
+
verbose
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
function instanceLabel(instance) {
|
|
250
|
+
const publicIp = instance.publicIp || "no public IP";
|
|
251
|
+
const name = instance.name || "(no name)";
|
|
252
|
+
return `${instance.instanceId} ${name} ${instance.state} ${instance.instanceType} ${publicIp}`;
|
|
253
|
+
}
|
|
254
|
+
function securityGroupLabel(group) {
|
|
255
|
+
return `${group.groupId} ${group.groupName} ${group.description}`;
|
|
256
|
+
}
|
|
257
|
+
function sshRuleLabel(rule) {
|
|
258
|
+
const description = rule.description || "(no description)";
|
|
259
|
+
return `${rule.cidrIp} ${description}`;
|
|
260
|
+
}
|
|
261
|
+
function printSshRules(sshRules, log = console.log) {
|
|
262
|
+
if (sshRules.length === 0) {
|
|
263
|
+
log(" (no single-host SSH rules on port 22)");
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
for (const rule of sshRules) {
|
|
267
|
+
log(` - ${sshRuleLabel(rule)}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export {
|
|
272
|
+
getCurrentPublicIp,
|
|
273
|
+
listEnabledRegions,
|
|
274
|
+
listInstances,
|
|
275
|
+
describeSecurityGroups,
|
|
276
|
+
getSecurityGroupDetails,
|
|
277
|
+
listSshIngressRules,
|
|
278
|
+
extractRoamingFirstName,
|
|
279
|
+
roamingRuleDescription,
|
|
280
|
+
resolveRoamingRule,
|
|
281
|
+
ruleAlreadyAllowsIp,
|
|
282
|
+
authorizeRule,
|
|
283
|
+
revokeRule,
|
|
284
|
+
instanceLabel,
|
|
285
|
+
securityGroupLabel,
|
|
286
|
+
sshRuleLabel,
|
|
287
|
+
printSshRules
|
|
288
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
calculateSmtpPassword,
|
|
3
|
+
smtpEndpoint
|
|
4
|
+
} from "./B2DVQ2UL.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/aws/ses/send-email/utils.js
|
|
7
|
+
import { randomBytes } from "crypto";
|
|
8
|
+
function defaultBody() {
|
|
9
|
+
const token = randomBytes(16).toString("hex");
|
|
10
|
+
const sentAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
11
|
+
return `MTN CLI test email \u2014 random token: ${token} \u2014 sent at ${sentAt}`;
|
|
12
|
+
}
|
|
13
|
+
async function sendViaApi(params) {
|
|
14
|
+
const { to, from, subject, body, region, profile } = params;
|
|
15
|
+
const { SESClient, SendEmailCommand } = await import("@aws-sdk/client-ses");
|
|
16
|
+
const { fromNodeProviderChain } = await import("@aws-sdk/credential-providers");
|
|
17
|
+
const client = new SESClient({
|
|
18
|
+
region,
|
|
19
|
+
credentials: fromNodeProviderChain(profile ? { profile } : {})
|
|
20
|
+
});
|
|
21
|
+
const command = new SendEmailCommand({
|
|
22
|
+
Source: from,
|
|
23
|
+
Destination: { ToAddresses: [to] },
|
|
24
|
+
Message: {
|
|
25
|
+
Subject: { Data: subject },
|
|
26
|
+
Body: { Text: { Data: body } }
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const result = await client.send(command);
|
|
30
|
+
return result.MessageId;
|
|
31
|
+
}
|
|
32
|
+
async function sendViaSmtp(params) {
|
|
33
|
+
const { to, from, subject, body, region, accessKeyId } = params;
|
|
34
|
+
const user = process.env.SES_SMTP_USER ?? accessKeyId;
|
|
35
|
+
let pass = process.env.SES_SMTP_PASSWORD;
|
|
36
|
+
if (!pass) {
|
|
37
|
+
const secret = process.env.AWS_SECRET_ACCESS_KEY;
|
|
38
|
+
if (secret) {
|
|
39
|
+
pass = calculateSmtpPassword({ secretAccessKey: secret, region });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!user || !pass) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
"SMTP transport requires SES_SMTP_USER and SES_SMTP_PASSWORD, or AWS_SECRET_ACCESS_KEY (plus --access-key-id) to derive the SMTP password."
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const nodemailerModule = await import("nodemailer");
|
|
48
|
+
const nodemailer = nodemailerModule.default ?? nodemailerModule;
|
|
49
|
+
const transporter = nodemailer.createTransport({
|
|
50
|
+
host: smtpEndpoint(region),
|
|
51
|
+
port: 587,
|
|
52
|
+
secure: false,
|
|
53
|
+
auth: { user, pass }
|
|
54
|
+
});
|
|
55
|
+
const info = await transporter.sendMail({ from, to, subject, text: body });
|
|
56
|
+
return info.messageId;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
defaultBody,
|
|
61
|
+
sendViaApi,
|
|
62
|
+
sendViaSmtp
|
|
63
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
breakGlassOptionsSchema
|
|
3
|
+
} from "./EMSH4P76.js";
|
|
4
|
+
import {
|
|
5
|
+
ADMIN_GROUP_NAME,
|
|
6
|
+
resolveProfileScan
|
|
7
|
+
} from "./NF3M2L6C.js";
|
|
8
|
+
import {
|
|
9
|
+
requireCommands
|
|
10
|
+
} from "./FNXUONAV.js";
|
|
11
|
+
import {
|
|
12
|
+
resolveProfile
|
|
13
|
+
} from "./5GIUAFXL.js";
|
|
14
|
+
import {
|
|
15
|
+
promptYesNo
|
|
16
|
+
} from "./ZHKVJO2U.js";
|
|
17
|
+
|
|
18
|
+
// src/commands/aws/iam/break-glass/handler.js
|
|
19
|
+
import chalk from "chalk";
|
|
20
|
+
import { ZodError } from "zod";
|
|
21
|
+
function userNameFromArn(arn) {
|
|
22
|
+
const marker = ":user/";
|
|
23
|
+
const index = arn.indexOf(marker);
|
|
24
|
+
if (index === -1) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const name = arn.slice(index + marker.length).split("/").pop();
|
|
28
|
+
return name && name.length > 0 ? name : null;
|
|
29
|
+
}
|
|
30
|
+
async function breakGlassCommand(options) {
|
|
31
|
+
try {
|
|
32
|
+
const { profile, user, yes, dryRun, verbose } = breakGlassOptionsSchema.parse(options);
|
|
33
|
+
requireCommands(["aws"]);
|
|
34
|
+
const targetProfile = await resolveProfile({ profile });
|
|
35
|
+
if (!targetProfile) {
|
|
36
|
+
console.error(
|
|
37
|
+
chalk.red(
|
|
38
|
+
"No profile specified. Pass --profile <name> or set AWS_PROFILE."
|
|
39
|
+
)
|
|
40
|
+
);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
const scan = resolveProfileScan({ profile: targetProfile, verbose });
|
|
44
|
+
if (!scan) {
|
|
45
|
+
console.error(
|
|
46
|
+
chalk.red(
|
|
47
|
+
`
|
|
48
|
+
\u274C Could not read ${ADMIN_GROUP_NAME} for profile "${targetProfile}".`
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
console.error(
|
|
52
|
+
chalk.yellow(
|
|
53
|
+
" Check your credentials, and run `mtn aws iam setup-acl` first if the group does not exist yet.\n"
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
let targets = user;
|
|
59
|
+
if (targets.length === 0) {
|
|
60
|
+
const derived = userNameFromArn(scan.arn);
|
|
61
|
+
if (!derived) {
|
|
62
|
+
console.error(
|
|
63
|
+
chalk.red(
|
|
64
|
+
`
|
|
65
|
+
\u274C Could not determine your IAM user from the caller identity:
|
|
66
|
+
${scan.arn}`
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
console.error(
|
|
70
|
+
chalk.yellow(" Pass --user <name> to choose who to grant.\n")
|
|
71
|
+
);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
targets = [derived];
|
|
75
|
+
}
|
|
76
|
+
const alreadyMembers = new Set(scan.users);
|
|
77
|
+
const toGrant = targets.filter((name) => !alreadyMembers.has(name));
|
|
78
|
+
const existing = targets.filter((name) => alreadyMembers.has(name));
|
|
79
|
+
console.log(
|
|
80
|
+
chalk.blue(
|
|
81
|
+
`
|
|
82
|
+
==> Break-glass admin (${ADMIN_GROUP_NAME}) \u2014 profile ${targetProfile} (${scan.accountId})
|
|
83
|
+
`
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
for (const name of existing) {
|
|
87
|
+
console.log(chalk.dim(`-- ${name} already has break-glass access`));
|
|
88
|
+
}
|
|
89
|
+
if (toGrant.length === 0) {
|
|
90
|
+
console.log(
|
|
91
|
+
chalk.green(
|
|
92
|
+
"\nNothing to do \u2014 all target user(s) already have break-glass access.\n"
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
console.log(
|
|
98
|
+
chalk.red.bold(
|
|
99
|
+
`\u26A0 This grants AdministratorAccess to ${toGrant.length} user(s): ${toGrant.join(", ")}`
|
|
100
|
+
)
|
|
101
|
+
);
|
|
102
|
+
if (dryRun) {
|
|
103
|
+
for (const name of toGrant) {
|
|
104
|
+
console.log(
|
|
105
|
+
chalk.yellow(` [dry-run] would add ${name} to ${ADMIN_GROUP_NAME}`)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
console.log(
|
|
109
|
+
chalk.yellow("\n[dry-run] Re-run without --dry-run to apply.\n")
|
|
110
|
+
);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
let confirmed = yes;
|
|
114
|
+
if (!confirmed) {
|
|
115
|
+
confirmed = await promptYesNo({
|
|
116
|
+
message: ` Grant break-glass admin to ${toGrant.length} user(s) in ${targetProfile}?`,
|
|
117
|
+
defaultYes: false
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (!confirmed) {
|
|
121
|
+
console.log(chalk.dim(" aborted (not confirmed)\n"));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
let granted = 0;
|
|
125
|
+
for (const name of toGrant) {
|
|
126
|
+
try {
|
|
127
|
+
scan.run(
|
|
128
|
+
[
|
|
129
|
+
"iam",
|
|
130
|
+
"add-user-to-group",
|
|
131
|
+
"--group-name",
|
|
132
|
+
ADMIN_GROUP_NAME,
|
|
133
|
+
"--user-name",
|
|
134
|
+
name
|
|
135
|
+
],
|
|
136
|
+
{ expectJson: false }
|
|
137
|
+
);
|
|
138
|
+
console.log(chalk.green(` granted ${name}`));
|
|
139
|
+
granted += 1;
|
|
140
|
+
} catch (grantError) {
|
|
141
|
+
const reason = grantError instanceof Error ? grantError.message.split("\n")[0] ?? "" : String(grantError);
|
|
142
|
+
console.log(chalk.red(` failed to grant ${name}: ${reason}`));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
console.log(chalk.blue("\n==> Summary"));
|
|
146
|
+
console.log(` Profile: ${targetProfile} (${scan.accountId})`);
|
|
147
|
+
console.log(` Users granted: ${granted}`);
|
|
148
|
+
console.log(` Already had it: ${existing.length}`);
|
|
149
|
+
console.log(
|
|
150
|
+
chalk.yellow(
|
|
151
|
+
"\n\u{1F4A1} Revoke with `mtn aws iam remove-admin` when you are done."
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
console.log(
|
|
155
|
+
chalk.dim(
|
|
156
|
+
" You may need a fresh session (e.g. clear the aws-vault cache) before the new permissions apply.\n"
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
} catch (error) {
|
|
160
|
+
if (error instanceof ZodError) {
|
|
161
|
+
console.error(chalk.red("\n\u274C Invalid command options:"));
|
|
162
|
+
error.errors.forEach((err) => {
|
|
163
|
+
console.error(chalk.red(` ${err.path.join(".")}: ${err.message}`));
|
|
164
|
+
});
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
const verbose = (
|
|
168
|
+
/** @type {any} */
|
|
169
|
+
options?.verbose || false
|
|
170
|
+
);
|
|
171
|
+
console.error(chalk.red("\n\u274C break-glass failed:"));
|
|
172
|
+
if (error instanceof Error) {
|
|
173
|
+
console.error(chalk.red(` ${error.message}`));
|
|
174
|
+
if (verbose && error.stack) {
|
|
175
|
+
console.error(chalk.gray("\nStack trace:"));
|
|
176
|
+
console.error(chalk.gray(error.stack));
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
console.error(chalk.red(` ${String(error)}`));
|
|
180
|
+
}
|
|
181
|
+
console.error(
|
|
182
|
+
chalk.yellow(
|
|
183
|
+
"\n\u{1F4A1} Requires the AWS CLI and iam:AddUserToGroup on the target profile.\n"
|
|
184
|
+
)
|
|
185
|
+
);
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export {
|
|
191
|
+
breakGlassCommand
|
|
192
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|