summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-02-12 14:17:02 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2008-02-12 14:17:02 +0100
commitb09e09c756861ab167647ec61ac59b85c2928be6 (patch)
tree2c90159d314e4ba630720d304cfe448a9087954d /cmdline
parent77e53c8c64ff840cd7780816fc591cf0fa9ba095 (diff)
parent848ecfa4e757ef635cdddcb86758847067441ce5 (diff)
* cmdline/apt-key:
- add "net-update" command that fetches the ubuntu-archive-keyring.gpg and add keys from it that are signed by the ubuntu-master-keyring.gpg (apt-archive-key-signatures spec)
Diffstat (limited to 'cmdline')
-rwxr-xr-xcmdline/apt-key19
1 files changed, 19 insertions, 0 deletions
diff --git a/cmdline/apt-key b/cmdline/apt-key
index e2dbd8af7..d4b61b356 100755
--- a/cmdline/apt-key
+++ b/cmdline/apt-key
@@ -12,6 +12,7 @@ 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
+ARCHIVE_KEYRING_URI=http://archive.ubuntu.com/ubuntu/ubuntu-archive-keyring.gpg
add_keys_with_verify_against_master_keyring() {
ADD_KEYRING=$1
@@ -47,6 +48,20 @@ add_keys_with_verify_against_master_keyring() {
done
}
+# update the current archive signing keyring from a network URI
+# the archive-keyring keys needs to be signed with the master key
+# (otherwise it does not make sense from a security POV)
+net_update() {
+ if [ -z "$ARCHIVE_KEYRING_URI" ]; then
+ echo "ERROR: no location for the archive-keyring given"
+ fi
+ if [ ! -d /var/lib/apt/keyrings ]; then
+ mkdir -p /var/lib/apt/keyrings
+ fi
+ (cd /var/lib/apt/keyrings; wget -q -N $ARCHIVE_KEYRING_URI)
+ add_keys_with_verify_against_master_keyring /var/lib/apt/keyrings/$(basename $ARCHIVE_KEYRING) $MASTER_KEYRING
+}
+
update() {
if [ ! -f $ARCHIVE_KEYRING ]; then
echo >&2 "ERROR: Can't find the archive-keyring"
@@ -82,6 +97,7 @@ usage() {
echo " apt-key export <keyid> - output the key <keyid>"
echo " apt-key exportall - output all trusted keys"
echo " apt-key update - update keys using the keyring package"
+ echo " apt-key net-update - update keys using the network"
echo " apt-key list - list keys"
echo
}
@@ -111,6 +127,9 @@ case "$command" in
update)
update
;;
+ net-update)
+ net_update
+ ;;
list)
$GPG --batch --list-keys
;;