GNU bug report logs -
#41018
[PATCH] gnu: Add AutoSSH service.
Previous Next
Reported by: pinoaffe <pinoaffe <at> airmail.cc>
Date: Sat, 2 May 2020 09:21:02 UTC
Severity: normal
Tags: patch
Done: Oleg Pykhalov <go.wigust <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 41018 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
Thank you for the patch!
pinoaffe <pinoaffe <at> airmail.cc> writes:
> * doc/guix.texi: Add documentation.
> * gnu/services/ssh.scm (<autossh-configuration>): New record type.
> (mpd-service-type): New service type.
> ---
> doc/guix.texi | 75 +++++++++++++++++++++++++++++
> gnu/services/ssh.scm | 109 ++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 183 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index c571010bc8..f88859c584 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
[…]
> +@lisp
> +(autossh (autossh-configuration
> + (user "pino")
> + (ssh-options (list "-T" "-N" "-L" "8081:localhost:8081" "remote.net"))))
> +@end lisp
> +@end deffn
--8<---------------cut here---------------start------------->8---
(service autossh-service-type
(autossh-configuration
(user "pino")
(ssh-options (list "-T" "-N" "-L" "8081:localhost:8081" "remote.net"))))
--8<---------------cut here---------------end--------------->8---
[…]
> diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
> index d2dbb8f80d..ec0150b3a2 100644
> --- a/gnu/services/ssh.scm
> +++ b/gnu/services/ssh.scm
[…]
> +(define (autossh-service-activation config)
> + (with-imported-modules '((guix build utils))
> + #~(begin
> + (use-modules (guix build utils))
> + (define %user
> + (getpw #$(autossh-configuration-user config)))
> + (let ((directory #$(autossh-file-name config "")))
> + (mkdir-p directory)
> + (chown directory (passwd:uid %user) (passwd:gid %user))))))
I cannot start the service in a testing vm because of log file is owner
by root. The following fixes this.
[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index ec0150b3a2..c111437b1a 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -715,9 +715,12 @@ object."
(use-modules (guix build utils))
(define %user
(getpw #$(autossh-configuration-user config)))
- (let ((directory #$(autossh-file-name config "")))
+ (let* ((directory #$(autossh-file-name config ""))
+ (log (string-append directory "/log")))
(mkdir-p directory)
- (chown directory (passwd:uid %user) (passwd:gid %user))))))
+ (chown directory (passwd:uid %user) (passwd:gid %user))
+ (call-with-output-file log (const #t))
+ (chown log (passwd:uid %user) (passwd:gid %user))))))
(define autossh-service-type
(service-type
[Message part 3 (text/plain, inline)]
Also, why don't you put the log in /var/log directory?
Oleg.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 5 years and 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.