Nicolas Graves: 1 features: ssh: Add option ssh-add-keys. 1 files changed, 45 insertions(+), 10 deletions(-)
Copy & paste the following snippet into your terminal to import this patchset into git:
curl -s https://lists.sr.ht/~abcdw/rde-devel/patches/40007/mbox | git am -3Learn more about email & git
--- src/rde/features/ssh.scm | 55 ++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/src/rde/features/ssh.scm b/src/rde/features/ssh.scm index 74298902..b2a8b4ee 100644 --- a/src/rde/features/ssh.scm +++ b/src/rde/features/ssh.scm @@ -41,24 +41,59 @@ (openssh openssh-sans-x) (ssh-configuration (home-openssh-configuration)) (ssh-agent? #f) - (ssh-agent-configuration (home-ssh-agent-configuration))) + (ssh-agent-configuration (home-ssh-agent-configuration)) + (ssh-add-keys '())) "Setup and configure ssh and ssh-agent." (ensure-pred file-like? openssh) (ensure-pred home-openssh-configuration? ssh-configuration) (ensure-pred boolean? ssh-agent?) (ensure-pred home-ssh-agent-configuration? ssh-agent-configuration) + (ensure-pred list-of-strings? ssh-add-keys) (define (ssh-home-services config) "Returns home services related to SSH." - (append (list - (simple-service 'package - home-profile-service-type (list openssh)) - (service home-openssh-service-type - ssh-configuration)) - (if ssh-agent? - (list (service home-ssh-agent-service-type - ssh-agent-configuration)) - '()))) + (append + (list + (simple-service 'package home-profile-service-type (list openssh)) + (service home-openssh-service-type ssh-configuration)) + (if ssh-agent? + (append + (list + (service home-ssh-agent-service-type + ssh-agent-configuration)) + (if (null? ssh-add-keys) + '() + (list + (simple-service + 'ssh-add-keys + home-shepherd-service-type + (let* ((ssh-add (file-append openssh "/bin/ssh-add")) + (socket-file #~(string-append + #$(home-ssh-agent-socket-directory + ssh-agent-configuration) + "/socket")) + (keys #~(map + (lambda (x) + (if (string-prefix? "~" x) + (string-append user-homedir + (string-drop x 1)) + x)) + '#$ssh-add-keys))) + (list + (shepherd-service + (documentation "Add additional keys after ssh-agent start.") + (provision '(ssh-add-keys)) + (requirement '(ssh-agent)) + (modules '((shepherd support))) ;for '%user-runtime-dir', etc. + (one-shot? #t) + (start + #~(lambda _ + (apply + system* + "env" (string-append "SSH_AUTH_SOCK=" #$socket-file) + #$ssh-add #$keys))) + (stop #~(make-kill-destructor))))))))) + '()))) (feature (name 'ssh) -- 2.39.2
Hi RDE! Since I'm not using gpg, I'm writing this to be able to add specific keys after ssh-agent startup. This patch should not be applied before the other I sent ;)