test-apt-key-net-update 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. changetowebserver
  8. # setup env
  9. mkdir -p var/lib/apt/keyrings
  10. mkdir -p usr/share/keyrings
  11. # install the fake master keyring
  12. install -m0644 keys/test-master-keyring.pub usr/share/keyrings
  13. echo "APT::Key::MasterKeyring \"${TMPWORKINGDIRECTORY}/usr/share/keyrings/test-master-keyring.pub\";" >> ./aptconfig.conf
  14. # setup archive-keyring
  15. mkdir -p aptarchive/ubuntu/project
  16. install -m0644 keys/test-archive-keyring.pub aptarchive/ubuntu/project/
  17. echo 'APT::Key::ArchiveKeyringURI "http://localhost:8080/ubuntu/project/test-archive-keyring.pub";' >> ./aptconfig.conf
  18. echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
  19. # test against the "real" webserver
  20. testequal 'Checking for new archive signing keys now
  21. gpg: key F68C85A3: public key "Test Automatic Archive Signing Key <ftpmaster@example.com>" imported
  22. gpg: Total number processed: 1
  23. gpg: imported: 1 (RSA: 1)' aptkey --fakeroot net-update
  24. aptkey list | grep '^pub' > aptkey.list
  25. testfileequal ./aptkey.list 'pub 1024R/F68C85A3 2013-12-19
  26. pub 2048R/DBAC8DAE 2010-08-18'
  27. # now try a different one
  28. # setup archive-keyring
  29. mkdir -p aptarchive/ubuntu/project
  30. install -m0644 keys/marvinparanoid.pub aptarchive/ubuntu/project/
  31. echo 'APT::Key::ArchiveKeyringURI "http://localhost:8080/ubuntu/project/marvinparanoid.pub";' >> ./aptconfig.conf
  32. echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
  33. # test against the "real" webserver
  34. testequal "Checking for new archive signing keys now
  35. Key 'DE66AECA9151AFA1877EC31DE8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update
  36. aptkey list | grep '^pub' > aptkey.list
  37. testfileequal ./aptkey.list 'pub 1024R/F68C85A3 2013-12-19
  38. pub 2048R/DBAC8DAE 2010-08-18'