rewrite ssh.scm

This commit is contained in:
Jean-François GUILLAUME 2022-12-13 15:33:44 +01:00
parent 92b9df92b0
commit 854eb4590a
GPG key ID: 38751DAE145EFB5A

View file

@ -1,181 +1,97 @@
(define-module (glicid packages ssh) (define-module (glicid packages ssh)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system cmake) #:use-module (guix build-system cmake)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages ssh) #:use-module (gnu packages ssh)
#:use-module (gnu packages hurd) #:use-module (gnu packages hurd)
#:use-module (gnu packages tls) #:use-module (gnu packages tls)
#:use-module (gnu packages compression) #:use-module (gnu packages compression)
#:use-module (gnu packages pkg-config) #:use-module (gnu packages pkg-config)
#:use-module (gnu packages linux) #:use-module (gnu packages linux)
#:use-module (gnu packages security-token) #:use-module (gnu packages security-token)
) )
(define-public libcbor-0.8.0 (define-public libcbor-0.8.0
(package (package
(name "libcbor") (name "libcbor")
(version "0.8.0") (version "0.8.0")
(source (source
(origin (origin
(method url-fetch) (method url-fetch)
(uri (string-append "http://github.com/PJK/libcbor/archive/refs/tags/v" version ".tar.gz")) (uri (string-append "http://github.com/PJK/libcbor/archive/refs/tags/v" version ".tar.gz"))
(sha256 (base32 "12vw46ahhsc3ydnivkv5lvk1cn4sjjmcr639cjcl99d4dqb9g031")) (sha256 (base32 "12vw46ahhsc3ydnivkv5lvk1cn4sjjmcr639cjcl99d4dqb9g031"))))
) (build-system cmake-build-system)
) (arguments
(build-system cmake-build-system) `(#:configure-flags (list
(arguments "-DCMAKE_CXX_FLAGS=-fPIE"
`(#:configure-flags (list "-DCMAKE_C_FLAGS=-fPIE" )))
"-DCMAKE_CXX_FLAGS=-fPIE" (synopsis "libfido2")
"-DCMAKE_C_FLAGS=-fPIE" (description "Todo")
)) (home-page "toto")
) (license license:gpl2+)))
(synopsis "libfido2")
(description "Todo")
(home-page "toto")
(license license:gpl2+)
)
)
(define-public libcbor-0.9.0 (define-public libcbor-0.9.0
(package (package
(inherit libcbor-0.8.0) (inherit libcbor-0.8.0)
(version "0.9.0") (version "0.9.0")
(source (source
(origin (origin
(method url-fetch) (method url-fetch)
(uri (string-append "http://github.com/PJK/libcbor/archive/refs/tags/v" version ".tar.gz")) (uri (string-append "http://github.com/PJK/libcbor/archive/refs/tags/v" version ".tar.gz"))
(sha256 (base32 "1l8m7h84zwlx088gkz6gvg2fq11g0p3q6lblwba8c01y6gwy90fs")) (sha256 (base32 "1l8m7h84zwlx088gkz6gvg2fq11g0p3q6lblwba8c01y6gwy90fs"))))))
)
)
)
)
(define-public libcbor-latest libcbor-0.9.0) (define-public libcbor-latest libcbor-0.9.0)
;(define-public libfido2-1.8.0
; (package
; (name "libfido2")
; (version "1.8.0")
; (source
; (origin
; (method url-fetch)
; (uri (string-append "https://developers.yubico.com/libfido2/Releases/libfido2-" version ".tar.gz"))
; (sha256 (base32 "07gxyy5yzgfh5hg7q9fr77z5mkj0xjvd5ya7p5f5kar4iwc92hjm"))
; )
; )
; (build-system cmake-build-system)
; (arguments '(
; #:tests? #f
; ))
; (inputs `(
; ("libcbor",libcbor-latest)
; ("openssl",openssl)
; ("zlib", zlib)
; ("pkg-config", pkg-config)
; ("eudev", eudev)
; ))
; (synopsis "libfido2")
; (description "Todo")
; (home-page "toto")
; (license license:gpl2+)
; )
;)
;(define-public libfido2-1.9.0
; (package
; (inherit libfido2-1.8.0)
; (version "1.9.0")
; (source
; (origin
; (method url-fetch)
; (uri (string-append "https://developers.yubico.com/libfido2/Releases/libfido2-" version ".tar.gz"))
; (sha256 (base32 "1ln2b0zfvl35r03kn2k1i2aw1k3ypvivc71xmp4dzlin6ypy6fds"))
; )
; )
; )
;)
;(define libfido2-latest libfido2-1.9.0)
(define-public openssh-with-fido2 ;; this is has to be worked again (define-public openssh-with-fido2 ;; this is has to be worked again
(package (package
(inherit openssh) (inherit openssh)
(name "openssh-with-fido2") (name "openssh-with-fido2")
(arguments `( (arguments `(
#:test-target "tests" #:test-target "tests"
;; Otherwise, the test scripts try to use a nonexistent directory and #:make-flags '("REGRESSTMP=\"$${BUILDDIR}/regress\"")
;; fail. #:configure-flags `(
#:make-flags '("REGRESSTMP=\"$${BUILDDIR}/regress\"") "--sysconfdir=/etc/ssh"
#:configure-flags `( "--with-default-path=/run/current-system/profile/bin"
"--sysconfdir=/etc/ssh" ,(string-append "--with-kerberos5=" (assoc-ref %build-inputs "mit-krb5") "/bin")
;; Default value of 'PATH' used by sshd. "--with-libedit"
"--with-default-path=/run/current-system/profile/bin" "--with-security-key-builtin"
;; configure needs to find krb5-config. ,,@(if (hurd-target?)
,(string-append "--with-kerberos5=" (assoc-ref %build-inputs "mit-krb5") "/bin") '()
;; libedit is needed for sftp completion. '("--with-pam"))
"--with-libedit" ,,@(if (%current-target-system)
;; for u2f '("--disable-strip")
"--with-security-key-builtin" '()))
;; Enable PAM support in sshd. #:phases
,,@(if (hurd-target?) (modify-phases %standard-phases
'() (add-after 'configure 'reset-/var/empty
'("--with-pam") (lambda* (#:key outputs #:allow-other-keys)
) (let ((out (assoc-ref outputs "out")))
;; "make install" runs "install -s" by default, (substitute*
;; which doesn't work for cross-compiled binaries "Makefile"
;; because it invokes 'strip' instead of (("PRIVSEP_PATH=/var/empty") (string-append "PRIVSEP_PATH=" out "/var/empty"))
;; 'TRIPLET-strip'.Work around this. )
,,@(if (%current-target-system) #t )))
'("--disable-strip") (add-before 'check 'patch-tests
'() (lambda _
) (substitute* "regress/test-exec.sh" (("/bin/sh") (which "sh")))
) (substitute*
#:phases (list "Makefile" "regress/Makefile")
(modify-phases %standard-phases (("^(tests:.*) t-exec(.*)" all pre post) (string-append pre post)))
(add-after 'configure 'reset-/var/empty #t ))
(lambda* (#:key outputs #:allow-other-keys) (replace 'install
(let ((out (assoc-ref outputs "out"))) (lambda*
(substitute* (
"Makefile" #:key outputs (make-flags '())
(("PRIVSEP_PATH=/var/empty") (string-append "PRIVSEP_PATH=" out "/var/empty")) #:allow-other-keys
) )
#t (apply invoke "make" "install-nosysconf" make-flags)
) (install-file "contrib/ssh-copy-id" (string-append (assoc-ref outputs "out") "/bin/"))
) (chmod (string-append (assoc-ref outputs "out") "/bin/ssh-copy-id") #o555)
) (install-file "contrib/ssh-copy-id.1" (string-append (assoc-ref outputs "out") "/share/man/man1/"))
(add-before 'check 'patch-tests #t )))))
(lambda _ (inputs `(
(substitute* "regress/test-exec.sh" (("/bin/sh") (which "sh"))) ("libfido2", libfido2)
;; Remove 't-exec' regress target which requires user 'sshd'. ("libcbor", libcbor)
(substitute* ,@(package-inputs openssh)))))
(list "Makefile" "regress/Makefile")
(("^(tests:.*) t-exec(.*)" all pre post) (string-append pre post))
)
#t
)
)
(replace 'install
(lambda*
(
#:key outputs (make-flags '())
#:allow-other-keys
)
;; Install without host keys and system configuration files.
(apply invoke "make" "install-nosysconf" make-flags)
(install-file "contrib/ssh-copy-id" (string-append (assoc-ref outputs "out") "/bin/"))
(chmod (string-append (assoc-ref outputs "out") "/bin/ssh-copy-id") #o555)
(install-file "contrib/ssh-copy-id.1" (string-append (assoc-ref outputs "out") "/share/man/man1/"))
#t
)
)
)
))
(inputs `(
("libfido2", libfido2)
("libcbor", libcbor)
,@(package-inputs openssh)
))
)
)