diff options
| author | Julian Andres Klode <jak@debian.org> | 2026-05-17 18:53:37 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-05-17 18:53:37 +0000 |
| commit | c28202d199f46fb31d8b510d2fe74c4a1d0c014e (patch) | |
| tree | 7c71a2aa92ca07d49990230a67f56d1b5ee634e2 /test/integration/test-ubuntu-bug-2150631-authconf-unreadable-source | |
| parent | 1514ddad0e542c325c55c93866507dcc96ff5c29 (diff) | |
| parent | 45f1fd73d0b62ce6422365a935abc317718ea142 (diff) | |
Merge branch 'lp2150631' into 'main'
Warn if auth.conf is unreadable (LP: #2150631)
See merge request apt-team/apt!580
Diffstat (limited to 'test/integration/test-ubuntu-bug-2150631-authconf-unreadable-source')
| -rwxr-xr-x | test/integration/test-ubuntu-bug-2150631-authconf-unreadable-source | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/integration/test-ubuntu-bug-2150631-authconf-unreadable-source b/test/integration/test-ubuntu-bug-2150631-authconf-unreadable-source new file mode 100755 index 000000000..0a22e8f83 --- /dev/null +++ b/test/integration/test-ubuntu-bug-2150631-authconf-unreadable-source @@ -0,0 +1,37 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture "amd64" + +if [ "$(id -u)" = '0' ]; then + msgskip "Tests for unreadable auth.conf files do not work as root" + exit 0 +fi + +buildsimplenativepackage "foo" "all" "1" +setupaptarchive --no-update + +changetohttpswebserver --authorization="$(printf '%s' 'star@irc:hunter2' | base64 )" +rewritesourceslist "https://localhost:${APTHTTPSPORT}/" + +AUTHCONF="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/auth.conf.d/private.conf" +mkdir -p "$(dirname "$AUTHCONF")" +printf '%s\n' \ + "machine https://localhost" \ + "login star@irc" \ + "password hunter2" > "$AUTHCONF" +chmod 600 "$AUTHCONF" + +testsuccess aptget update + +chmod 000 "$AUTHCONF" +testfailure aptget source -d foo + +OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" +testsuccess grep -F "Authentication credentials may be configured in ${AUTHCONF}" "$OUTPUT" +testsuccess grep -F "not readable by the current user. Try running this command as root." "$OUTPUT" +testsuccess grep -E "401[[:space:]]+Unauthorized" "$OUTPUT" |
