@mtndev/cli 2.0.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.
Files changed (264) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/cjs/__chunks/VH7oDXx4.cjs +28 -0
  3. package/cjs/commands/aws/ec2/allow-ip/handler.cjs +261 -12
  4. package/cjs/commands/aws/ec2/allow-ip/index.cjs +25 -55
  5. package/cjs/commands/aws/ec2/allow-ip/schema.cjs +33 -13
  6. package/cjs/commands/aws/ec2/allow-ip/utils.cjs +379 -39
  7. package/cjs/commands/aws/iam/admin-group.cjs +111 -15
  8. package/cjs/commands/aws/iam/break-glass/handler.cjs +127 -12
  9. package/cjs/commands/aws/iam/break-glass/index.cjs +7 -19
  10. package/cjs/commands/aws/iam/break-glass/schema.cjs +21 -12
  11. package/cjs/commands/aws/iam/check-admin/handler.cjs +89 -10
  12. package/cjs/commands/aws/iam/check-admin/index.cjs +7 -17
  13. package/cjs/commands/aws/iam/check-admin/schema.cjs +19 -12
  14. package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
  15. package/cjs/commands/aws/iam/policies/sts-federation.json +11 -0
  16. package/cjs/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
  17. package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
  18. package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
  19. package/cjs/commands/aws/iam/policies/user-admins-write-list.json +117 -0
  20. package/cjs/commands/aws/iam/remove-admin/handler.cjs +120 -11
  21. package/cjs/commands/aws/iam/remove-admin/index.cjs +7 -18
  22. package/cjs/commands/aws/iam/remove-admin/schema.cjs +22 -12
  23. package/cjs/commands/aws/iam/setup-acl/handler.cjs +227 -14
  24. package/cjs/commands/aws/iam/setup-acl/index.cjs +13 -33
  25. package/cjs/commands/aws/iam/setup-acl/schema.cjs +19 -7
  26. package/cjs/commands/aws/iam/setup-acl/utils.cjs +305 -20
  27. package/cjs/commands/aws/iam/users/handler.cjs +59 -12
  28. package/cjs/commands/aws/iam/users/index.cjs +18 -41
  29. package/cjs/commands/aws/iam/users/schema.cjs +17 -7
  30. package/cjs/commands/aws/iam/users/utils.cjs +454 -30
  31. package/cjs/commands/aws/index.cjs +223 -229
  32. package/cjs/commands/aws/route53/add-record/handler.cjs +264 -18
  33. package/cjs/commands/aws/route53/add-record/index.cjs +26 -57
  34. package/cjs/commands/aws/route53/add-record/schema.cjs +43 -11
  35. package/cjs/commands/aws/route53/add-record/utils.cjs +404 -37
  36. package/cjs/commands/aws/route53/remove-record/handler.cjs +114 -14
  37. package/cjs/commands/aws/route53/remove-record/index.cjs +5 -18
  38. package/cjs/commands/aws/route53/remove-record/schema.cjs +22 -8
  39. package/cjs/commands/aws/schema.cjs +19 -10
  40. package/cjs/commands/aws/ses/send-email/handler.cjs +73 -12
  41. package/cjs/commands/aws/ses/send-email/index.cjs +9 -23
  42. package/cjs/commands/aws/ses/send-email/schema.cjs +24 -7
  43. package/cjs/commands/aws/ses/send-email/utils.cjs +87 -11
  44. package/cjs/commands/aws/ses/smtp-password.cjs +72 -10
  45. package/cjs/commands/aws/utils/exec-aws.cjs +145 -16
  46. package/cjs/commands/aws/utils/resolve-policy-path.cjs +15 -6
  47. package/cjs/commands/aws/utils/resolve-profile.cjs +93 -11
  48. package/cjs/commands/aws/utils/tty.cjs +54 -10
  49. package/cjs/commands/db/create-readonly-user/handler.cjs +254 -11
  50. package/cjs/commands/db/create-readonly-user/index.cjs +18 -40
  51. package/cjs/commands/db/create-readonly-user/mysql.cjs +102 -9
  52. package/cjs/commands/db/create-readonly-user/postgres.cjs +209 -9
  53. package/cjs/commands/db/create-readonly-user/schema.cjs +39 -12
  54. package/cjs/commands/db/create-readonly-user/utils.cjs +160 -22
  55. package/cjs/commands/db/index.cjs +46 -44
  56. package/cjs/commands/doppler/handler.cjs +95 -11
  57. package/cjs/commands/doppler/index.cjs +33 -68
  58. package/cjs/commands/doppler/schema.cjs +130 -14
  59. package/cjs/commands/doppler/set-secret.cjs +378 -19
  60. package/cjs/commands/doppler/utils/exec.cjs +106 -12
  61. package/cjs/commands/doppler/utils.cjs +412 -34
  62. package/cjs/commands/icons/handler.cjs +82 -8
  63. package/cjs/commands/icons/index.cjs +15 -31
  64. package/cjs/commands/icons/schema.cjs +101 -13
  65. package/cjs/commands/icons/utils.cjs +131 -13
  66. package/cjs/commands/index.cjs +54 -161
  67. package/cjs/commands/schema.cjs +25 -8
  68. package/cjs/index.cjs +3 -4
  69. package/esm/commands/aws/ec2/allow-ip/handler.js +258 -12
  70. package/esm/commands/aws/ec2/allow-ip/index.js +4 -55
  71. package/esm/commands/aws/ec2/allow-ip/schema.js +29 -13
  72. package/esm/commands/aws/ec2/allow-ip/utils.js +363 -39
  73. package/esm/commands/aws/iam/admin-group.js +104 -15
  74. package/esm/commands/aws/iam/break-glass/handler.js +124 -12
  75. package/esm/commands/aws/iam/break-glass/index.js +4 -19
  76. package/esm/commands/aws/iam/break-glass/schema.js +19 -12
  77. package/esm/commands/aws/iam/check-admin/handler.js +86 -10
  78. package/esm/commands/aws/iam/check-admin/index.js +4 -17
  79. package/esm/commands/aws/iam/check-admin/schema.js +17 -12
  80. package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
  81. package/esm/commands/aws/iam/policies/sts-federation.json +11 -0
  82. package/esm/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
  83. package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
  84. package/esm/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
  85. package/esm/commands/aws/iam/policies/user-admins-write-list.json +117 -0
  86. package/esm/commands/aws/iam/remove-admin/handler.js +117 -11
  87. package/esm/commands/aws/iam/remove-admin/index.js +4 -18
  88. package/esm/commands/aws/iam/remove-admin/schema.js +20 -12
  89. package/esm/commands/aws/iam/setup-acl/handler.js +224 -14
  90. package/esm/commands/aws/iam/setup-acl/index.js +4 -33
  91. package/esm/commands/aws/iam/setup-acl/schema.js +18 -7
  92. package/esm/commands/aws/iam/setup-acl/utils.js +298 -20
  93. package/esm/commands/aws/iam/users/handler.js +56 -12
  94. package/esm/commands/aws/iam/users/index.js +4 -41
  95. package/esm/commands/aws/iam/users/schema.js +16 -7
  96. package/esm/commands/aws/iam/users/utils.js +440 -30
  97. package/esm/commands/aws/index.js +142 -229
  98. package/esm/commands/aws/route53/add-record/handler.js +258 -18
  99. package/esm/commands/aws/route53/add-record/index.js +4 -57
  100. package/esm/commands/aws/route53/add-record/schema.js +40 -11
  101. package/esm/commands/aws/route53/add-record/utils.js +389 -37
  102. package/esm/commands/aws/route53/remove-record/handler.js +111 -14
  103. package/esm/commands/aws/route53/remove-record/index.js +3 -18
  104. package/esm/commands/aws/route53/remove-record/schema.js +21 -8
  105. package/esm/commands/aws/schema.js +16 -10
  106. package/esm/commands/aws/ses/send-email/handler.js +70 -12
  107. package/esm/commands/aws/ses/send-email/index.js +4 -23
  108. package/esm/commands/aws/ses/send-email/schema.js +23 -7
  109. package/esm/commands/aws/ses/send-email/utils.js +84 -11
  110. package/esm/commands/aws/ses/smtp-password.js +69 -10
  111. package/esm/commands/aws/utils/exec-aws.js +136 -15
  112. package/esm/commands/aws/utils/resolve-policy-path.js +14 -6
  113. package/esm/commands/aws/utils/resolve-profile.js +88 -11
  114. package/esm/commands/aws/utils/tty.js +51 -10
  115. package/esm/commands/db/create-readonly-user/handler.js +251 -11
  116. package/esm/commands/db/create-readonly-user/index.js +4 -40
  117. package/esm/commands/db/create-readonly-user/mysql.js +98 -9
  118. package/esm/commands/db/create-readonly-user/postgres.js +205 -9
  119. package/esm/commands/db/create-readonly-user/schema.js +35 -12
  120. package/esm/commands/db/create-readonly-user/utils.js +151 -22
  121. package/esm/commands/db/index.js +31 -44
  122. package/esm/commands/doppler/handler.js +92 -11
  123. package/esm/commands/doppler/index.js +6 -68
  124. package/esm/commands/doppler/schema.js +125 -15
  125. package/esm/commands/doppler/set-secret.js +370 -19
  126. package/esm/commands/doppler/utils/exec.js +100 -12
  127. package/esm/commands/doppler/utils.js +396 -34
  128. package/esm/commands/icons/handler.js +79 -8
  129. package/esm/commands/icons/index.js +4 -31
  130. package/esm/commands/icons/schema.js +97 -15
  131. package/esm/commands/icons/utils.js +125 -13
  132. package/esm/commands/index.js +47 -155
  133. package/esm/commands/schema.js +22 -7
  134. package/esm/index.js +3 -4
  135. package/package.json +5 -2
  136. package/vitest.config.ts +11 -0
  137. package/cjs/__chunks/2FSYDFUV.cjs +0 -146
  138. package/cjs/__chunks/3A5ZYU5M.cjs +0 -105
  139. package/cjs/__chunks/3BY5Y4W7.cjs +0 -1
  140. package/cjs/__chunks/3NOHGUCF.cjs +0 -9
  141. package/cjs/__chunks/3T2LXW7J.cjs +0 -387
  142. package/cjs/__chunks/4SFWHCB3.cjs +0 -133
  143. package/cjs/__chunks/4XT5JEAS.cjs +0 -1
  144. package/cjs/__chunks/AZEB4H4I.cjs +0 -208
  145. package/cjs/__chunks/B2KFW7T7.cjs +0 -1
  146. package/cjs/__chunks/B5ENMOCD.cjs +0 -288
  147. package/cjs/__chunks/B6XM5KSF.cjs +0 -338
  148. package/cjs/__chunks/BDU2UCE5.cjs +0 -1
  149. package/cjs/__chunks/BLMSMR5E.cjs +0 -46
  150. package/cjs/__chunks/CMUD7LLN.cjs +0 -47
  151. package/cjs/__chunks/DTQ2LB3I.cjs +0 -49
  152. package/cjs/__chunks/FM5MVRQF.cjs +0 -23
  153. package/cjs/__chunks/FRHST54J.cjs +0 -135
  154. package/cjs/__chunks/FU4VP2LN.cjs +0 -1
  155. package/cjs/__chunks/G5K4PVIL.cjs +0 -26
  156. package/cjs/__chunks/GU3R54MK.cjs +0 -127
  157. package/cjs/__chunks/GUL36IFZ.cjs +0 -61
  158. package/cjs/__chunks/GZMTNK5N.cjs +0 -1
  159. package/cjs/__chunks/H74JSDBU.cjs +0 -30
  160. package/cjs/__chunks/INFOPAHN.cjs +0 -117
  161. package/cjs/__chunks/J36P6UNE.cjs +0 -75
  162. package/cjs/__chunks/JB7T7PKQ.cjs +0 -538
  163. package/cjs/__chunks/JSL2JDMW.cjs +0 -1
  164. package/cjs/__chunks/K4QNHRTP.cjs +0 -163
  165. package/cjs/__chunks/KU76LC42.cjs +0 -192
  166. package/cjs/__chunks/LFDSHANP.cjs +0 -34
  167. package/cjs/__chunks/LHE24ECK.cjs +0 -192
  168. package/cjs/__chunks/LIKQ3SI4.cjs +0 -1
  169. package/cjs/__chunks/LXDF5QVZ.cjs +0 -313
  170. package/cjs/__chunks/LXOOJR2R.cjs +0 -74
  171. package/cjs/__chunks/N5MXFOQZ.cjs +0 -167
  172. package/cjs/__chunks/N7D56LPP.cjs +0 -25
  173. package/cjs/__chunks/NFXQNOQH.cjs +0 -393
  174. package/cjs/__chunks/NIMXXHJQ.cjs +0 -92
  175. package/cjs/__chunks/NLKJIUEX.cjs +0 -126
  176. package/cjs/__chunks/NT2XXAI6.cjs +0 -89
  177. package/cjs/__chunks/NWZGFHKH.cjs +0 -121
  178. package/cjs/__chunks/R3GUC7O7.cjs +0 -110
  179. package/cjs/__chunks/RPVAXPJ4.cjs +0 -1
  180. package/cjs/__chunks/S3LVCWPN.cjs +0 -23
  181. package/cjs/__chunks/SBBNW2BF.cjs +0 -249
  182. package/cjs/__chunks/T2A7TN4F.cjs +0 -81
  183. package/cjs/__chunks/TKNNDDIB.cjs +0 -97
  184. package/cjs/__chunks/TNSRDJPR.cjs +0 -1
  185. package/cjs/__chunks/UWHPE2GI.cjs +0 -20
  186. package/cjs/__chunks/W6K7BV74.cjs +0 -1
  187. package/cjs/__chunks/WBOQ6AUN.cjs +0 -320
  188. package/cjs/__chunks/WHGN5PZI.cjs +0 -299
  189. package/cjs/__chunks/WOYF2L6T.cjs +0 -11
  190. package/cjs/__chunks/X26XY2N6.cjs +0 -18
  191. package/cjs/__chunks/XMKOKRXZ.cjs +0 -16
  192. package/cjs/__chunks/XTJPQ3EX.cjs +0 -1
  193. package/cjs/__chunks/YRHFKTW2.cjs +0 -63
  194. package/cjs/__chunks/ZMDIOZPT.cjs +0 -22
  195. package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.cjs +0 -28
  196. package/cjs/commands/aws/iam/policies/sts-federation.cjs +0 -19
  197. package/cjs/commands/aws/iam/policies/user-admins-deny-list.cjs +0 -183
  198. package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.cjs +0 -49
  199. package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.cjs +0 -64
  200. package/cjs/commands/aws/iam/policies/user-admins-write-list.cjs +0 -125
  201. package/esm/__chunks/2FTTEFEK.js +0 -97
  202. package/esm/__chunks/33UYMUQD.js +0 -338
  203. package/esm/__chunks/3BKWTHLJ.js +0 -25
  204. package/esm/__chunks/3HE4BEJX.js +0 -105
  205. package/esm/__chunks/3QLI5BDL.js +0 -387
  206. package/esm/__chunks/5GIUAFXL.js +0 -89
  207. package/esm/__chunks/5ZBVGSOK.js +0 -0
  208. package/esm/__chunks/6G4PXXKF.js +0 -75
  209. package/esm/__chunks/73BJG53F.js +0 -11
  210. package/esm/__chunks/7VF4Q43Q.js +0 -0
  211. package/esm/__chunks/AEDEAYF5.js +0 -0
  212. package/esm/__chunks/AZCP3SFJ.js +0 -0
  213. package/esm/__chunks/B2DVQ2UL.js +0 -61
  214. package/esm/__chunks/CVQVHLW5.js +0 -0
  215. package/esm/__chunks/D62SPZXC.js +0 -0
  216. package/esm/__chunks/DLEJ25GZ.js +0 -121
  217. package/esm/__chunks/DMYFNF54.js +0 -192
  218. package/esm/__chunks/DNFTUMGD.js +0 -23
  219. package/esm/__chunks/DVKD6YSR.js +0 -49
  220. package/esm/__chunks/EMSH4P76.js +0 -20
  221. package/esm/__chunks/FFKFVMIE.js +0 -167
  222. package/esm/__chunks/FL7AILGH.js +0 -133
  223. package/esm/__chunks/FNXUONAV.js +0 -110
  224. package/esm/__chunks/G4NJHFFU.js +0 -320
  225. package/esm/__chunks/HJSXC6HP.js +0 -117
  226. package/esm/__chunks/IEOGAQYI.js +0 -46
  227. package/esm/__chunks/IZFGBYGE.js +0 -34
  228. package/esm/__chunks/J34UVKLA.js +0 -26
  229. package/esm/__chunks/JZPBBBIG.js +0 -74
  230. package/esm/__chunks/KWUJP5MG.js +0 -135
  231. package/esm/__chunks/M35URMT4.js +0 -313
  232. package/esm/__chunks/NF3M2L6C.js +0 -81
  233. package/esm/__chunks/O3CCA76Q.js +0 -22
  234. package/esm/__chunks/PNPPDYKC.js +0 -299
  235. package/esm/__chunks/QFXN4EHM.js +0 -393
  236. package/esm/__chunks/QKDDLIWD.js +0 -146
  237. package/esm/__chunks/QSE66AKY.js +0 -208
  238. package/esm/__chunks/QUF7PS4R.js +0 -18
  239. package/esm/__chunks/S7IJPJ4R.js +0 -126
  240. package/esm/__chunks/SD3E3EPH.js +0 -163
  241. package/esm/__chunks/SJXQJ7RS.js +0 -92
  242. package/esm/__chunks/SNCKIAOR.js +0 -0
  243. package/esm/__chunks/T3TTUHTW.js +0 -30
  244. package/esm/__chunks/TIOVE6HR.js +0 -0
  245. package/esm/__chunks/TXKMEIDQ.js +0 -0
  246. package/esm/__chunks/U7HAE2RF.js +0 -288
  247. package/esm/__chunks/UXWY7BYE.js +0 -63
  248. package/esm/__chunks/VKAKISRG.js +0 -192
  249. package/esm/__chunks/WD2YR6I7.js +0 -0
  250. package/esm/__chunks/WOZFZKFY.js +0 -0
  251. package/esm/__chunks/XI7GZDE2.js +0 -0
  252. package/esm/__chunks/XOUWDB3T.js +0 -249
  253. package/esm/__chunks/XQN2TA4S.js +0 -23
  254. package/esm/__chunks/XXK32TIM.js +0 -16
  255. package/esm/__chunks/YGWTVPZE.js +0 -538
  256. package/esm/__chunks/YRG7PT33.js +0 -127
  257. package/esm/__chunks/ZHKVJO2U.js +0 -47
  258. package/esm/__chunks/ZO55YUSY.js +0 -9
  259. package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.js +0 -28
  260. package/esm/commands/aws/iam/policies/sts-federation.js +0 -19
  261. package/esm/commands/aws/iam/policies/user-admins-deny-list.js +0 -183
  262. package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.js +0 -49
  263. package/esm/commands/aws/iam/policies/user-admins-self-service-iam.js +0 -64
  264. package/esm/commands/aws/iam/policies/user-admins-write-list.js +0 -125
@@ -1,208 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _WHGN5PZIcjs = require('./WHGN5PZI.cjs');
4
-
5
-
6
- var _NLKJIUEXcjs = require('./NLKJIUEX.cjs');
7
-
8
-
9
- var _KU76LC42cjs = require('./KU76LC42.cjs');
10
-
11
-
12
- var _N5MXFOQZcjs = require('./N5MXFOQZ.cjs');
13
-
14
-
15
- var _LXOOJR2Rcjs = require('./LXOOJR2R.cjs');
16
-
17
-
18
- var _LHE24ECKcjs = require('./LHE24ECK.cjs');
19
-
20
-
21
- var _2FSYDFUVcjs = require('./2FSYDFUV.cjs');
22
-
23
-
24
- var _WBOQ6AUNcjs = require('./WBOQ6AUN.cjs');
25
-
26
-
27
- var _TKNNDDIBcjs = require('./TKNNDDIB.cjs');
28
-
29
- // src/commands/aws/index.js
30
- function collect(value, previous) {
31
- return [...previous, value];
32
- }
33
- function registerAwsCommands(program) {
34
- const aws = program.command("aws").summary("AWS operational commands (IAM, EC2, SES, Route53)").description("AWS operational commands for IAM, EC2, SES, and Route53");
35
- const iam = aws.command("iam").summary("IAM ACL group and user management").description("IAM ACL group and user management");
36
- iam.command("setup-acl").summary("Create ACL groups, policies, and (optionally) users").description(
37
- "Idempotently create the ACL groups and managed policies, attach them per group, and optionally create IAM users."
38
- ).option(
39
- "--restrict-regions <yes|no>",
40
- "Attach the region restriction to acl-power-users (skips the prompt)"
41
- ).option(
42
- "--no-create-users",
43
- "Skip IAM user creation after configuring groups"
44
- ).option("-p, --profile <profile>", "AWS profile (defaults to AWS_PROFILE)").option("-r, --region <region>", "AWS region").option("-v, --verbose", "Enable verbose logging").action(async (options) => {
45
- await _LHE24ECKcjs.setupAclCommand.call(void 0, {
46
- restrictRegions: options.restrictRegions,
47
- createUsers: options.createUsers,
48
- profile: options.profile,
49
- region: options.region,
50
- verbose: _nullishCoalesce(options.verbose, () => ( false))
51
- });
52
- });
53
- iam.command("users").summary("Interactively create IAM users and assign ACL groups").description(
54
- "Interactively create md-{identifier}-{account}-{role} IAM users, assign ACL groups, and print CLI setup commands."
55
- ).option(
56
- "--account-name <slug>",
57
- "AWS account slug used in md-{identifier}-{account}-{role}"
58
- ).option("-p, --profile <profile>", "AWS profile (defaults to AWS_PROFILE)").option("-v, --verbose", "Enable verbose logging").action(async (options) => {
59
- await _LXOOJR2Rcjs.usersCommand.call(void 0, {
60
- accountName: options.accountName,
61
- profile: options.profile,
62
- verbose: _nullishCoalesce(options.verbose, () => ( false))
63
- });
64
- });
65
- iam.command("check-admin").summary("Alert if anyone is in acl-admin-do-not-use").description(
66
- "Scan one profile (--profile or AWS_PROFILE) or all aws-vault profiles (--all) for members of the break-glass acl-admin-do-not-use group."
67
- ).option(
68
- "-p, --profile <profile>",
69
- "Operate on this profile (defaults to AWS_PROFILE)"
70
- ).option(
71
- "--all",
72
- "Scan every aws-vault profile (default when no profile is set)"
73
- ).option("-v, --verbose", "Show skipped profiles and detailed errors").action(async (options) => {
74
- await _NLKJIUEXcjs.checkAdminCommand.call(void 0, {
75
- profile: options.profile,
76
- all: _nullishCoalesce(options.all, () => ( false)),
77
- verbose: _nullishCoalesce(options.verbose, () => ( false))
78
- });
79
- });
80
- iam.command("remove-admin").summary("Remove users from the acl-admin-do-not-use group").description(
81
- "Remove break-glass admin access by removing users from acl-admin-do-not-use, for one profile (--profile or AWS_PROFILE) or every aws-vault profile (--all)."
82
- ).option(
83
- "-p, --profile <profile>",
84
- "Operate on this profile (defaults to AWS_PROFILE)"
85
- ).option(
86
- "--all",
87
- "Scan every aws-vault profile (default when no profile is set)"
88
- ).option(
89
- "--user <name>",
90
- "Only remove this user (repeatable); default removes all",
91
- collect,
92
- []
93
- ).option("-y, --yes", "Skip the per-profile confirmation prompt").option("--dry-run", "Preview removals without changing anything").option("-v, --verbose", "Show skipped profiles and detailed errors").action(async (options) => {
94
- await _N5MXFOQZcjs.removeAdminCommand.call(void 0, {
95
- profile: options.profile,
96
- all: _nullishCoalesce(options.all, () => ( false)),
97
- user: _nullishCoalesce(options.user, () => ( [])),
98
- yes: _nullishCoalesce(options.yes, () => ( false)),
99
- dryRun: _nullishCoalesce(options.dryRun, () => ( false)),
100
- verbose: _nullishCoalesce(options.verbose, () => ( false))
101
- });
102
- });
103
- iam.command("break-glass").summary("Grant break-glass admin access (acl-admin-do-not-use)").description(
104
- "Grant break-glass AdministratorAccess by adding a user to acl-admin-do-not-use for one profile. Defaults to your own IAM user."
105
- ).option("-p, --profile <profile>", "AWS profile (defaults to AWS_PROFILE)").option(
106
- "--user <name>",
107
- "Grant to this user (repeatable); default is your own IAM user",
108
- collect,
109
- []
110
- ).option("-y, --yes", "Skip the confirmation prompt").option("--dry-run", "Preview the grant without changing anything").option("-v, --verbose", "Show detailed errors").action(async (options) => {
111
- await _KU76LC42cjs.breakGlassCommand.call(void 0, {
112
- profile: options.profile,
113
- user: _nullishCoalesce(options.user, () => ( [])),
114
- yes: _nullishCoalesce(options.yes, () => ( false)),
115
- dryRun: _nullishCoalesce(options.dryRun, () => ( false)),
116
- verbose: _nullishCoalesce(options.verbose, () => ( false))
117
- });
118
- });
119
- const ec2 = aws.command("ec2").summary("EC2 operational commands").description("EC2 operational commands");
120
- ec2.command("allow-ip").summary("Allow your current public IP for SSH on an EC2 security group").description(
121
- "Update or create a named roaming SSH rule (port 22) for your current public IP on a chosen EC2 instance security group."
122
- ).option("-p, --profile <profile>", "AWS profile (defaults to AWS_PROFILE)").option("-r, --region <region>", "AWS region").option(
123
- "--rule-name <name>",
124
- 'SSH rule description (default: "{FirstName} Roaming")'
125
- ).option("-v, --verbose", "Enable verbose logging").action(async (options) => {
126
- await _WHGN5PZIcjs.allowIpCommand.call(void 0, {
127
- profile: options.profile,
128
- region: options.region,
129
- ruleName: options.ruleName,
130
- verbose: _nullishCoalesce(options.verbose, () => ( false))
131
- });
132
- });
133
- const route53 = aws.command("route53").summary("Route53 DNS commands").description("Route53 DNS commands");
134
- route53.command("add-record").summary("Interactively add or update a DNS record").description(
135
- "Add or update a Route53 resource record set. Prompts for hosted zone, type, name, and value when not passed as flags. Shows whether the change creates, overwrites, or appends to an existing record."
136
- ).option("-p, --profile <profile>", "AWS profile (defaults to AWS_PROFILE)").option(
137
- "-z, --zone <name-or-id>",
138
- "Hosted zone name or ID (e.g. mountaindev.com)"
139
- ).option(
140
- "-t, --type <type>",
141
- "Record type (A, AAAA, CNAME, TXT, MX, NS, SRV, CAA)"
142
- ).option(
143
- "-n, --name <name>",
144
- 'Record name relative to the zone (e.g. "redline") or FQDN'
145
- ).option("--value <value>", "Record value (e.g. CNAME target)").option(
146
- "--ttl <seconds>",
147
- "TTL in seconds (default: 300)",
148
- (value) => Number.parseInt(value, 10)
149
- ).option("-y, --yes", "Skip the confirmation prompt").option("--dry-run", "Preview the change without calling Route53").option("-v, --verbose", "Enable verbose logging").action(async (options) => {
150
- await _WBOQ6AUNcjs.addRecordCommand.call(void 0, {
151
- profile: options.profile,
152
- zone: options.zone,
153
- type: options.type,
154
- name: options.name,
155
- value: options.value,
156
- ttl: options.ttl,
157
- yes: _nullishCoalesce(options.yes, () => ( false)),
158
- dryRun: _nullishCoalesce(options.dryRun, () => ( false)),
159
- verbose: _nullishCoalesce(options.verbose, () => ( false))
160
- });
161
- });
162
- route53.command("remove-record").summary("Interactively delete a DNS record").description(
163
- "Delete a Route53 resource record set. Prompts for hosted zone, type, and name when not passed as flags, shows the record it found, and confirms before deleting."
164
- ).option("-p, --profile <profile>", "AWS profile (defaults to AWS_PROFILE)").option(
165
- "-z, --zone <name-or-id>",
166
- "Hosted zone name or ID (e.g. mountaindev.com)"
167
- ).option(
168
- "-t, --type <type>",
169
- "Record type (A, AAAA, CNAME, TXT, MX, NS, SRV, CAA)"
170
- ).option(
171
- "-n, --name <name>",
172
- 'Record name relative to the zone (e.g. "redline") or FQDN'
173
- ).option("-y, --yes", "Skip the confirmation prompt").option("--dry-run", "Preview the deletion without calling Route53").option("-v, --verbose", "Enable verbose logging").action(async (options) => {
174
- await _2FSYDFUVcjs.removeRecordCommand.call(void 0, {
175
- profile: options.profile,
176
- zone: options.zone,
177
- type: options.type,
178
- name: options.name,
179
- yes: _nullishCoalesce(options.yes, () => ( false)),
180
- dryRun: _nullishCoalesce(options.dryRun, () => ( false)),
181
- verbose: _nullishCoalesce(options.verbose, () => ( false))
182
- });
183
- });
184
- const ses = aws.command("ses").summary("SES operational commands").description("SES operational commands");
185
- ses.command("send-email").summary("Send a test email via SES (API or SMTP)").description(
186
- "Send a single test email through the SES API (default) or the SES SMTP endpoint."
187
- ).requiredOption("--to <address>", "Recipient email address").requiredOption("--from <address>", "Verified SES sender email address").option("--subject <subject>", "Email subject line").option("--body <body>", "Email body (defaults to a timestamp and token)").option("--transport <api|smtp>", "Send via SES API or SES SMTP", "api").option("-r, --region <region>", "AWS region for SES", "us-east-1").option("-p, --profile <profile>", "AWS profile for api transport").option(
188
- "--access-key-id <id>",
189
- "IAM access key ID used as the SMTP username (smtp transport)"
190
- ).option("--dry-run", "Print the email payload without sending").option("-v, --verbose", "Enable verbose logging").action(async (options) => {
191
- await _TKNNDDIBcjs.sendEmailCommand.call(void 0, {
192
- to: options.to,
193
- from: options.from,
194
- subject: options.subject,
195
- body: options.body,
196
- transport: options.transport,
197
- region: options.region,
198
- profile: options.profile,
199
- accessKeyId: options.accessKeyId,
200
- dryRun: _nullishCoalesce(options.dryRun, () => ( false)),
201
- verbose: _nullishCoalesce(options.verbose, () => ( false))
202
- });
203
- });
204
- }
205
-
206
-
207
-
208
- exports.registerAwsCommands = registerAwsCommands;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,288 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
- var _G5K4PVILcjs = require('./G5K4PVIL.cjs');
5
-
6
-
7
- var _R3GUC7O7cjs = require('./R3GUC7O7.cjs');
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 (e) {
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 = _R3GUC7O7cjs.runAws.call(void 0, {
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 = _R3GUC7O7cjs.runAws.call(void 0, {
48
- profile,
49
- region,
50
- args: ["ec2", "describe-instances"],
51
- verbose
52
- });
53
- const instances = [];
54
- for (const reservation of _nullishCoalesce(data.Reservations, () => ( []))) {
55
- for (const raw of _nullishCoalesce(reservation.Instances, () => ( []))) {
56
- const state = _nullishCoalesce(_optionalChain([raw, 'access', _ => _.State, 'optionalAccess', _2 => _2.Name]), () => ( "unknown"));
57
- if (state === "terminated" || state === "shutting-down") {
58
- continue;
59
- }
60
- let name = "";
61
- for (const tag of _nullishCoalesce(raw.Tags, () => ( []))) {
62
- if (tag.Key === "Name") {
63
- name = _nullishCoalesce(tag.Value, () => ( ""));
64
- break;
65
- }
66
- }
67
- const securityGroupIds = (_nullishCoalesce(raw.SecurityGroups, () => ( []))).map((group) => group.GroupId).filter((id) => Boolean(id));
68
- instances.push({
69
- instanceId: raw.InstanceId,
70
- name,
71
- state,
72
- instanceType: _nullishCoalesce(raw.InstanceType, () => ( "unknown")),
73
- publicIp: _nullishCoalesce(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 = _R3GUC7O7cjs.runAws.call(void 0, {
89
- profile,
90
- region,
91
- args: ["ec2", "describe-security-groups", "--group-ids", ...groupIds],
92
- verbose
93
- });
94
- const groups = (_nullishCoalesce(data.SecurityGroups, () => ( []))).map((raw) => ({
95
- groupId: raw.GroupId,
96
- groupName: _nullishCoalesce(raw.GroupName, () => ( "")),
97
- description: _nullishCoalesce(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 = _R3GUC7O7cjs.runAws.call(void 0, {
105
- profile,
106
- region,
107
- args: ["ec2", "describe-security-groups", "--group-ids", groupId],
108
- verbose
109
- });
110
- const securityGroups = _nullishCoalesce(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 <= _G5K4PVILcjs.SSH_PORT && _G5K4PVILcjs.SSH_PORT <= toPort;
133
- }
134
- function listSshIngressRules(securityGroup) {
135
- const rules = [];
136
- for (const permission of _nullishCoalesce(securityGroup.IpPermissions, () => ( []))) {
137
- if (!portAllowsSsh(permission)) {
138
- continue;
139
- }
140
- const fromPort = _nullishCoalesce(permission.FromPort, () => ( _G5K4PVILcjs.SSH_PORT));
141
- const toPort = _nullishCoalesce(permission.ToPort, () => ( _G5K4PVILcjs.SSH_PORT));
142
- const ipProtocol = _nullishCoalesce(permission.IpProtocol, () => ( "tcp"));
143
- for (const ipRange of _nullishCoalesce(permission.IpRanges, () => ( []))) {
144
- const cidrIp = ipRange.CidrIp;
145
- if (!cidrIp || !isSingleHostCidr(cidrIp)) {
146
- continue;
147
- }
148
- rules.push({
149
- cidrIp,
150
- description: _nullishCoalesce(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 = _nullishCoalesce(identity.Arn, () => ( ""));
162
- const username = arn.includes("/") ? _nullishCoalesce(arn.split("/").pop(), () => ( "")) : "";
163
- for (const candidate of [username, _nullishCoalesce(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 _G5K4PVILcjs.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 = _G5K4PVILcjs.SSH_PORT,
197
- toPort = _G5K4PVILcjs.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
- _R3GUC7O7cjs.runAws.call(void 0, {
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
- _R3GUC7O7cjs.runAws.call(void 0, {
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
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
- exports.getCurrentPublicIp = getCurrentPublicIp; exports.listEnabledRegions = listEnabledRegions; exports.listInstances = listInstances; exports.describeSecurityGroups = describeSecurityGroups; exports.getSecurityGroupDetails = getSecurityGroupDetails; exports.listSshIngressRules = listSshIngressRules; exports.extractRoamingFirstName = extractRoamingFirstName; exports.roamingRuleDescription = roamingRuleDescription; exports.resolveRoamingRule = resolveRoamingRule; exports.ruleAlreadyAllowsIp = ruleAlreadyAllowsIp; exports.authorizeRule = authorizeRule; exports.revokeRule = revokeRule; exports.instanceLabel = instanceLabel; exports.securityGroupLabel = securityGroupLabel; exports.sshRuleLabel = sshRuleLabel; exports.printSshRules = printSshRules;