« Koji/SigulUsing » : différence entre les versions

De TartareFR
Aller à la navigation Aller à la recherche
 
(8 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
= Description =
== Sigul ==
At the beginning of each release under development a new package signing key is created for it.  This key is used to prove the authenticity of packages built by Fedora and distributed by Fedora.  This key will be used to sign all packages for the public test and final releases. This article follows [[Koji/SigulInstall|Install a Sigul Signing server]]
 
après une [[Koji/SigulInstall|installation de Sigul]], on peut l'utiliser.
{{Admon/note|Commandes disponible|<pre>$ sigul --help-commands
delete-key          Delete a key
modify-key-user    Modify user's key access
list-users          List users
grant-key-access    Grant key access to a user
sign-text          Output a cleartext signature of a text
import-key          Import a key
new-user            Add a user
sign-rpm            Sign a RPM
list-keys          List keys
sign-data          Create a detached signature
revoke-key-access  Revoke key acess from a user
user-info          Show information about a user
change-passphrase  Change key passphrase
list-key-users      List users that can access a key
new-key             Add a key
modify-user        Modify a user
sign-rpms          Sign one or more RPMs
modify-key          Modify a key
delete-user        Delete a user
key-user-info      Show information about user's key access
get-public-key      Output public part of the key
</pre>
}}


= Action =
=== Créer une nouvelle clé ===
== Sigul ==
 
Sigul is the signing server which holds our keys.  In order to make use of a new key, the key will have to be created and access to the key will have to be grantedThe <code>new-key</code>, <code>grant-key-access</code>, and <code>change-passphrase</code> commands are used.
Une fois le client Sigul capable d'envoyer des commandes à <class>Sigul</class>, on peut créer une nouvelle clé nommée '''centos-5-key'''.
  sigul new-key --name-real='CentOS-5-B2PWeb' --name-comment='CentOS 5 B2PWeb Signing Key' --name-email='srs@b2pweb.com' --key-admin root centos-5-key
{{Admon/note|Générer beaucoup d'entropie durant le génération de la clé|La génération de la clé nécessite beaucoup d'entropie sur le serveur Sigul. On peut donc occuper le serveur et paradoxalement accélerer la génération de la clé.


<pre>
La commande suivant génère assez d'entropie pour 2 minutes:
<pre>find / > /dev/null 2>&1</pre>}}<pre>
$ sigul new-key --help
$ sigul new-key --help
usage: client.py new-key [options] key
usage: client.py new-key [options] key
Ligne 23 : Ligne 51 :
   --expire-date=YYYY-MM-DD
   --expire-date=YYYY-MM-DD
                         Key expiration date
                         Key expiration date
</pre>
=== Import d'une clé existante ===
sigul import-key 'CentOS-5-B2PWeb' ~/.gnupg/secring.gpg
=== Changer le nom de la clé ===
Changer le nom de la clé '''centos5''' en '''centos-5-key'''<pre>sigul modify-key --new-name centos-5-key centos5</pre>
=== Ajout d'un utilisateur ===


$ sigul grant-key-access --help
* Ajout d'un utilisateur administrateur<pre>sigul new-user --admin --with-password didier</pre>
 
=== Autoriser l'utilisation d'une clé existante à un utilisateur ===
<pre>sigul grant-key-access centos-5-key didier</pre>
<pre>
sigul grant-key-access --help
usage: client.py grant-key-access key user
usage: client.py grant-key-access key user


Ligne 31 : Ligne 73 :
options:
options:
   -h, --help  show this help message and exit
   -h, --help  show this help message and exit
</pre>


$ sigul change-passphrase --help
=== Modifier la phrase de passe ===
sigul change-passphrase centos-5-key
<pre>
sigul change-passphrase --help
usage: client.py change-passphrase key
usage: client.py change-passphrase key


Ligne 41 : Ligne 87 :
</pre>
</pre>


For example if we wanted to create the Fedora 13 signing key, we would do the following:
=== FAQ ===
<ol>
<li>Log into a system configured to run sigul client.</li>
<li>Create the key using a strong passphrase when prompted
<pre>
$ sigul new-key --key-admin jkeating --name-real Fedora \
        --name-comment 13 \
        --name-email fedora@fedoraproject.org fedora-13
</pre></li>
<li>Wait a while for entropy.  This can take several minutes.</li>
<li>Grant key access to Fedora Account holders who will be signing packages and protect it with a temporary a passphrase.  For example, "CHANGEME."
<pre>
$ sigul grant-key-access fedora-13 jwboyer
</pre></li>
<li>Provide the key name and temporary passphrase to signers. If they don't respond, revoke access until they are ready to change their passphrase.  Signers can change their passphrase using the <code>change-passphrase</code> command:
<pre>
$ sigul change-passphrase fedora-13
</pre></li>
<pre><li>
When your sigul cert expires, you will need to run: 'certutil -d ~/.sigul -D -n sigul-client-cert' to remove the old cert, then 'sigul-client-setup' to add a new one.
</pre></li>
</ol>


== fedora-release ==
{{Admon/faq|ERROR: I/O error: Unexpected EOF in NSPR|
The fedora-release package houses a copy of the public key information. This is used by rpm to verify the signature on files encountered. Currently the fedora-release package has a single key file named after the version of the key and the arch the key is for.  To continue our example, the file would be named <code>RPM-GPG-KEY-fedora-13-primary</code> which is the primary arch key for Fedora 13.  To create this file, use the <code>get-public-key</code> command from sigul:
* S'assurer que le répertoire des clés existe. Ce chemin est déclaré dans le fichier <path>/etc/sigul/server.conf</path><pre>gnupg-home: /var/lib/sigul/server/gnupg</pre>
** Propriétaire: '''sigul'''
** Groupe: '''sigul'''
** Droits: 0700 '''rwx------'''
** Lien symbolique '''/var/lib/sigul/gnupg''' pointant sur <path>/var/lib/sigul/server/gnupg</path>
* S'assurer qu'il y a suffisamment d'espace disque ( en gros deux fois la taille du plus gros paquet RPM )
* S'assurer que les daemons sigul_bridge et sigul_server sont démarrés<pre>service sigul_server status && service sigul_bridge status</pre>
* S'assurer que le pont peut se connecter au serveur ( [[Koji/SigulInstall#Firewall| Configure firewall]] )}}


<pre>
{{Admon/faq|Error: Unknown error|
$ sigul get-public-key fedora-13 > RPM-GPG-KEY-fedora-13-primary
Vérifier les journaux du serveur, l'erreur est surement plus explicite
</pre>
* <pre>/usr/bin/rpmsign: No such file or directory</pre>Il suffit d'installer le paquet <package>rpm-sign</package> qui n'est pas installé par défaut sur centos 7. Un simple <code>yum provides /usr/bin/rpmsign</code> donne le paquet à installer.}}


Add this file to the repo, and remove the previous release's file.
{{Admon/faq|Unknown error on creating key process|
* Installer le paquet <package>gnupg1</package> depuis [ http://people.redhat.com/mitr/rpmsigner/rhel6 ] ou de [ http://infrastructure.stg.fedoraproject.org/repo/builder-rpms/6Server/SRPMS/ ]
* S'assurer que Sigul est configurer pour utiliser <package>gnupg1</package><pre>sed -i -e '/gnupg_bin/s,^.*$,gnupg_bin = "/usr/bin/gpg1",' /usr/share/sigul/settings.py</pre>
* S'assurer que le paquet <package>python-sqlalchemy</package> soit installé}}


<pre>
{{Admon/faq|Certificats client expirés|
$ cvs rm RPM-GPG-KEY-fedora-12-primary
Une fois le certificat client expiré, il faut le désactiver localement<pre>certutil -d ~/.sigul -D -n sigul-client-cert</pre> et refaire une génération de certificat client.}}
$ cvs add RPM-GPG-KEY-fedora-13-primary
</pre>


Then make a new fedora-release build for rawhide ('''FIXME''': this should be its own SOP)
== Interfacer Sigul et koji ==


== fedoraproject.org ==
=== configuration ===
fedoraproject.org/keys lists information about all of our keys.  We need to let the webteam know we have created a new key so that they can add it to the list.


We do this by sending an email to webmaster@fedoraproject.org pointing to the viewvc
<class>Sigul</class> peut être utiliser pour signer un ou de multiples RPMs dans une instance <class>Koji</class>. Une fois le client Sigul correctement configuré, il suffit juste de configurer l'utilisateur Proxy pour Koji. Quand un client <class>Sigul</class> émet une requête de signature pour <class>Koji</class>, le pont <class>Sigul</class> se connecte à <class>Koji</class> en tant qu'utilisateur '''kojiweb'''. Il faut juste s'assurer que l'utilisateur demandeur a les droits administrateur sur le <class>Koji</class> et <class>Sigul</class> s'occupe du reste.
http://cvs.fedoraproject.org/viewvc/fedora-release/RPM-GPG-KEY-fedora-13-primary?revision=1.1&root=fedora&view=co as well as including a URL to this page so that the process is not forgotten (see section below)


This url will have to be refreshed for the right release and CVS version
La configuration pour <class>Koji</class> peut être situer n'importe où, du moment que l'utilisateur sigul a droit de lecture. Les certificats pour '''kojiweb''' doivent être copiés dans le même chemin que la configuration <class>Koji</class>


=== Web team SOP ===
* Comme toutes '''les commandes de cette partie doivent être lancées par l'utilisateur sigul''', on va donc devenir cet utilisateur<syntaxhighlight lang="bash">su - sigul</syntaxhighlight>
* Création du répertoire de configuration de <class>Koji</class><syntaxhighlight lang="bash">mkdir -p ~/.koji</syntaxhighlight>
* Copie de la configuration par défaut du client <class>Koji</class><syntaxhighlight lang="bash">cp /etc/koji.conf ~/.koji/config</syntaxhighlight>
* Copie des certificats {{class|Kojiweb}} dans celui-ci<syntaxhighlight lang="bash">cp /etc/pki/koji/pem/kojiweb.pem .koji/client.pem</syntaxhighlight><syntaxhighlight lang="bash">cp /etc/pki/koji/kojica.crt .koji/clientca.crt</syntaxhighlight><syntaxhighlight lang="bash">cp /etc/pki/koji/kojica.crt .koji/serverca.crt</syntaxhighlight>


<pre>
Après avoir redémarrer le pont <class>Sigul</class>, le client doit être capable d'obtenir un RPM depuis Koji et de le signer.
# from git repo root
cd fedoraproject.org/
curl $KEYURL > /tmp/newkey
$EDITOR update-gpg-keys # Add key ID of recently EOL'd version to obsolete_keys
./update-gpg-key /tmp/newkey
gpg static/fedora.gpg # used to verify the new keyring
# it should look something like this:
# pub  4096R/57BBCCBA 2009-07-29 Fedora (12) <fedora@fedoraproject.org>
# pub  4096R/E8E40FDE 2010-01-19 Fedora (13) <fedora@fedoraproject.org>
# pub  4096R/97A1071F 2010-07-23 Fedora (14) <fedora@fedoraproject.org>
# pub  1024D/217521F6 2007-03-02 Fedora EPEL <epel@fedoraproject.org>
# sub  2048g/B6610DAF 2007-03-02 [expires: 2017-02-27]
# it must only have the two supported versions of fedora, rawhide and EPEL
# also verify that static/$NEWKEY.txt exists
$EDITOR data/content/{keys,verify}.html # see git diff 1840f96~ 1840f96
</pre>
 
== sigulsign_unsigned ==
sigulsign_unsigned is the script Release Engineers use to sign content in koji.  This script has a hardcoded list of keys and aliases to the keys that needs to be updated when we create new keys.


Add the key details to the <code>KEYS</code> dictionary near the top of the <code>sigulsign_unsigned.py</code> script.  It lives in Release Engineering's git repo at <code>git://git.fedorahosted.org/git/releng</code> in the <code>scripts</code> directory. You will need to know the key ID to insert the correct information:
=== Test ===
<pre>
$ gpg <key block from sigul get-public-key>
</pre>


== Public Keyservers ==
Pour tester l'interfaçage, on va obtenir un RPM depuis <class>Koji</class>, le signer et le sauvegarder dans le répertoire de travail actuel. c'est juste pour tester la connxion et l'authentification sur <class>Koji</class> et <class>Sigul</class>.
We upload the key to the public key servers when we create the keys. To do this, we need to get the ascii key block from sigul, determine the key ID, import they key into our local keyring, and then upload it to the key servers.
<syntaxhighlight lang="bash">sigul sign-rpm -o signed.rpm key_name unsigned.rpm</syntaxhighlight>


<pre>
Si la commande précédente fonctionne, un RPM signé est présent dans le répertoire de travail actuel.
$ sigul get-public-key fedora-13 > fedora-13
$ gpg fedora-13 (The ID is the "E8E40FDE" part of 4096R/E8E40FDE)
$ gpg --import fedora-13
$ gpg --send-keys E8E40FDE
</pre>


== Mash ==
On vérifie sa signature
Mash is the tool that composes our nightly trees, and as such it needs to know about the new key.  This currently is done by checking mash out from git, editing the rawhide.mash file and sending the patch to the mash upstream.
<syntaxhighlight lang="bash">rpm --checksig signed.rpm</syntaxhighlight>


<pre>
== Script sigulsign_unsigned.py ==
$ git clone git://git.fedorahosted.org/git/mash
$ cd mash
$ vim configs/rawhide.mash
<add key to front of keys = line>
$ git commit -m 'Add new key'
$ git send-email --to notting@redhat.com HEAD^
</pre>


Coordinate with Bill Nottingham to get a new build of mash done with the change.
Le script est à récupérer depuis un depôt releng de Fedora via git (git://git.fedorahosted.org/git/releng) ou directement depuis https://git.fedorahosted.org/cgit/releng/tree/scripts/sigulsign_unsigned.py


== Koji ==
Avant de pouvoir utiliser ce script magique qui va signer tous les RPM non-signés (derniers m-v-r) construit dans le Koji, il est nécessaire de modifier quelques variables:
Koji has a garbage collection utility that will find builds that meet criteria to be removed to save space.  Part of that criteria has to do with whether or not the build has been signed with a key.  If the collection utility doesn't know about a key it will ignore the build.  Thus as we create new keys we need to inform the utility of these keys or else builds can pile up. The configuration for the garbage collection lives within puppet.
* Changer l'URL du HUB Koji (2 fois): KOJIHUB
* Spécifier nos propres fichiers de certificats: SERVERCA, CLIENTCA, CLIENTCERT
* Ajout de nos clés de signature: KEYS
{{Admon/warning|Casse de l'ID dans le script sigulsign_unsigned.py|GPG rapporte un ID écrit en majuscule mais dans le script, celui-ci doit être renseigné en minuscule pour que le processus fonctionne.}}


On the puppet server in a clone edit the configs/build/koji-gc.conf file:
Pour obtenir l'ID de nos clés:
* exporter de la clé<pre>sigul get-public-key centos-5-key > centos-5-key.asc</pre>
* importer dans GPG<pre>gpg --import centos-5-key.asc</pre>
* Lister nos clé GPG<pre>gpg --list-keys</pre>
<pre>
<pre>
diff --git a/configs/build/koji-gc.conf b/configs/build/koji-gc.conf
/root/.gnupg/pubring.gpg
index 8b14704..042ec35 100644
------------------------
--- a/configs/build/koji-gc.conf
pub  1024D/773DF357 2013-08-20
+++ b/configs/build/koji-gc.conf
uid                  CentOS-5-B2PWeb (CentOS 5 B2PWeb Signing Key) <srs@b2pweb.com>
@@ -11,6 +11,7 @@ key_aliases =
sub  2048g/EBC96FF2 2013-08-20
    4EBFC273    fedora-10
</pre>
    D22E77F2    fedora-11
L'ID de notre clé '''centos-5-key''' est 773DF357
    57BBCCBA    fedora-12
<syntaxhighlight lang="diff">
+   217521F6    fedora-epel
Change koji hostname, certificate files and add B2PWeb signing keys
diff -u a/sigulsign_unsigned.py b/sigulsign_unsigned.py
--- a/sigulsign_unsigned.py 2013-08-21 10:05:57.418032284 +0200
+++ b/sigulsign_unsigned.py 2013-08-21 10:13:11.683976970 +0200
@@ -38,11 +38,11 @@ rpmdict = {}
unsigned = []
loglevel = ''
passphrase = ''
-KOJIHUB = 'https://koji.fedoraproject.org/kojihub'
+KOJIHUB = 'http://koji.b2pweb.com/kojihub'
# Should probably set these from a koji config file
-SERVERCA = os.path.expanduser('~/.fedora-server-ca.cert')
-CLIENTCA = os.path.expanduser('~/.fedora-upload-ca.cert')
-CLIENTCERT = os.path.expanduser('~/.fedora.cert')
+SERVERCA = os.path.expanduser('~/.koji/serverca.crt')
+CLIENTCA = os.path.expanduser('~/.koji/clientca.crt')
+CLIENTCERT = os.path.expanduser('~/.koji/client.pem')
# Setup a dict of our key names as sigul knows them to the actual key ID
# that koji would use.  We should get this from sigul somehow.
KEYS = {'fedora-12-sparc': {'id': 'b3eb779b', 'v3': True},
@@ -67,7 +67,9 @@ KEYS = {'fedora-12-sparc': {'id': 'b3eb7
        'fedora-10': {'id': '4ebfc273', 'v3': False},
        'fedora-10-testing': {'id': '0b86274e', 'v3': False},
        'epel-6': {'id': '0608b895', 'v3': True},
-        'epel-5': {'id': '217521f6', 'v3': False}}
+        'epel-5': {'id': '217521f6', 'v3': False},
+        'centos-5-key' : {'id': '773df357', 'v3': True},
+       'centos-6-key' : {'id': 'd3f3c56a', 'v3': True}}
   
   
  unprotected_keys =
  def exit(status):
     fedora-test
     """End the program using status, report any errors"""
@@ -21,6 +22,7 @@ unprotected_keys =
@@ -213,7 +215,7 @@ if not (opts.just_list or opts.just_writ
    fedora-12
    fedora-extras
    redhat-beta
+    fedora-epel
   
   
  server = https://koji.fedoraproject.org/kojihub
  # Reset the KOJIHUB if the target is a secondary arch
weburl = http://koji.fedoraproject.org/koji
if opts.arch:
@@ -38,6 +40,7 @@ policy =
-    KOJIHUB = 'http://%s.koji.fedoraproject.org/kojihub' % opts.arch
    sig fedora-10 && age < 12 weeks :: keep
+    KOJIHUB = 'http://%s.koji.b2pweb.com/kojihub' % opts.arch
    sig fedora-11 && age < 12 weeks :: keep
  # setup the koji session
    sig fedora-12 && age < 12 weeks :: keep
logging.info('Setting up koji session')
+    sig fedora-epel && age < 12 weeks :: keep
kojisession = koji.ClientSession(KOJIHUB)
   
</syntaxhighlight>
    #stuff to chuck semi-rapidly
    tag *-testing *-candidate *-override && order >= 2 :: untag
</pre>
In this case the fedora-epel key was added to the list of key aliases, then referenced in the list of unprotected_keys, and finally a policy was created for how long to keep builds signed with this key.
 
Once you've made your change commit and push.  The buildsystem will pick up this change the next time puppet refreshes.
 
= Verification =
We can verify that the key was created in sigul, the correct users have access to the key, the key was added to the fedora-release package, that the website was updated with the right key, that sigulsign_unsigned was properly updated, and that the key was successfully updated to the public key servers.
 
== sigul ==
Use the <code>list-keys</code> command to verify that the key was indeed added to sigul:
<pre>
$ sigul list-keys
Administrator's password:
fedora-10
fedora-10-testing
fedora-11
fedora-12
fedora-13
</pre>
Our new key should be on the list.  This command expects <b>your</b> administrative password.


Use the <code>list-key-users</code> command to verify all the signers have access:
=== Signature d'un ou plusieurs paquets ===
<pre>
$ sigul list-key-users fedora-13
Key passphrase:
jkeating
jwboyer
</pre>
This command expects <b>your</b> key passphrase for the key in question.
 
== fedora-release ==
To verify that the key was added to this package correctly, download the latest build from koji and run rpm2cpio on it, then run gpg on the key file:
 
<pre>
$ koji download-build --arch noarch --latest dist-f13 fedora-release
fedora-release.noarch                                  |  39 kB    00:00 ...
 
$ rpm2cpio fedora-release-13-0.3.noarch.rpm |cpio -ivd
./etc/fedora-release
./etc/issue
./etc/issue.net
./etc/pki/rpm-gpg
./etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
./etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-13-primary
./etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386
./etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-ppc
./etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-ppc64
./etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64
./etc/redhat-release
./etc/rpm/macros.dist
./etc/system-release
./etc/system-release-cpe
./etc/yum.repos.d
./etc/yum.repos.d/fedora-rawhide.repo
./etc/yum.repos.d/fedora-updates-testing.repo
./etc/yum.repos.d/fedora-updates.repo
./etc/yum.repos.d/fedora.repo
./usr/share/doc/fedora-release-13
./usr/share/doc/fedora-release-13/GPL
57 blocks
 
$ gpg etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-13-primary
pub  4096R/E8E40FDE 2010-01-19 Fedora (13) <fedora@fedoraproject.org>
</pre>
You may wish to do this in a tempoary directory to make cleaning it up easy.
 
== fedoraproject.org ==
One can simply browse to http://fedoraproject.org/keys to verify that the key has been uploaded.
 
== sigulsign_unsigned ==
The best way to test whether or not the key has been added correctly is to sign a package using the key, like our newly built fedora-release package.
 
<pre>
$ ./sigulsign_unsigned.py fedora-13 fedora-release-13-0.3
Passphrase for fedora-13:
</pre>
The command should exit cleanly.
 
== Public key servers ==
One can use the <code>search-keys</code> command from gpg to locate the key on the public server:
<pre>
$ gpg --search-keys "Fedora (13)"
gpg: searching for "Fedora (13)" from hkp server subkeys.pgp.net
(1) Fedora (13) <fedora@fedoraproject.org>
      4096 bit RSA key E8E40FDE, created: 2010-01-19
...
</pre>


== Koji ==
C'est utile afin de signer des paquets qui ne sont pas les derniers construits (dernier N-V-R)
Log into koji01 by way of gateway.fedoraproject.org.
<syntaxhighlight lang="bash">
sigulsign_unsigned.py -v --password="motdepasse" --inherit centos-6-key <N-V-R>
</syntaxhighlight>


Verify that /etc/koji-gc/koji-gc.conf has the new key in it.
exemple:


[[Category:Release Engineering SOPs]]
<syntaxhighlight lang="bash">
sigulsign_unsigned.py -v --password="$(cat /root/.sigul/centos-6-key)" --inherit centos-6-key appliance-tools-007.0-1.el6
</syntaxhighlight>

Dernière version du 23 avril 2015 à 08:53

Sigul

après une installation de Sigul, on peut l'utiliser.

Note.png
Commandes disponible
$ sigul --help-commands
delete-key          Delete a key
modify-key-user     Modify user's key access
list-users          List users
grant-key-access    Grant key access to a user
sign-text           Output a cleartext signature of a text
import-key          Import a key
new-user            Add a user
sign-rpm            Sign a RPM
list-keys           List keys
sign-data           Create a detached signature
revoke-key-access   Revoke key acess from a user
user-info           Show information about a user
change-passphrase   Change key passphrase
list-key-users      List users that can access a key
new-key             Add a key
modify-user         Modify a user
sign-rpms           Sign one or more RPMs
modify-key          Modify a key
delete-user         Delete a user
key-user-info       Show information about user's key access
get-public-key      Output public part of the key

Créer une nouvelle clé

Une fois le client Sigul capable d'envoyer des commandes à <class>Sigul</class>, on peut créer une nouvelle clé nommée centos-5-key.

sigul new-key --name-real='CentOS-5-B2PWeb' --name-comment='CentOS 5 B2PWeb Signing Key' --name-email='srs@b2pweb.com' --key-admin root centos-5-key
Note.png
Générer beaucoup d'entropie durant le génération de la clé
La génération de la clé nécessite beaucoup d'entropie sur le serveur Sigul. On peut donc occuper le serveur et paradoxalement accélerer la génération de la clé.

La commande suivant génère assez d'entropie pour 2 minutes:

find / > /dev/null 2>&1
$ sigul new-key --help
usage: client.py new-key [options] key

Add a key

options:
  -h, --help            show this help message and exit
  --key-admin=USER      Initial key administrator
  --name-real=NAME_REAL
                        Real name of key subject
  --name-comment=NAME_COMMENT
                        A comment about of key subject
  --name-email=NAME_EMAIL
                        E-mail of key subject
  --expire-date=YYYY-MM-DD
                        Key expiration date

Import d'une clé existante

sigul import-key 'CentOS-5-B2PWeb' ~/.gnupg/secring.gpg

Changer le nom de la clé

Changer le nom de la clé centos5 en centos-5-key

sigul modify-key --new-name centos-5-key centos5

Ajout d'un utilisateur

  • Ajout d'un utilisateur administrateur
    sigul new-user --admin --with-password didier

Autoriser l'utilisation d'une clé existante à un utilisateur

sigul grant-key-access centos-5-key didier
sigul grant-key-access --help
usage: client.py grant-key-access key user

Grant key access to a user

options:
  -h, --help  show this help message and exit

Modifier la phrase de passe

sigul change-passphrase centos-5-key
sigul change-passphrase --help
usage: client.py change-passphrase key

Change key passphrase

options:
  -h, --help  show this help message and exit

FAQ

FaqQuestion.png
ERROR: I/O error: Unexpected EOF in NSPR
  • S'assurer que le répertoire des clés existe. Ce chemin est déclaré dans le fichier <path>/etc/sigul/server.conf</path>
    gnupg-home: /var/lib/sigul/server/gnupg
    • Propriétaire: sigul
    • Groupe: sigul
    • Droits: 0700 rwx------
    • Lien symbolique /var/lib/sigul/gnupg pointant sur <path>/var/lib/sigul/server/gnupg</path>
  • S'assurer qu'il y a suffisamment d'espace disque ( en gros deux fois la taille du plus gros paquet RPM )
  • S'assurer que les daemons sigul_bridge et sigul_server sont démarrés
    service sigul_server status && service sigul_bridge status
  • S'assurer que le pont peut se connecter au serveur ( Configure firewall )


FaqQuestion.png
Error: Unknown error
Vérifier les journaux du serveur, l'erreur est surement plus explicite
  • /usr/bin/rpmsign: No such file or directory
    Il suffit d'installer le paquet <package>rpm-sign</package> qui n'est pas installé par défaut sur centos 7. Un simple yum provides /usr/bin/rpmsign donne le paquet à installer.


FaqQuestion.png
Unknown error on creating key process


FaqQuestion.png
Certificats client expirés
Une fois le certificat client expiré, il faut le désactiver localement
certutil -d ~/.sigul -D -n sigul-client-cert
et refaire une génération de certificat client.

Interfacer Sigul et koji

configuration

<class>Sigul</class> peut être utiliser pour signer un ou de multiples RPMs dans une instance <class>Koji</class>. Une fois le client Sigul correctement configuré, il suffit juste de configurer l'utilisateur Proxy pour Koji. Quand un client <class>Sigul</class> émet une requête de signature pour <class>Koji</class>, le pont <class>Sigul</class> se connecte à <class>Koji</class> en tant qu'utilisateur kojiweb. Il faut juste s'assurer que l'utilisateur demandeur a les droits administrateur sur le <class>Koji</class> et <class>Sigul</class> s'occupe du reste.

La configuration pour <class>Koji</class> peut être situer n'importe où, du moment que l'utilisateur sigul a droit de lecture. Les certificats pour kojiweb doivent être copiés dans le même chemin que la configuration <class>Koji</class>

  • Comme toutes les commandes de cette partie doivent être lancées par l'utilisateur sigul, on va donc devenir cet utilisateur
    su - sigul
    
  • Création du répertoire de configuration de <class>Koji</class>
    mkdir -p ~/.koji
    
  • Copie de la configuration par défaut du client <class>Koji</class>
    cp /etc/koji.conf ~/.koji/config
    
  • Copie des certificats Kojiweb dans celui-ci
    cp /etc/pki/koji/pem/kojiweb.pem .koji/client.pem
    
    cp /etc/pki/koji/kojica.crt .koji/clientca.crt
    
    cp /etc/pki/koji/kojica.crt .koji/serverca.crt
    

Après avoir redémarrer le pont <class>Sigul</class>, le client doit être capable d'obtenir un RPM depuis Koji et de le signer.

Test

Pour tester l'interfaçage, on va obtenir un RPM depuis <class>Koji</class>, le signer et le sauvegarder dans le répertoire de travail actuel. c'est juste pour tester la connxion et l'authentification sur <class>Koji</class> et <class>Sigul</class>.

sigul sign-rpm -o signed.rpm key_name unsigned.rpm

Si la commande précédente fonctionne, un RPM signé est présent dans le répertoire de travail actuel.

On vérifie sa signature

rpm --checksig signed.rpm

Script sigulsign_unsigned.py

Le script est à récupérer depuis un depôt releng de Fedora via git (git://git.fedorahosted.org/git/releng) ou directement depuis https://git.fedorahosted.org/cgit/releng/tree/scripts/sigulsign_unsigned.py

Avant de pouvoir utiliser ce script magique qui va signer tous les RPM non-signés (derniers m-v-r) construit dans le Koji, il est nécessaire de modifier quelques variables:

  • Changer l'URL du HUB Koji (2 fois): KOJIHUB
  • Spécifier nos propres fichiers de certificats: SERVERCA, CLIENTCA, CLIENTCERT
  • Ajout de nos clés de signature: KEYS
Warning.png
Casse de l'ID dans le script sigulsign_unsigned.py
GPG rapporte un ID écrit en majuscule mais dans le script, celui-ci doit être renseigné en minuscule pour que le processus fonctionne.

Pour obtenir l'ID de nos clés:

  • exporter de la clé
    sigul get-public-key centos-5-key > centos-5-key.asc
  • importer dans GPG
    gpg --import centos-5-key.asc
  • Lister nos clé GPG
    gpg --list-keys
/root/.gnupg/pubring.gpg
------------------------
pub   1024D/773DF357 2013-08-20
uid                  CentOS-5-B2PWeb (CentOS 5 B2PWeb Signing Key) <srs@b2pweb.com>
sub   2048g/EBC96FF2 2013-08-20

L'ID de notre clé centos-5-key est 773DF357

Change koji hostname, certificate files and add B2PWeb signing keys
diff -u a/sigulsign_unsigned.py b/sigulsign_unsigned.py
--- a/sigulsign_unsigned.py	2013-08-21 10:05:57.418032284 +0200
+++ b/sigulsign_unsigned.py	2013-08-21 10:13:11.683976970 +0200
@@ -38,11 +38,11 @@ rpmdict = {}
 unsigned = []
 loglevel = ''
 passphrase = ''
-KOJIHUB = 'https://koji.fedoraproject.org/kojihub'
+KOJIHUB = 'http://koji.b2pweb.com/kojihub'
 # Should probably set these from a koji config file
-SERVERCA = os.path.expanduser('~/.fedora-server-ca.cert')
-CLIENTCA = os.path.expanduser('~/.fedora-upload-ca.cert')
-CLIENTCERT = os.path.expanduser('~/.fedora.cert')
+SERVERCA = os.path.expanduser('~/.koji/serverca.crt')
+CLIENTCA = os.path.expanduser('~/.koji/clientca.crt')
+CLIENTCERT = os.path.expanduser('~/.koji/client.pem')
 # Setup a dict of our key names as sigul knows them to the actual key ID
 # that koji would use.  We should get this from sigul somehow.
 KEYS = {'fedora-12-sparc': {'id': 'b3eb779b', 'v3': True},
@@ -67,7 +67,9 @@ KEYS = {'fedora-12-sparc': {'id': 'b3eb7
         'fedora-10': {'id': '4ebfc273', 'v3': False},
         'fedora-10-testing': {'id': '0b86274e', 'v3': False},
         'epel-6': {'id': '0608b895', 'v3': True},
-        'epel-5': {'id': '217521f6', 'v3': False}}
+        'epel-5': {'id': '217521f6', 'v3': False},
+        'centos-5-key' : {'id': '773df357', 'v3': True},
+        'centos-6-key' : {'id': 'd3f3c56a', 'v3': True}}
 
 def exit(status):
     """End the program using status, report any errors"""
@@ -213,7 +215,7 @@ if not (opts.just_list or opts.just_writ
 
 # Reset the KOJIHUB if the target is a secondary arch
 if opts.arch:
-    KOJIHUB = 'http://%s.koji.fedoraproject.org/kojihub' % opts.arch
+    KOJIHUB = 'http://%s.koji.b2pweb.com/kojihub' % opts.arch
 # setup the koji session
 logging.info('Setting up koji session')
 kojisession = koji.ClientSession(KOJIHUB)

Signature d'un ou plusieurs paquets

C'est utile afin de signer des paquets qui ne sont pas les derniers construits (dernier N-V-R)

sigulsign_unsigned.py -v --password="motdepasse" --inherit centos-6-key <N-V-R>

exemple:

sigulsign_unsigned.py -v --password="$(cat /root/.sigul/centos-6-key)" --inherit centos-6-key appliance-tools-007.0-1.el6