]> git.saurik.com Git - apt.git/commitdiff
merged from apt-authentication-reliability
authorMichael Vogt <michael.vogt@ubuntu.com>
Mon, 4 Feb 2008 14:36:11 +0000 (15:36 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Mon, 4 Feb 2008 14:36:11 +0000 (15:36 +0100)
apt-pkg/acquire-item.cc
apt-pkg/deb/dpkgpm.cc
cmdline/apt-key
debian/changelog
test/pre-upload-check.py

index c22a31058fe6feed65b89000598352efa961e5d0..9464ba6961db18f353161e6feffc47d69d283239 100644 (file)
@@ -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"),
index 5ed6482fa5489a9b4ba9a3f2e32815203c093a36..b11ecf132fa4900ea4eeec8fd597a7a893dc0a06 100644 (file)
@@ -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");
index d9739461c3246861ab7e988229755455fb50ab47..860895ae23fcb7732777639eef3cc758ddbf194f 100755 (executable)
@@ -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
index 12b3b5ddcae75fdb64f99e5872a70ea7c7cc451c..b94835a35987d5d95094bea1b4efd80b9d7b1748 100644 (file)
@@ -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
 
index ca44ec726640d122d9f6c3935bd88e3be85405f3..ae0067e52bc394e0ded6e6961e796cb3132065ca 100755 (executable)
@@ -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