diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2008-02-04 15:36:11 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2008-02-04 15:36:11 +0100 |
commit | e779ece477b9af1cc774c80c17d1dbfa6feb2b01 (patch) | |
tree | e59a5b453e527a2d8823c76ae318356f5d37c0ee | |
parent | 5273f1bf4da222c54e7abe9f3c6482496f8e09fd (diff) | |
parent | 5d149bfc7f34bc39e0edf8d9d98786cadefeeedf (diff) |
merged from apt-authentication-reliability
-rw-r--r-- | apt-pkg/acquire-item.cc | 1 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 4 | ||||
-rwxr-xr-x | cmdline/apt-key | 41 | ||||
-rw-r--r-- | debian/changelog | 12 | ||||
-rwxr-xr-x | test/pre-upload-check.py | 14 |
5 files changed, 64 insertions, 8 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index c22a31058..9464ba696 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1229,6 +1229,7 @@ void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) "GPG error: %s: %s\n"), Desc.Description.c_str(), LookupTag(Message,"Message").c_str()); + RunScripts("APT::Update::Auth-Failure"); return; } else { _error->Warning(_("GPG error: %s: %s"), diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 5ed6482fa..b11ecf132 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -704,14 +704,16 @@ bool pkgDPkgPM::Go(int OutStatusFd) sighandler_t old_SIGINT = signal(SIGINT,SIG_IGN); struct termios tt; + struct termios tt_out; struct winsize win; int master; int slave; // FIXME: setup sensible signal handling (*ick*) tcgetattr(0, &tt); + tcgetattr(1, &tt_out); ioctl(0, TIOCGWINSZ, (char *)&win); - if (openpty(&master, &slave, NULL, &tt, &win) < 0) + if (openpty(&master, &slave, NULL, &tt_out, &win) < 0) { const char *s = _("Can not write log, openpty() " "failed (/dev/pts not mounted?)\n"); diff --git a/cmdline/apt-key b/cmdline/apt-key index d9739461c..860895ae2 100755 --- a/cmdline/apt-key +++ b/cmdline/apt-key @@ -9,9 +9,38 @@ GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-k GPG="$GPG_CMD --keyring /etc/apt/trusted.gpg" +MASTER_KEYRING=/usr/share/keyrings/ubuntu-master-keyring.gpg ARCHIVE_KEYRING=/usr/share/keyrings/ubuntu-archive-keyring.gpg REMOVED_KEYS=/usr/share/keyrings/ubuntu-archive-removed-keys.gpg +add_keys_with_verify_against_master_keyring() { + ADD_KEYRING=$1 + MASTER=$2 + + if [ ! -f "$ADD_KEYRING" ]; then + echo "ERROR: '$ADD_KEYRING' not found" + return + fi + if [ ! -f "$MASTER" ]; then + echo "ERROR: '$MASTER' not found" + return + fi + + # when adding new keys, make sure that the archive-master-keyring + # is honored. so: + # all keys that are exported and have the name + # "Ubuntu Archive Automatic Signing Key" must have a valid signature + # from a key in the ubuntu-master-keyring + add_keys=`$GPG_CMD --keyring $ADD_KEYRING --with-colons --list-keys | grep ^pub | cut -d: -f5` + master_keys=`$GPG_CMD --keyring $MASTER --with-colons --list-keys | grep ^pub | cut -d: -f5` + for add_key in $add_keys; do + for master_key in $master_keys; do + if $GPG --list-sigs --with-colons $add_key | grep ^sig | cut -d: -f5 | grep -q $master_key; then + $GPG_CMD --quiet --batch --keyring $ARCHIVE_KEYRING --export $add_key | $GPG --import + fi + done + done +} update() { if [ ! -f $ARCHIVE_KEYRING ]; then @@ -20,10 +49,15 @@ update() { exit 1 fi - # add new keys - $GPG_CMD --quiet --batch --keyring $ARCHIVE_KEYRING --export | $GPG --import + # add new keys, if no MASTER_KEYRING is used, use the traditional + # way + if [ -z "$MASTER_KEYRING" ]; then + $GPG_CMD --quiet --batch --keyring $ARCHIVE_KEYRING --export | $GPG --import + else + add_keys_with_verify_against_master_keyring $ARCHIVE_KEYRING $MASTER_KEYRING + fi - # remove no-longer used keys + # remove no-longer supported/used keys keys=`$GPG_CMD --keyring $REMOVED_KEYS --with-colons --list-keys | grep ^pub | cut -d: -f5` for key in $keys; do if $GPG --list-keys --with-colons | grep ^pub | cut -d: -f5 | grep -q $key; then @@ -32,6 +66,7 @@ update() { done } + usage() { echo "Usage: apt-key [command] [arguments]" echo diff --git a/debian/changelog b/debian/changelog index 12b3b5ddc..b94835a35 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,20 @@ apt (0.7.9ubuntu6) hardy; urgency=low + [ Michael Vogt ] + * cmdline/apt-key: + - add support for a master-keyring that contains signing keys + that can be used to sign the archive signing keys. This should + make key-rollover easier. + * apt-pkg/deb/dpkgpm.cc: + - merged patch from Kees Cook to fix anoying upper-case display + on amd64 in sbuild + * apt-pkg/algorithms.cc: + - add APT::Update::Post-Invoke-Success script slot * apt-pkg/deb/dpkgpm.cc: - add APT::Apport::MaxReports to limit the maximum number of reports generated in a single run (default to 3) - -- + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 04 Feb 2008 14:28:02 +0100 apt (0.7.9ubuntu5) hardy; urgency=low diff --git a/test/pre-upload-check.py b/test/pre-upload-check.py index ca44ec726..ae0067e52 100755 --- a/test/pre-upload-check.py +++ b/test/pre-upload-check.py @@ -25,7 +25,8 @@ class testAptAuthenticationReliability(unittest.TestCase): apt = "apt-get" def setUp(self): - pass + if os.path.exists("/tmp/autFailure"): + os.unlink("/tmp/authFailure"); def testRepositorySigFailure(self): """ test if a repository that used to be authenticated and fails on @@ -39,26 +40,33 @@ class testAptAuthenticationReliability(unittest.TestCase): os.utime("/var/lib/apt/lists/%s" % os.path.basename(f), (0,0)) res = call([self.apt, "update", - "-o","Dir::Etc::sourcelist=./authReliability/sources.list.failure" + "-o","Dir::Etc::sourcelist=./authReliability/sources.list.failure", + "-o",'APT::Update::Auth-Failure::=touch /tmp/authFailure', ] + apt_args, stdout=stdout, stderr=stderr) self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Release.gpg"), "The gpg file disappeared, this should not happen") self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Packages"), "The Packages file disappeared, this should not happen") + self.assert_(os.path.exists("/tmp/authFailure"), + "The APT::Update::Auth-Failure script did not run") + os.unlink("/tmp/authFailure"); # the same with i-m-s hit this time for f in glob.glob("./authReliability/lists/*"): shutil.copy(f,"/var/lib/apt/lists") os.utime("/var/lib/apt/lists/%s" % os.path.basename(f), (time.time(),time.time())) res = call([self.apt, "update", - "-o","Dir::Etc::sourcelist=./authReliability/sources.list.failure" + "-o","Dir::Etc::sourcelist=./authReliability/sources.list.failure", + "-o",'APT::Update::Auth-Failure::=touch /tmp/authFailure', ] + apt_args, stdout=stdout, stderr=stderr) self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Release.gpg"), "The gpg file disappeared, this should not happen") self.assert_(os.path.exists("/var/lib/apt/lists/people.ubuntu.com_%7emvo_apt_auth-test-suit_gpg-package-broken_Packages"), "The Packages file disappeared, this should not happen") + self.assert_(os.path.exists("/tmp/authFailure"), + "The APT::Update::Auth-Failure script did not run") def testRepositorySigGood(self): """ test that a regular repository with good data stays good |