Powered By

Powered by Blogger

Tampilkan postingan dengan label gpg. Tampilkan semua postingan
Tampilkan postingan dengan label gpg. Tampilkan semua postingan

Senin, 21 Februari 2011

Launchpad-Getkeys Gets Proxy Support [Automatically Import All Missing GPG Keys With One Command]

Launchpad Getkeys

Launchpad-Getkeys is a script (comes packaged in a .deb) that automatically imports all missing GPG keys, even if you're behind a firewall. It was initially created by blackgr @ ubuntuforums but then I decided to completely re-write the script so I can add some options, new features and so on.

How do you know when you have a missing GPG key? Here's an example: when you run "sudo apt-get update", you'll see some errors like this:

[...]
Fetched 47.0kB in 6s (7,710B/s)
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net maverick Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B2DFD25316B94077
W: GPG error: http://ppa.launchpad.net maverick Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1FFD34C9EB13C954
W: GPG error: http://ppa.launchpad.net maverick Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EF4186FE247510BE

Here's a screenshot too:

GPG errors


Further more, if you have missing GPG keys, the update manager will not allow you to update the packages. That's when Launchpad-Getkeys comes in: it can automatically import all these missing GPG keys, thus fix the errors.

Here is a video with Launchpad-getkeys in action to get a better idea on how it works:




Unfortunately my script didn't work if the user was behind a proxy but WebUpd8 reader Saurabh Kumar added proxy support to Launchpad-Getkeys - I couldn't test this (I'm not behind a proxy and even if I'd try to simulate this, I wouldn't know for sure that it works) but I've merged his change into the Launchpad-Getkeys package in the WebUpd8 PPA anyway. Read on to find out how to install and use Launchpad-Getkeys.



Install Launchpad-Getkeys


Launchpad-Getkeys is available for Ubuntu 9.10, 10.04, 10.10 and 11.04, in the WebUpd8 PPA. Add the PPA and install Launchpad-Getkeys using the following commands:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install launchpad-getkeys


How to use Launchpad-Getkeys


To automatically import all the missing Launchpad GPG keys, all you have to do is run the following command:
sudo launchpad-getkeys


You can also specify a keyserver and port using the "-k" parameter, like so:
sudo launchpad-getkeys -k SERVER:PORT

This is useful if the port is blocked (but Launchpad-Getkeys uses port 80 by default, unlike the "add-apt-repository" command until Ubuntu 11.04) or if the keyserver is down.

To use Launchpad Getkeys when you're behind a proxy (instructions by Saurabh Kumar - tested by him only), run the following command:
sudo visudo

Then search for this line:
Defaults        env_reset

And above it, add this:
Defaults env_keep = "http_proxy"

Then press "Ctrl + O" and "Ctrl + X" if visudo is open using Nano (that's the default behavior).

This will use your "http_proxy" so all you have to do is run:
sudo launchpad-getkeys

If you want, you can specify a different proxy like this:
sudo launchpad-getkeys -p http://SERVER:PORT


Note: There are still things to do. For instance, the script cannot tell if it imported the keys successfully or not and will always report this as successful. I'm still working on solving this.


Many thanks to Saurabh Kumar for his patch!

Senin, 13 Desember 2010

GPG Key Issues Due To Blocked Port Should Finally Be Fixed In Ubuntu 11.04 Natty Narwhal

When adding a PPA in Ubuntu, the GPG key is imported using port 11371. If this port is blocked (by your ISP, Firewall) the GPG key import fails so you'll get lots of errors when running an update and also, the Update Manager doesn't install any available updates. But this will finally be fixed starting with Ubuntu 11.04 Natty Narwhal - an update to software-propreties notes that port 80 will be used by default instead of 11371 for getting the GPG keys.

Hopefully this "software-properties" feature will be backported to older Ubuntu versions; meanwhile you can use Launchpad Getkeys to fix the missing GPG keys.

Jumat, 10 Desember 2010

PPA Updates: Minitube, gThumb, Launchpad Getkeys, Dropbox Share

This post is just a short summary of some updated packages in the WebUpd8 PPAs.


Minitube


Minitube

Minitube stopped working yesterday due to some changes to the YouTube website. The update broke all applications for playing / downloading YouTube videos, but luckily Minitube has been updated (version 1.3) to include a fix. The new version also comes with a new icon and is available as always in the main WebUpd8 PPA, for Ubuntu Lucid and Maverick:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install minitube

Unfortunately this version also comes with a regression: the Linux version has lost its seeking functionality. Hopefully it will be re-added in a future version.


gThumb


I've also updated gThumb (2.12.1) which is now in sync with Debian unstable. This is not a new version of the application but a new version of the packaging which fixes some pretty important bugs. As usual, gThumb is available both in the WebUpd8 gThumb PPA and in the main WebUpd8 PPA.


Install it from the gThumb PPA:
sudo add-apt-repository ppa:webupd8team/gthumb
sudo apt-get update
sudo apt-get install gthumb


Launchpad Getkeys

Late last night I've updated Launchpad Getkeys to work with non-English Ubuntu. Initially, the script only worked if you had installed Ubuntu in English.

Install Launchpad Getkeys:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install launchpad-getkeys

Unfortunately the script does not work if you need a proxy.

Dropbox Share

Dropbox Share has been updated to use "dropbox-index.html" instead of "index.html" file name when sharing a folder (an .html file is created when sharing a folder so you can easily navigate all the subfolders in a web browser). The new version also removes these dropbox-index.html files automatically when unsharing a folder (and when the script notices you've removed the link from the Dropbox Public folder).

Install Dropbox Share:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install dropbox-share

Kamis, 09 Desember 2010

Import Missing GPG Keys, Even Behind A Firewall (Port 11371 Closed) [Launchpad PPAs]

If you are behind a firewall (and port 11371 is closed), you get an error each time you add a PPA:
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv 1970E5148200CA418348886341FDF8A2B455BEF0
gpg: requesting key B455BEF0 from hkp server keyserver.ubuntu.com
?: keyserver.ubuntu.com: Connection timed out
gpgkeys: HTTP fetch error 7: couldn't connect: Connection timed out
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

Further more, you get errors when running "sudo apt-get update", the Update Manager refuses to upgrade packages and so on.

Do you remember Launchpad-Getkeys - a script that automatically imports all missing GPG keys? Well, if you're behind a firewall, you'll be glad to know that Launchpad-Getkeys now works on port 80 by default so it should finally fix the missing GPG keys issue. I've completely rewritten the script (which was initially posted by blackgr @ ubuntuforums) to only imports the missing GPG keys (it used to import all the keys each time you ran it, even if you only had one missing key). In the new version I've also added an option to use a different keyserver (use: -k SERVER:PORT).

Install and use Launchpad-Getkeys


To install the package in Ubuntu Karmic, Lucid, Maverick and Natty, use the following commands:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install launchpad-getkeys


Then, to import all the missing GPG keys, run the following command:
sudo launchpad-getkeys

That's it! Now run "sudo apt-get update" and you shouldn't get any errors about missing GPG keys anymore (unless the keyserver is down).

This feature (but further tweaked) will be implemented in a future Y PPA Manager version.

Update: the script didn't work if you didn't use Ubuntu in English. This should be fixed in the latest version (0.2.2) which I've just uploaded to the PPA.

Update 2: if you're behind a proxy (not firewall) and Launchpad Getkeys doesn't work for you, try this modified Launchpad-Getkeys (by saurabhk).

Jumat, 28 Mei 2010

Automatically Import All Missing Launchpad PPA GPG Keys [Ubuntu .deb]

Almost a year ago, we posted a script created by an Ubuntuforums user (blackgr) which automatically imports Launchpad GPG keys in Ubuntu for all the PPAs you have added to your software sources.

We didn't talk about it much since then because meanwhile, the "add-apt-repository" was introduced in Ubuntu - a command which adds a PPA via command line and also imports the GPG key. But if you add a PPA when the Ubuntu keyserver is down, the key is not added. And if you add multiple PPAs when this happens, it can be quite annoying to search for and manually import the GPG keys for every PPA. For instance, when Ubuntu 10.04 was released, the Ubuntu Keyserver was down so a lot of people possibly have some missing GPG keys.

When a GPG key is missing, an error similar to this is displayed when you run an update:
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5A9BF3BB4E5E17B5
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B22AB97AF1CDFA9
W: You may want to run apt-get update to correct these problems


For this reason I've created an Ubuntu .deb package for the script I was talking about which you can install via the WebUpd8 PPA:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install launchpad-getkeys

Once installed, to import all the missing GPG keys for your PPAs, simply use the following command:
sudo launchpad-getkeys


That's it!


In a future release, I might add some mirrors for getting the GPG keys to make sure the server launchpad-getkeys tries to access is not down. We'll see...


Update: I've released a new Launchpad Getkeys version which uses port 80 by default so it will now also work for those behind a firewall. Futher more, you can now specify the keyserver it should use for importing the GPG key. See this post: Import Missing GPG Keys, Even Behind A Firewall (Port 11371 Closed) [Launchpad PPAs]

Jumat, 08 Januari 2010

How To Create Your Own GPG Key [Linux]

The GPG key (which means Gnu Privacy Guard, aka GnuPG) can be used for many things like signing your packages, sign the Ubuntu Code of Conduct, etc. I am writing this how-to because I plan to write an article on creating .deb packages the right way, and for that you will need to sign them using your GPG key.

Let's get started!

Generate the GPG key:
gpg --gen-key

The above command will display this:

gpg (GnuPG) 1.4.9; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
(1) DSA and Elgamal (default)
(2) DSA (sign only)
(5) RSA (sign only)


Enter: "1" which is the default encryption.

Then, you will see something like this:
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)


Enter: 2048

Then you will be asked to enter the key expiration period. It is wise to set an expiration date on your keys! Choose the option you want here:

Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)


After selecting "y" when asked if the info is correct, you will have to input your Real Name and Email address (one at a time):

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Real name:
Email address:


Your must remember exactly how you typed your real name and email address, so be careful what you type and write it down if you think you're going to forget!

Next step:

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?


Here, enter: "O"

Now you must enter your passphrase:

You need a Passphrase to protect your secret key.

gpg: gpg-agent is not available in this session
Enter passphrase:


Enter a complicated pass phrase so nobody can break it and sign packages with your key. After entering the passphrase, do some random actions on your computer so that it can generate enough random bytes:

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.


Once your done, you can see your GPG key in ~/.gnugp/. You can also view your keys by typing:
gpg --list-keys


Since our initial goal was to be able to sign .deb packages and sign the Ubuntu Code of Conduct, you need to created a public key:
gpg -a --output ~/.gnupg/YOUR_NAME.gpg --export 'YOUR NAME'

Replace YOUR_NAME and YOUR NAME with... your name (or any other name if you want).

Now import the key:
gpg --import ~/.gnupg/YOUR_NAME.gpg


Make sure YOUR_NAME is the same in the last two commands!