| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ssl-cert.eclass,v 1.3 2004/04/11 05:46:09 mr_bones_ Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ssl-cert.eclass,v 1.9 2005/07/11 15:08:06 swegener Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Max Kalika <max@gentoo.org> |
5 | # Author: Max Kalika <max@gentoo.org> |
| 6 | # |
6 | # |
| 7 | # This eclass implements standard installation procedure for installing |
7 | # This eclass implements standard installation procedure for installing |
| 8 | # self-signed SSL certificates. |
8 | # self-signed SSL certificates. |
| 9 | |
|
|
| 10 | ECLASS=ssl-cert |
|
|
| 11 | INHERITED="$INHERITED $ECLASS" |
|
|
| 12 | |
9 | |
| 13 | # Conditionally depend on OpenSSL: allows inheretence |
10 | # Conditionally depend on OpenSSL: allows inheretence |
| 14 | # without pulling extra packages if not needed |
11 | # without pulling extra packages if not needed |
| 15 | DEPEND="ssl? ( dev-libs/openssl )" |
12 | DEPEND="ssl? ( dev-libs/openssl )" |
|
|
13 | IUSE="ssl" |
| 16 | |
14 | |
| 17 | # Initializes variables and generates the needed |
15 | # Initializes variables and generates the needed |
| 18 | # OpenSSL configuration file and a CA serial file |
16 | # OpenSSL configuration file and a CA serial file |
| 19 | # |
17 | # |
| 20 | # Access: private |
18 | # Access: private |
| 21 | gen_cnf() { |
19 | gen_cnf() { |
| 22 | # Location of the config file |
20 | # Location of the config file |
| 23 | SSL_CONF="${T}/${$}ssl.cnf" |
21 | SSL_CONF="${T}/${$}ssl.cnf" |
| 24 | # Location of the CA serial file |
22 | # Location of the CA serial file |
| 25 | SSL_SERIAL="${T}/${$}ca.ser" |
23 | SSL_SERIAL="${T}/${$}ca.ser" |
| 26 | # Location of some random files OpenSSL can use: don't use |
24 | # Location of some random files OpenSSL can use: don't use |
| 27 | # /dev/u?random here -- doesn't work properly on all platforms |
25 | # /dev/u?random here -- doesn't work properly on all platforms |
| 28 | SSL_RANDOM="${T}/evironment:${T}/eclass-debug.log:/etc/resolv.conf" |
26 | SSL_RANDOM="${T}/environment:${T}/eclass-debug.log:/etc/resolv.conf" |
| 29 | |
27 | |
| 30 | # These can be overridden in the ebuild |
28 | # These can be overridden in the ebuild |
| 31 | SSL_DAYS="${SSL_BITS:-730}" |
29 | SSL_DAYS="${SSL_BITS:-730}" |
| 32 | SSL_BITS="${SSL_BITS:-1024}" |
30 | SSL_BITS="${SSL_BITS:-1024}" |
| 33 | SSL_COUNTRY="${SSL_COUNTRY:-US}" |
31 | SSL_COUNTRY="${SSL_COUNTRY:-US}" |
| … | |
… | |
| 56 | OU = ${SSL_UNIT} |
54 | OU = ${SSL_UNIT} |
| 57 | CN = ${SSL_COMMONNAME} |
55 | CN = ${SSL_COMMONNAME} |
| 58 | emailAddress = ${SSL_EMAIL} |
56 | emailAddress = ${SSL_EMAIL} |
| 59 | EOF |
57 | EOF |
| 60 | eend $? |
58 | eend $? |
| 61 | |
59 | |
| 62 | return $? |
60 | return $? |
| 63 | } |
61 | } |
| 64 | |
62 | |
| 65 | # Simple function to determine whether we're creating |
63 | # Simple function to determine whether we're creating |
| 66 | # a CA (which should only be done once) or final part |
64 | # a CA (which should only be done once) or final part |