summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2016-09-26 21:34:39 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2016-09-26 21:34:39 +0000
commitb09dd74624c627fcfa5738a619d138c5490f9888 (patch)
tree2a47948ac8632c30c1b63153976c021379a396ad /regress
parente4aebffba1936e14846b20f24844c69b85150559 (diff)
Allow to run ssh regression tests as root. If the user is already
root, the test should not expect that SUDO is set. If ssh needs another user, use sudo or doas to switch from root if necessary. OK dtucker@
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/ssh/agent-getpeereid.sh13
-rw-r--r--regress/usr.bin/ssh/keys-command.sh4
-rw-r--r--regress/usr.bin/ssh/principals-command.sh4
-rw-r--r--regress/usr.bin/ssh/sftp-chroot.sh4
4 files changed, 17 insertions, 8 deletions
diff --git a/regress/usr.bin/ssh/agent-getpeereid.sh b/regress/usr.bin/ssh/agent-getpeereid.sh
index fa8cec7ec7f..f668dcfc438 100644
--- a/regress/usr.bin/ssh/agent-getpeereid.sh
+++ b/regress/usr.bin/ssh/agent-getpeereid.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: agent-getpeereid.sh,v 1.6 2016/05/03 14:41:04 djm Exp $
+# $OpenBSD: agent-getpeereid.sh,v 1.7 2016/09/26 21:34:38 bluhm Exp $
# Placed in the Public Domain.
tid="disallow agent attach from other uid"
@@ -10,7 +10,16 @@ SSH_AUTH_SOCK=/nonexistent
case "x$SUDO" in
xsudo) sudo=1;;
xdoas) ;;
- x) fatal "need SUDO to switch to uid $UNPRIV, test won't work without";;
+ x)
+ if [ -x /usr/local/bin/sudo -a -f /etc/sudoers ]; then
+ sudo=1
+ SUDO=/usr/local/sbin/sudo
+ elif [ -f /etc/doas.conf ]; then
+ SUDO=/usr/bin/doas
+ else
+ fatal "need SUDO to switch to uid $UNPRIV," \
+ "test won't work without"
+ fi ;;
*) fatal 'unsupported $SUDO - "doas" and "sudo" are allowed' ;;
esac
diff --git a/regress/usr.bin/ssh/keys-command.sh b/regress/usr.bin/ssh/keys-command.sh
index 21aded10d64..83a78d097ed 100644
--- a/regress/usr.bin/ssh/keys-command.sh
+++ b/regress/usr.bin/ssh/keys-command.sh
@@ -1,9 +1,9 @@
-# $OpenBSD: keys-command.sh,v 1.3 2015/05/21 06:40:02 djm Exp $
+# $OpenBSD: keys-command.sh,v 1.4 2016/09/26 21:34:38 bluhm Exp $
# Placed in the Public Domain.
tid="authorized keys from command"
-if [ -z "$SUDO" ]; then
+if [ -z "$SUDO" -a ! -w /var/run ]; then
fatal "need SUDO to create file in /var/run, test won't work without"
fi
diff --git a/regress/usr.bin/ssh/principals-command.sh b/regress/usr.bin/ssh/principals-command.sh
index 4cbfa659c36..37d23ab3331 100644
--- a/regress/usr.bin/ssh/principals-command.sh
+++ b/regress/usr.bin/ssh/principals-command.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: principals-command.sh,v 1.2 2016/09/21 01:35:12 djm Exp $
+# $OpenBSD: principals-command.sh,v 1.3 2016/09/26 21:34:38 bluhm Exp $
# Placed in the Public Domain.
tid="authorized principals command"
@@ -6,7 +6,7 @@ tid="authorized principals command"
rm -f $OBJ/user_ca_key* $OBJ/cert_user_key*
cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
-if [ -z "$SUDO" ]; then
+if [ -z "$SUDO" -a ! -w /var/run ]; then
fatal "need SUDO to create file in /var/run, test won't work without"
fi
diff --git a/regress/usr.bin/ssh/sftp-chroot.sh b/regress/usr.bin/ssh/sftp-chroot.sh
index 03e1ce21120..78414474a27 100644
--- a/regress/usr.bin/ssh/sftp-chroot.sh
+++ b/regress/usr.bin/ssh/sftp-chroot.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: sftp-chroot.sh,v 1.4 2014/01/20 00:00:30 dtucker Exp $
+# $OpenBSD: sftp-chroot.sh,v 1.5 2016/09/26 21:34:38 bluhm Exp $
# Placed in the Public Domain.
tid="sftp in chroot"
@@ -7,7 +7,7 @@ CHROOT=/var/run
FILENAME=testdata_${USER}
PRIVDATA=${CHROOT}/${FILENAME}
-if [ -z "$SUDO" ]; then
+if [ -z "$SUDO" -a ! -w /var/run ]; then
fatal "need SUDO to create file in /var/run, test won't work without"
fi