This shows you the differences between two versions of the page.
— |
sign_your_rpm [2019/06/05 19:48] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ==== Sign your rpm ==== | ||
+ | |||
+ | GnuPG stands for GNU Privacy Guard and is GNU's tool for secure communication and data storage. It can be used to encrypt data and to create digital signatures. It includes an advanced key management facility and is compliant with the proposed OpenPGP Internet standard as described in RFC 2440. As such, it is aimed to be compatible with PGP from NAI, Inc. | ||
+ | |||
+ | After building your custom RPM package, it's a good idea to sign the package with your own GPG Key to make sure the package is authentic. | ||
+ | |||
+ | In this HOWTO, I'll cover how to generate your own gpg key pair and sign your custom RPM package with that key. | ||
+ | |||
+ | * Create the gnupg folder | ||
+ | [root@sme8rpm ]# cd ~ | ||
+ | [root@sme8rpm ]# mkdir .gnupg | ||
+ | |||
+ | |||
+ | * Generate gpg key pair (public key and private key) | ||
+ | |||
+ | [root@sme8rpm ]# gpg --gen-key | ||
+ | gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc. | ||
+ | This program comes with ABSOLUTELY NO WARRANTY. | ||
+ | This is free software, and you are welcome to redistribute it | ||
+ | under certain conditions. See the file COPYING for details. | ||
+ | | ||
+ | gpg: keyring `/ | ||
+ | gpg: keyring `/ | ||
+ | Please select what kind of key you want: | ||
+ | (1) DSA and ElGamal (default) | ||
+ | (2) DSA (sign only) | ||
+ | (4) RSA (sign only) | ||
+ | ''' | ||
+ | DSA keypair will have 1024 bits. | ||
+ | About to generate a new ELG-E keypair. | ||
+ | minimum keysize is 768 bits | ||
+ | default keysize is 1024 bits | ||
+ | highest suggested keysize is 2048 bits | ||
+ | ''' | ||
+ | Requested keysize is 1024 bits | ||
+ | Please specify how long the key should be valid. | ||
+ | 0 = key does not expire | ||
+ | = key expires in n days | ||
+ | w = key expires in n weeks | ||
+ | m = key expires in n months | ||
+ | y = key expires in n years | ||
+ | ''' | ||
+ | Key does not expire at all | ||
+ | ''' | ||
+ | |||
+ | You need a User-ID to identify your key; the software constructs the user id | ||
+ | from Real Name, Comment and Email Address in this form: | ||
+ | " | ||
+ | | ||
+ | ''' | ||
+ | ''' | ||
+ | Comment: | ||
+ | You selected this USER-ID: | ||
+ | "Foo < | ||
+ | | ||
+ | ''' | ||
+ | You need a Passphrase to protect your secret key. | ||
+ | | ||
+ | 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. | ||
+ | +++++++++++++.++++++++++++++++++++++++++++++++++++++++++++++++++..+++++ | ||
+ | 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. | ||
+ | ++++++++++++++++..++++++++++++++++++++.+++++++++++++++> | ||
+ | gpg: / | ||
+ | public and secret key created and signed. | ||
+ | key marked as ultimately trusted. | ||
+ | | ||
+ | pub 1024D/ | ||
+ | Key fingerprint = 9D71 B237 3AE2 B54A B62D 5DC7 2758 9842 23A2 54D4 | ||
+ | sub 1024g/ | ||
+ | |||
+ | * Now that you've generated gpg keys, you can see the list in your key ring by typing : | ||
+ | |||
+ | [root@sme8rpm]# | ||
+ | |||
+ | / | ||
+ | ------------------------------- | ||
+ | pub 1024D/ | ||
+ | sub 1024g/ | ||
+ | |||
+ | * To extract or export your public key from your key ring to a text file. | ||
+ | [root@sme8rpm]# | ||
+ | |||
+ | This file is necessary to import it to your RPM DB and verify a package with gpg key later on. If you're planning to share your custom built RPM packages with others, make sure to have your public key file available online in public (in the web folder of your repository) so they can verify your custom RPM package. see [[http:// | ||
+ | |||
+ | * To import your public key to your RPM DB | ||
+ | [root@sme8rpm]# | ||
+ | Password: | ||
+ | |||
+ | * Let's verify the list of gpg public keys in RPM DB: | ||
+ | [root@sme8rpm]# | ||
+ | |||
+ | * Final step before the signing, configure your ~/ | ||
+ | | ||
+ | |||
+ | %_signature gpg | ||
+ | %_gpg_path / | ||
+ | %_gpg_name Foo | ||
+ | %_gpgbin / | ||
+ | |||
+ | * Now, you're ready to sign your custom RPM package | ||
+ | |||
+ | root@sme8rpm]# | ||
+ | or | ||
+ | root@sme8rpm]# | ||
+ | or | ||
+ | root@sme8rpm]# | ||
+ | |||
+ | to verify if all is ok | ||
+ | |||
+ | root@sme8rpm]# | ||
+ | smeserver-roundcube-0.9-15.src.rpm: | ||
+ | |||
+ | |||
+ | {{tag> rpm documentation }} |