1 Use of digital signatures in pkg_install
2 ----------------------------------------
4 (1) pkg_vulnerabilities: list of known vulnerabilities, provided by
5 the pkgsrc security team and updated regulary
6 (2) binary packages: check who provided binary packages
8 For (1) gpg is currently the only choice. After pkgsrcCon (?) a PKCS7
9 signature will be added as well. With the pkg_install-renovation branch,
10 PKCS7 is the only supported verification mechanism for (2) and preferred
11 for (1) once the infrastructure exists.
13 PKCS7 is a format to use RSA public key cryptography with X509
14 certificates. Those are commonly used for SSL. X509 implements a
15 hierachical trust model. For this purpose it means that one or more
16 certificates are installed and marked as trusted. A certificate used for
17 signing a binary package or pkg_vulnerabilities will have to be included
18 in the list to be trusted OR it must be itself signed by a trusted
19 certificate. The original list is called the TRUST ANCHOR.
21 Optionally, a second list of certificates can be provided to fill gaps.
22 Let's assume A is a trust anchor and C is used to sign a package. C
23 itself is not signed by A, so it won't be trusted. Instead, there's a
24 third certificate B; and C includes a signature with B. The certificate
25 chain file can now provide B signed by A. This gives a certificate chain
26 of C -> B (included in the package) -> A (with the chain file) and the
27 signature is valid and trusted.
30 Practical implications for pkgsrc users:
31 - get the pkgsrc-security certificate and point CERTIFICATE_ANCHOR_PKGVULN to it
32 - get the certificate used by your bulk builder and point
33 CERTIFICATE_ANCHOR_PKGS to it
34 - at some later point a CA for pkgsrc might be created, in that case it
35 will serve as certificate for both purposes; a list of all certificates
36 will be provided in that case to point CERTIFICATE_CHAIN to.
39 How to create your own keys:
41 The pkgsrc.sh script and the corresponding pkgsrc.cnf file provide a working
42 wrapper around the OpenSSL command line tool.
44 The root certificate can be created by running "sh pkgsrc.sh setup",
45 the output can found in the pkgsrc subdirectory of the current directory.
46 The meta data is for human beings and displayed e.g. by pkg_add, but not
47 relevant for cryptographic purposes. pkgsrc/newcerts/00.pem is the
48 public key and can be used as trust anchor.
49 A certificate for signing packages can be created by running
50 "sh pkgsrc.sh pkgkey". The private key can be found in pkgkey_key.pem
51 and the certificate in pkgkey_cert.pem.
52 Similary, "sh pkgsrc.sh pkgsec" will create a certificate/key pair for
53 signing pkg-vulnerabilities.
55 How to verify a certificate:
56 - decode the data with "openssl x509 -text -noout -in newcert.pem"
57 - "Issuer" is vouching for the identity (and reliability) of "Subject"
58 - "X509v3 Basic Constraints" should list "CA:FALSE" for all keys that are not allowed