From 4a2d4f3361adf4c193b3747d3a8a17c7be7532a3 Mon Sep 17 00:00:00 2001 From: Luis Mayta Date: Mon, 30 Dec 2024 14:23:03 -0500 Subject: [PATCH] feat(ssh): implement task for ssh (#3) --- ssh/Taskfile.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ssh/Taskfile.yml b/ssh/Taskfile.yml index 0e628d3..f435b0d 100644 --- a/ssh/Taskfile.yml +++ b/ssh/Taskfile.yml @@ -38,6 +38,14 @@ tasks: vars: STAGE: testing + make:pem:prod: + desc: Make pem for stage prod + run: once + cmds: + - task: make + vars: + STAGE: prod + make: desc: generate ssh pem run: once @@ -64,7 +72,9 @@ tasks: mkdir -p {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/ - >- mv {{.PROJECT_NAME}}-{{.STAGE}} {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/ + - >- mv {{.PROJECT_NAME}}-{{.STAGE}}.pub {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/ + - >- mv {{.PROJECT_NAME}}-{{.STAGE}}.pem {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/ status: - test -f {{.KEYBASE_PROJECT_PATH}}/{{.STAGE}}/keys/{{.PROJECT_NAME}}-{{.STAGE}} @@ -94,3 +104,17 @@ tasks: - task: export vars: STAGE: prod + + make:user: + desc: generate ssh pem username + run: once + deps: + - task: check + cmds: + - >- + ssh-keygen -q -m PEM -t rsa -b 4096 + -C "{{.USERNAME}}" -f {{.USERNAME}} -P "" + - >- + openssl rsa -in {{.USERNAME}} -outform pem > {{.USERNAME}}.pem + - >- + chmod 0600 {{.USERNAME}}.pem