OpenSSL packages for the Testing Environment » History » Version 1
Tobias Brunner, 29.06.2016 16:03
1 | 1 | Tobias Brunner | h1. OpenSSL packages for the Testing Environment |
---|---|---|---|
2 | 1 | Tobias Brunner | |
3 | 1 | Tobias Brunner | The [[TestingEnvironment|testing environment]] uses FIPS-enabled OpenSSL packages based on the original Debian packages. These packages are automatically installed in the root image when the environment is built. |
4 | 1 | Tobias Brunner | |
5 | 1 | Tobias Brunner | The following steps may be used to rebuild the packages. This how-to uses *Ubuntu 14.04*, but it's similar on Debian or other Ubuntu releases. |
6 | 1 | Tobias Brunner | |
7 | 1 | Tobias Brunner | *Note:* This how-to does not exactly follow the "instructions":https://www.openssl.org/docs/fips.html provided by the OpenSSL project. For FIPS compliance these have to be followed to the letter, but we ignore that for our test environment. |
8 | 1 | Tobias Brunner | |
9 | 1 | Tobias Brunner | h2. sbuild |
10 | 1 | Tobias Brunner | |
11 | 1 | Tobias Brunner | The packages are built using "sbuild":https://wiki.debian.org/sbuild in chroot environments managed with "schroot":https://wiki.debian.org/Schroot. This build environment can be installed as follows. |
12 | 1 | Tobias Brunner | |
13 | 1 | Tobias Brunner | <pre> |
14 | 1 | Tobias Brunner | sudo apt-get install sbuild debian-archive-keyring |
15 | 1 | Tobias Brunner | sudo sbuild-createchroot <release> /path/to/chroot http://httpredir.debian.org/debian --keyring=/usr/share/keyrings/debian-archive-keyring.gpg |
16 | 1 | Tobias Brunner | </pre> |
17 | 1 | Tobias Brunner | |
18 | 1 | Tobias Brunner | _<release>_ is e.g. _jessie_. On Ubuntu 14.04 the line @profile=sbuild@ has to get removed from the file @/etc/schroot/chroot.d/<release>-amd64-sbuild-XXXX@, otherwise entering the chroot won't work correctly. |
19 | 1 | Tobias Brunner | |
20 | 1 | Tobias Brunner | The following command provides a list of all schroot environments: |
21 | 1 | Tobias Brunner | |
22 | 1 | Tobias Brunner | <pre> |
23 | 1 | Tobias Brunner | sudo schroot -l |
24 | 1 | Tobias Brunner | </pre> |
25 | 1 | Tobias Brunner | |
26 | 1 | Tobias Brunner | A schroot environment may be entered with: |
27 | 1 | Tobias Brunner | |
28 | 1 | Tobias Brunner | <pre> |
29 | 1 | Tobias Brunner | sudo schroot -c <release>-amd64-sbuild |
30 | 1 | Tobias Brunner | </pre> |
31 | 1 | Tobias Brunner | |
32 | 1 | Tobias Brunner | To self-sign the binary packages a key pair has to be generated with: |
33 | 1 | Tobias Brunner | |
34 | 1 | Tobias Brunner | <pre> |
35 | 1 | Tobias Brunner | sudo sbuild-update --keygen |
36 | 1 | Tobias Brunner | </pre> |
37 | 1 | Tobias Brunner | |
38 | 1 | Tobias Brunner | h2. OpenSSL FIPS canister |
39 | 1 | Tobias Brunner | |
40 | 1 | Tobias Brunner | Before the package can be built the FIPS canister has to be built and installed in the schroot environment created above. |
41 | 1 | Tobias Brunner | |
42 | 1 | Tobias Brunner | <pre> |
43 | 1 | Tobias Brunner | mkdir -p ~/openssl-fips/canister |
44 | 1 | Tobias Brunner | cd ~/openssl-fips/canister |
45 | 1 | Tobias Brunner | wget http://www.openssl.org/source/openssl-fips-x.x.x.tar.gz |
46 | 1 | Tobias Brunner | tar xf openssl-fips-x.x.x.tar.gz |
47 | 1 | Tobias Brunner | cd openssl-fips-x.x.x/ |
48 | 1 | Tobias Brunner | sudo schroot -c <release>-amd64-sbuild |
49 | 1 | Tobias Brunner | </pre> |
50 | 1 | Tobias Brunner | |
51 | 1 | Tobias Brunner | Then in the schroot: |
52 | 1 | Tobias Brunner | <pre> |
53 | 1 | Tobias Brunner | # ./config |
54 | 1 | Tobias Brunner | # make install |
55 | 1 | Tobias Brunner | # logout |
56 | 1 | Tobias Brunner | </pre> |
57 | 1 | Tobias Brunner | |
58 | 1 | Tobias Brunner | |
59 | 1 | Tobias Brunner | |
60 | 1 | Tobias Brunner | h2. FIPS-enabled OpenSSL |
61 | 1 | Tobias Brunner | |
62 | 1 | Tobias Brunner | The sources for the current packages can easily be obtained using the corresponding ".dsc file":https://wiki.debian.org/dsc from Debian's "package tracker":https://packages.qa.debian.org/o/openssl.html. |
63 | 1 | Tobias Brunner | |
64 | 1 | Tobias Brunner | <pre> |
65 | 1 | Tobias Brunner | mkdir -p ~/openssl-fips/openssl |
66 | 1 | Tobias Brunner | cd ~/openssl-fips/openssl |
67 | 1 | Tobias Brunner | dget -u http://http.debian.net/debian/pool/main/o/openssl/openssl_xxx.dsc |
68 | 1 | Tobias Brunner | cd openssl-xxx/ |
69 | 1 | Tobias Brunner | </pre> |
70 | 1 | Tobias Brunner | |
71 | 1 | Tobias Brunner | To build the packages with FIPS support the @debian/rules@ file has to be modified: |
72 | 1 | Tobias Brunner | |
73 | 1 | Tobias Brunner | * Add _fips_ and _no-speed_ to @CONFARGS@. _no-speed_ is required because the @speed@ utility somehow does not link to the FIPS-enabled library and then does not find some symbols during the package build. Unfortunately, the @speed.c@ source file is not actually able to follow the @OPENSSL_NO_SPEED@ option, so a patch is required. In order to build a proper source package this has to be done with quilt (see below). |
74 | 1 | Tobias Brunner | * Remove all @make test@ calls as these test stuff that is disabled in FIPS mode. |
75 | 1 | Tobias Brunner | |
76 | 1 | Tobias Brunner | To patch the speed utility quilt is required: |
77 | 1 | Tobias Brunner | |
78 | 1 | Tobias Brunner | <pre> |
79 | 1 | Tobias Brunner | sudo apt-get install quilt |
80 | 1 | Tobias Brunner | export QUILT_PATCHES=debian/patches |
81 | 1 | Tobias Brunner | export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" |
82 | 1 | Tobias Brunner | quilt new speed-opensslconf.patch |
83 | 1 | Tobias Brunner | quilt add apps/speed.c |
84 | 1 | Tobias Brunner | </pre> |
85 | 1 | Tobias Brunner | |
86 | 1 | Tobias Brunner | Add the following in @apps/speed.c@ right before the @#ifndef OPENSSL_NO_SPEED@ line. So it looks like this: |
87 | 1 | Tobias Brunner | <pre> |
88 | 1 | Tobias Brunner | #include <openssl/opensslconf.h> |
89 | 1 | Tobias Brunner | #ifndef OPENSSL_NO_SPEED |
90 | 1 | Tobias Brunner | </pre> |
91 | 1 | Tobias Brunner | |
92 | 1 | Tobias Brunner | Update the patch: |
93 | 1 | Tobias Brunner | <pre> |
94 | 1 | Tobias Brunner | quilt refresh |
95 | 1 | Tobias Brunner | </pre> |
96 | 1 | Tobias Brunner | |
97 | 1 | Tobias Brunner | To update the changelog use the following (the values are examples, i.e. what we currently use): |
98 | 1 | Tobias Brunner | |
99 | 1 | Tobias Brunner | <pre> |
100 | 1 | Tobias Brunner | export DEBFULLNAME="strongSwan Testing" |
101 | 1 | Tobias Brunner | export DEBEMAIL=debian@strongswan.org |
102 | 1 | Tobias Brunner | dch --local strongswan --distribution <release> |
103 | 1 | Tobias Brunner | </pre> |
104 | 1 | Tobias Brunner | |
105 | 1 | Tobias Brunner | The version number doesn't really matter as the local repository is pinned in the testing environment so even if there is a newer version in the main repository our version should get installed. But it could still get set to a value that is always higher than minor revisions of the packages (e.g. instead of @1.0.1e-2+deb7u17@ use @1.0.1e-strongswan1~2+deb7u17@). |
106 | 1 | Tobias Brunner | |
107 | 1 | Tobias Brunner | Now a new source package may be built: |
108 | 1 | Tobias Brunner | |
109 | 1 | Tobias Brunner | <pre> |
110 | 1 | Tobias Brunner | debuild --no-lintian -S -sa -us -uc -I -i |
111 | 1 | Tobias Brunner | cd .. |
112 | 1 | Tobias Brunner | </pre> |
113 | 1 | Tobias Brunner | |
114 | 1 | Tobias Brunner | Based on that the binary packages can be built using sbuild: |
115 | 1 | Tobias Brunner | |
116 | 1 | Tobias Brunner | <pre> |
117 | 1 | Tobias Brunner | sudo sbuild -d <release> openssl_xxx-strongswan1-xxx.dsc |
118 | 1 | Tobias Brunner | </pre> |
119 | 1 | Tobias Brunner | |
120 | 1 | Tobias Brunner | h2. APT Repository |
121 | 1 | Tobias Brunner | |
122 | 1 | Tobias Brunner | "Our custom repository"://download.strongswan.org/testing/repos/ is currently managed with @reprepro@. To add the new binary packages something like the following may be used: |
123 | 1 | Tobias Brunner | |
124 | 1 | Tobias Brunner | <pre> |
125 | 1 | Tobias Brunner | reprepro -b /path/to/debian/repo includedeb <release> <debfile> |
126 | 1 | Tobias Brunner | </pre> |