Contents of /branches/magellan-next/core/rsyslog/rsyslog-5.8.4-r2.smage2
Parent Directory | Revision Log
Revision 8969 -
(show annotations)
(download)
Fri Aug 26 19:25:15 2011 UTC (12 years, 9 months ago) by niro
File size: 4419 byte(s)
Fri Aug 26 19:25:15 2011 UTC (12 years, 9 months ago) by niro
File size: 4419 byte(s)
-dropped SysV support
1 | # $Id$ |
2 | |
3 | PNAME="rsyslog" |
4 | PVER="5.8.4" |
5 | PBUILD="r2" |
6 | |
7 | PCATEGORIE="app-admin" |
8 | |
9 | DESCRIPTION="An enhanced multi-threaded syslog daemon with a focus on security and reliability." |
10 | HOMEPAGE="http://www.rsyslog.com/" |
11 | |
12 | DEPEND=">= app-admin/logrotate-3.8 |
13 | >= app-crypt/gnutls-2.12 |
14 | >= sys-libs/zlib-1.2.5" |
15 | |
16 | PROVIDE="virtual/syslog" |
17 | |
18 | SRCFILE="${PNAME}-${PVER}.tar.gz" |
19 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
20 | |
21 | sminclude mbuild mtools |
22 | |
23 | SRC_URI=( |
24 | http://www.rsyslog.com/files/download/${PNAME}/${SRCFILE} |
25 | mirror://${PNAME}/${SRCFILE} |
26 | mirror://${PNAME}/rsyslog.conf |
27 | mirror://${PNAME}/rsyslog.logrotate |
28 | mirror://${PNAME}/rsyslog.confd |
29 | mirror://${PNAME}/${PNAME}-5.8.1-systemd.patch |
30 | ) |
31 | |
32 | UP2DATE="updatecmd ${HOMEPAGE}/download/ | grep 'stable' | grep 'Download file' | sed 's:.*\:\ rsyslog\ \(.*\)\ (.*:\1:;q'" |
33 | |
34 | src_prepare() |
35 | { |
36 | munpack ${SRCFILE} || die |
37 | cd ${SRCDIR} |
38 | |
39 | # support /etc/conf.d/rsyslog in systemd units |
40 | mpatch ${PNAME}-5.8.1-systemd.patch || die |
41 | } |
42 | |
43 | src_compile() |
44 | { |
45 | cd ${SRCDIR} |
46 | |
47 | mconfigure \ |
48 | --with-systemdsystemunitdir=/lib/systemd/system \ |
49 | --enable-largefile \ |
50 | --enable-mail \ |
51 | --enable-imfile \ |
52 | --enable-imtemplate \ |
53 | --enable-zlib \ |
54 | --enable-gnutls \ |
55 | --enable-inet \ |
56 | --disable-gui \ |
57 | --disable-rfc3195 \ |
58 | --disable-mysql \ |
59 | --disable-pgsql \ |
60 | --disable-oracle \ |
61 | --disable-snmp \ |
62 | || die |
63 | |
64 | mmake || die |
65 | } |
66 | |
67 | src_install() |
68 | { |
69 | cd ${SRCDIR} |
70 | |
71 | mmake DESTDIR=${BINDIR} install || die |
72 | minstalldocs AUTHORS COPYING ChangeLog NEWS PORTS README* || die |
73 | |
74 | # rsyslog config |
75 | minstalletc rsyslog.conf || die |
76 | |
77 | # logrotate config |
78 | minstalletc rsyslog.logrotate rsyslog /etc/logrotate.d || die |
79 | |
80 | # needed directories |
81 | mkeepdir /var/spool/rsyslog || die |
82 | mkeepdir /etc/ssl/rsyslog || die |
83 | mkeepdir /etc/rsyslog.d || die |
84 | } |
85 | |
86 | postinstall() |
87 | { |
88 | local CERTDIR |
89 | local CN |
90 | local TMP=$(mktemp) |
91 | |
92 | # make sure the certificates directory exists |
93 | CERTDIR="${MROOT}/etc/ssl/rsyslog" |
94 | [ ! -d ${CERTDIR} ] && install -d ${CERTDIR} |
95 | echo "Your certificates will be stored in ${CERTDIR}" |
96 | |
97 | # create a default CA if needed |
98 | if [ ! -f ${CERTDIR}/rsyslog_ca.cert.pem ] |
99 | then |
100 | echo "No CA key and certificate found in ${CERTDIR}, creating them for you..." |
101 | certtool --generate-privkey --outfile ${CERTDIR}/rsyslog_ca.privkey.pem &>/dev/null |
102 | chmod 400 ${CERTDIR}/rsyslog_ca.privkey.pem |
103 | |
104 | cat > ${TMP} << EOF |
105 | cn = Portage automated CA |
106 | ca |
107 | cert_signing_key |
108 | expiration_days = 3650 |
109 | EOF |
110 | |
111 | certtool --generate-self-signed \ |
112 | --load-privkey ${CERTDIR}/rsyslog_ca.privkey.pem \ |
113 | --outfile ${CERTDIR}/rsyslog_ca.cert.pem \ |
114 | --template ${TMP} &>/dev/null |
115 | chmod 400 ${CERTDIR}/rsyslog_ca.privkey.pem |
116 | |
117 | # Create the server certificate |
118 | |
119 | # use server-hostname as CN! |
120 | CN="server-$(hostname)" |
121 | echo "Creating private key and certificate for server ${CN}..." |
122 | certtool --generate-privkey --outfile ${CERTDIR}/rsyslog_${CN}.key.pem &>/dev/null |
123 | chmod 400 ${CERTDIR}/rsyslog_${CN}.key.pem |
124 | |
125 | cat > ${TMP} << EOF |
126 | cn = ${CN} |
127 | tls_www_server |
128 | dns_name = ${CN} |
129 | expiration_days = 3650 |
130 | EOF |
131 | |
132 | certtool --generate-certificate \ |
133 | --outfile ${CERTDIR}/rsyslog_${CN}.cert.pem \ |
134 | --load-privkey ${CERTDIR}/rsyslog_${CN}.key.pem \ |
135 | --load-ca-certificate ${CERTDIR}/rsyslog_ca.cert.pem \ |
136 | --load-ca-privkey ${CERTDIR}/rsyslog_ca.privkey.pem \ |
137 | --template ${TMP} &>/dev/null |
138 | chmod 400 ${CERTDIR}/rsyslog_${CN}.cert.pem |
139 | else |
140 | echo "Found existing ${CERTDIR}/rsyslog_ca.cert.pem, skipping CA and SERVER creation." |
141 | fi |
142 | |
143 | # Create a client certificate |
144 | # use client-hostname as CN! |
145 | CN="client-$(hostname)" |
146 | echo "Creating private key and certificate for client ${CN}..." |
147 | certtool --generate-privkey --outfile ${CERTDIR}/rsyslog_${CN}.key.pem &>/dev/null |
148 | chmod 400 ${CERTDIR}/rsyslog_${CN}.key.pem |
149 | |
150 | cat > ${TMP} << EOF |
151 | cn = ${CN} |
152 | tls_www_client |
153 | dns_name = ${CN} |
154 | expiration_days = 3650 |
155 | EOF |
156 | |
157 | certtool --generate-certificate \ |
158 | --outfile ${CERTDIR}/rsyslog_${CN}.cert.pem \ |
159 | --load-privkey ${CERTDIR}/rsyslog_${CN}.key.pem \ |
160 | --load-ca-certificate ${CERTDIR}/rsyslog_ca.cert.pem \ |
161 | --load-ca-privkey ${CERTDIR}/rsyslog_ca.privkey.pem \ |
162 | --template ${TMP} &>/dev/null |
163 | chmod 400 ${CERTDIR}/rsyslog_${CN}.cert.pem |
164 | |
165 | if [ -f ${TMP} ] |
166 | then |
167 | rm -f ${TMP} |
168 | fi |
169 | |
170 | echo |
171 | echo "Here is the documentation on how to encrypt your log traffic:" |
172 | echo " http://www.rsyslog.com/doc/rsyslog_tls.html" |
173 | |
174 | # enable systemd units |
175 | mstartunit rsyslog.service rsyslogd |
176 | } |
177 | |
178 | postremove() |
179 | { |
180 | # disable systemd units |
181 | mstopunit rsyslog.service rsyslogd |
182 | } |