mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-26 04:29:25 -05:00
tests: ssh: Add Dropbear test.
* gnu/tests/ssh.scm (run-ssh-test): Try authenticating with 'userauth-none!' when 'userauth-password!' fails. (%test-dropbear): New variable.
This commit is contained in:
parent
0e59885060
commit
2b4363891c
1 changed files with 35 additions and 11 deletions
|
@ -31,7 +31,8 @@ (define-module (gnu tests ssh)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix store)
|
#:use-module (guix store)
|
||||||
#:use-module (guix monads)
|
#:use-module (guix monads)
|
||||||
#:export (%test-openssh))
|
#:export (%test-openssh
|
||||||
|
%test-dropbear))
|
||||||
|
|
||||||
(define %base-os
|
(define %base-os
|
||||||
(operating-system
|
(operating-system
|
||||||
|
@ -74,6 +75,7 @@ (define test
|
||||||
%load-path)))
|
%load-path)))
|
||||||
|
|
||||||
(use-modules (gnu build marionette)
|
(use-modules (gnu build marionette)
|
||||||
|
(srfi srfi-26)
|
||||||
(srfi srfi-64)
|
(srfi srfi-64)
|
||||||
(ice-9 match)
|
(ice-9 match)
|
||||||
(ssh session)
|
(ssh session)
|
||||||
|
@ -139,7 +141,16 @@ (define (wait-for-file file)
|
||||||
#:log-verbosity 'protocol)))
|
#:log-verbosity 'protocol)))
|
||||||
(match (connect! session)
|
(match (connect! session)
|
||||||
('ok
|
('ok
|
||||||
(match (pk 'auth (userauth-password! session ""))
|
;; Try the simple authentication methods. Dropbear
|
||||||
|
;; requires 'none' when there are no passwords, whereas
|
||||||
|
;; OpenSSH accepts 'password' with an empty password.
|
||||||
|
(let loop ((methods (list (cut userauth-password! <> "")
|
||||||
|
(cut userauth-none! <>))))
|
||||||
|
(match methods
|
||||||
|
(()
|
||||||
|
(error "all the authentication methods failed"))
|
||||||
|
((auth rest ...)
|
||||||
|
(match (pk 'auth (auth session))
|
||||||
('success
|
('success
|
||||||
;; FIXME: 'get-server-public-key' segfaults.
|
;; FIXME: 'get-server-public-key' segfaults.
|
||||||
;; (get-server-public-key session)
|
;; (get-server-public-key session)
|
||||||
|
@ -148,7 +159,9 @@ (define (wait-for-file file)
|
||||||
(channel-request-exec channel
|
(channel-request-exec channel
|
||||||
"echo hello > /root/witness")
|
"echo hello > /root/witness")
|
||||||
(and (zero? (channel-get-exit-status channel))
|
(and (zero? (channel-get-exit-status channel))
|
||||||
(wait-for-file "/root/witness")))))))))
|
(wait-for-file "/root/witness"))))
|
||||||
|
('denied
|
||||||
|
(loop rest))))))))))
|
||||||
|
|
||||||
(test-end)
|
(test-end)
|
||||||
(exit (= (test-runner-fail-count (test-runner-current)) 0)))))
|
(exit (= (test-runner-fail-count (test-runner-current)) 0)))))
|
||||||
|
@ -167,3 +180,14 @@ (define %test-openssh
|
||||||
(permit-root-login #t)
|
(permit-root-login #t)
|
||||||
(allow-empty-passwords? #t)))
|
(allow-empty-passwords? #t)))
|
||||||
"/var/run/sshd.pid"))))
|
"/var/run/sshd.pid"))))
|
||||||
|
|
||||||
|
(define %test-dropbear
|
||||||
|
(system-test
|
||||||
|
(name "dropbear")
|
||||||
|
(description "Connect to a running Dropbear SSH daemon.")
|
||||||
|
(value (run-ssh-test name
|
||||||
|
(service dropbear-service-type
|
||||||
|
(dropbear-configuration
|
||||||
|
(root-login? #t)
|
||||||
|
(allow-empty-passwords? #t)))
|
||||||
|
"/var/run/dropbear.pid"))))
|
||||||
|
|
Loading…
Reference in a new issue