janneke pushed a commit to branch wip-hurd-vm
in repository guix.
commit 7efff1ecdcb41a403760429a6a1be9a10bbfbfaf
Author: Jan (janneke) Nieuwenhuizen <[email protected]>
AuthorDate: Sun Apr 12 13:56:01 2020 +0200
system: hurd: Add openssh.
* gnu/system/hurd.scm (%base-packages/hurd): Add openssh.
(cross-hurd-image): Generate sshd_config. Add sshd user.
* gnu/packages/hurd.scm (hurd-rc-script): Create host keys.
---
gnu/packages/hurd.scm | 7 +++++--
gnu/system/hurd.scm | 21 +++++++++++++++++++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index bbe66c0..d187996 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -349,7 +349,9 @@ boot, since this cannot be done from GNU/Linux."
;; Start the oh-so-fancy console client.
(mkdir-p "/var/run") ;for the PID file
(invoke "console" "--daemonize" "-c" "/dev/vcs"
- "-d" "vga" "-d" "pc_kbd" "-d" "generic_speaker"))))
+ "-d" "vga" "-d" "pc_kbd" "-d" "generic_speaker")
+ ;; Generate the ssh host keys.
+ (invoke "/run/current-system/profile/bin/ssh-keygen" "-A"))))
;; FIXME: We want the program to use the cross-compiled Guile when
;; cross-compiling. But why do we need to be explicit here?
@@ -429,7 +431,8 @@ fsysopts / --writable
# MAKEDEV relies on pipes so this needs to be set up.
settrans -c /servers/socket/1 /hurd/pflocal
-(cd /dev; MAKEDEV -D /dev std vcs tty{1,2,3,4,5,6})\n")))
+(cd /dev; MAKEDEV -D /dev std vcs tty{1,2,3,4,5,6})
+(cd /dev; MAKEDEV -D /dev ptyp{0,1,2,3})\n")))
(substitute* "daemons/runsystem.hurd.sh"
(("export PATH")
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index bf74542..4782114 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -31,6 +31,7 @@
#:use-module (gnu packages guile-xyz)
#:use-module (gnu packages hurd)
#:use-module (gnu packages package-management)
+ #:use-module (gnu packages ssh)
#:use-module (gnu system vm)
#:export (cross-hurd-image))
@@ -54,7 +55,7 @@
(define %base-packages/hurd
(list hurd bash coreutils file findutils grep sed
guile-3.0 guile-colorized guile-readline guix
- net-base inetutils))
+ net-base inetutils openssh))
(define* (cross-hurd-image #:key (hurd hurd) (gnumach gnumach))
"Return a cross-built GNU/Hurd image."
@@ -111,6 +112,7 @@ menuentry \"GNU\" {
(plain-file "passwd"
"root:x:0:0:root:/root:/bin/sh
guixbuilder:x:1:1:guixbuilder:/var/empty:/bin/no-sh
+sshd:x:2:2:sshd:/var/empty:/bin/no-sh
"))
(define group
@@ -120,7 +122,7 @@ guixbuilder:x:1:1:guixbuilder:/var/empty:/bin/no-sh
(define shadow
(plain-file "shadow"
- "root::0:0:0:0:::
+ "root::17873::::::
"))
(define etc-profile
@@ -136,6 +138,18 @@ if [ -f \"$GUIX_PROFILE/etc/profile\" ]; then
. \"$GUIX_PROFILE/etc/profile\"
fi\n"))
+ (define sshd_config
+ (plain-file "sshd_config"
+ "# Generated by '(gnu system hurd)'
+Port 22
+PermitRootLogin yes
+PermitEmptyPasswords yes
+PasswordAuthentication yes
+PubkeyAuthentication yes
+PidFile /var/run/sshd.pid
+PrintLastLog yes
+LogLevel INFO\n"))
+
(define build.sh
(plain-file "build.sh"
"#! /bin/sh
@@ -210,6 +224,8 @@ guix build -e '(@@ (gnu packages commencement)
gnu-make-boot0)' --fallback --no-
"i586-pc-gnu"))
hurd)
"/etc/ttys"))
+ (directory "/etc/ssh")
+ ("/etc/ssh/sshd_config" -> ,sshd_config)
("/bin/sh" -> ,(file-append (with-parameters ((%current-target-system
"i586-pc-gnu"))
bash)
@@ -225,6 +241,7 @@ guix build -e '(@@ (gnu packages commencement)
gnu-make-boot0)' --fallback --no-
("group" ,group)
("etc-profile" ,etc-profile)
("shadow" ,shadow)
+ ("sshd_config" ,sshd_config)
("build.sh" ,build.sh))
#:copy-inputs? #t
#:os system-profile