summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2016-12-27 16:00:40 +0000
committerColin Watson <cjwatson@debian.org>2016-12-27 16:00:40 +0000
commitc46ae24baae62b55577aac54deccd631fa134062 (patch)
treea0b9dd9b0c2e3c5afbbde21c13c3739157dd9218 /debian
parentab9e62811d05708655a430199531465edda1e294 (diff)
When running regression tests under autopkgtest, use a non-root user with passwordless sudo.
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog2
-rwxr-xr-xdebian/tests/regress27
2 files changed, 27 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index e9b297f26..ea47c39ad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -136,6 +136,8 @@ openssh (1:7.4p1-1) UNRELEASED; urgency=medium
136 the upstream default), and document that setting ServerAliveInterval to 136 the upstream default), and document that setting ServerAliveInterval to
137 300 by default if BatchMode is set is Debian-specific (closes: #765630). 137 300 by default if BatchMode is set is Debian-specific (closes: #765630).
138 * Build gnome-ssh-askpass with GTK+ 3 (LP: #801187). 138 * Build gnome-ssh-askpass with GTK+ 3 (LP: #801187).
139 * When running regression tests under autopkgtest, use a non-root user
140 with passwordless sudo.
139 141
140 -- Colin Watson <cjwatson@debian.org> Mon, 05 Dec 2016 19:31:33 +0000 142 -- Colin Watson <cjwatson@debian.org> Mon, 05 Dec 2016 19:31:33 +0000
141 143
diff --git a/debian/tests/regress b/debian/tests/regress
index 253541ad5..846482d62 100755
--- a/debian/tests/regress
+++ b/debian/tests/regress
@@ -1,10 +1,33 @@
1#! /bin/sh 1#! /bin/sh
2set -e 2set -e
3 3
4if [ "$(id -un)" != openssh-tests ]; then
5 TMP="$ADTTMP/user"
6
7 cleanup () {
8 rm -rf "$TMP"
9 rm -f /etc/sudoers.d/openssh-tests
10 if id openssh-tests >/dev/null 2>&1; then
11 deluser --remove-home openssh-tests
12 fi
13 }
14 trap cleanup EXIT
15
16 adduser --disabled-password --gecos 'OpenSSH tests' openssh-tests
17 cat >/etc/sudoers.d/openssh-tests <<EOF
18openssh-tests ALL = (ALL:ALL) NOPASSWD: ALL
19EOF
20 chmod 440 /etc/sudoers.d/openssh-tests
21 mkdir -p "$TMP"
22 chown openssh-tests:openssh-tests "$TMP"
23 sudo -u openssh-tests env TMP="$TMP" "$0" "$@"
24 exit "$?"
25fi
26
4# Don't use "make tests"; we want to test the installed version. 27# Don't use "make tests"; we want to test the installed version.
5 28
6cp -a . "$ADTTMP/tree" 29cp -a . "$TMP/tree"
7cd "$ADTTMP/tree" 30cd "$TMP/tree"
8 31
9# We aren't actually going to use most of this build, but we need a basic 32# We aren't actually going to use most of this build, but we need a basic
10# build tree in place in order to be able to build the regression tests. 33# build tree in place in order to be able to build the regression tests.