LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   GPG Import script: maybe something for you? (https://www.linuxquestions.org/questions/debian-26/gpg-import-script-maybe-something-for-you-748220/)

Laurens73 08-17-2009 02:11 PM

GPG Import script: maybe something for you?
 
We all get this annoying message appearing on the screen sometimes:

Code:

W: GPG error: http://www. ... The following signatures couldn't be verified
because the public key is not available: NO_PUBKEY ...

I got a simple solution for it and I like to share it with you all:

/bin/gpgimport
Code:

#!/bin/bash

echo GPG keys are being fetched...
echo Importing keys: $*

#Choose a server wich is the fastest in your area
#gpg --keyserver subkeys.pgp.net --recv-keys $*
gpg --keyserver wwwkeys.eu.pgp.net --recv-keys $*
#gpg --keyserver wwwkeys.pgp.net --recv-keys $*
#gpg --keyserver wwwkeys.gpg.cz --recv-keys $*
#gpg --keyserver wwwkeys.cz.pgp.net --recv-keys $*
#gpg --keyserver wwwkeys.ch.pgp.net --recv-keys $*
#gpg --keyserver keyserver.kjsl.com --recv-keys $*
#gpg --keyserver sks.keyserver.penguin.de --recv-keys $*
#gpg --keyserver pgp.keyserver.ch --recv-keys $*
#gpg --keyserver pks.ms.mff.cuni.cz --recv-keys $*
#gpg --keyserver pks.gpg.cz --recv-keys $*
#gpg --keyserver irdu.nus.edu.sg --recv-keys $*

#Exorting fetched keys:
gpg --armor --export $* |apt-key add -

Copy this script to a path directory and open an xterminal. Chmod the script to 755. Do an apt-get update (or aptitude) and when then gpg key is displayed after NO_PUBKEY type gpgimport on the commandline and select all gpg keys with your mouse and paste them with middleclick separated by a space. for example:

(dutch example version of my script)
Code:

pc:~# gpgimport 3916C431F80994F6 EEFB43B2FBABB737 07DC563D1F41B907

GPG sleutel wordt opggehaald bij de bekende servers...
Te importeren sleutel: 3916C431F80994F6 EEFB43B2FBABB737 07DC563D1F41B907
gpg: opvragen sleutel F80994F6 van hkp sleutelserver wwwkeys.eu.pgp.net
gpg: sleutel F80994F6: publieke sleutel “Stefan Lippers-Hollmann (sidux.com) <s.l-h@gmx.de>” geimporteerd
gpg: no ultimately trusted keys found
gpg:        Totaal aantal verwerkt: 1
gpg:                  Geimporteerd: 1
gpg: sleutel F80994F6: publieke sleutel “Stefan Lippers-Hollmann (sidux.com) <s.l-h@gmx.de>” geimporteerd
gpg: no ultimately trusted keys found
gpg:        Totaal aantal verwerkt: 1
gpg:                  Geimporteerd: 1
gpg: sleutel F80994F6: publieke sleutel “Stefan Lippers-Hollmann (sidux.com) <s.l-h@gmx.de>” geimporteerd
gpg: no ultimately trusted keys found
gpg:        Totaal aantal verwerkt: 1
gpg:                  Geimporteerd: 1
OK

When adding a new repository and the message appears again, just type gpgimiport GPG KEY and the key will be imported.


All times are GMT -5. The time now is 09:12 AM.