Contents of /trunk/core/rsyslog/rsyslog-5.8.13-r1.smage2
Parent Directory | Revision Log
Revision 13403 -
(show annotations)
(download)
Sat Oct 6 14:09:48 2012 UTC (11 years, 11 months ago) by niro
File size: 4634 byte(s)
Sat Oct 6 14:09:48 2012 UTC (11 years, 11 months ago) by niro
File size: 4634 byte(s)
auto added: ver bump to 5.8.13-r1
1 | # $Id$ |
2 | |
3 | PNAME="rsyslog" |
4 | PVER="5.8.13" |
5 | PBUILD="r1" |
6 | |
7 | PCAT="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.7" |
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 | # disable stop of systemd-kmsg-syslogd.service, as this service file does not exist anymore |
43 | sed -i '/systemd-kmsg-syslogd.service/d' rsyslog.service.in || die |
44 | } |
45 | |
46 | src_compile() |
47 | { |
48 | cd ${SRCDIR} |
49 | |
50 | mconfigure \ |
51 | --with-systemdsystemunitdir=/usr/lib/systemd/system \ |
52 | --enable-largefile \ |
53 | --enable-mail \ |
54 | --enable-imfile \ |
55 | --enable-imtemplate \ |
56 | --enable-zlib \ |
57 | --enable-gnutls \ |
58 | --enable-inet \ |
59 | --disable-gui \ |
60 | --disable-rfc3195 \ |
61 | --disable-mysql \ |
62 | --disable-pgsql \ |
63 | --disable-oracle \ |
64 | --disable-snmp \ |
65 | || die |
66 | |
67 | mmake || die |
68 | } |
69 | |
70 | src_install() |
71 | { |
72 | cd ${SRCDIR} |
73 | |
74 | mmake DESTDIR=${BINDIR} install || die |
75 | minstalldocs AUTHORS COPYING ChangeLog NEWS PORTS README* || die |
76 | |
77 | # rsyslog config |
78 | minstalletc rsyslog.conf || die |
79 | |
80 | # logrotate config |
81 | minstalletc rsyslog.logrotate rsyslog /etc/logrotate.d || die |
82 | |
83 | # conf.d |
84 | minstallconf rsyslog.confd rsyslog || die |
85 | |
86 | # needed directories |
87 | mkeepdir /var/spool/rsyslog || die |
88 | mkeepdir /etc/ssl/rsyslog || die |
89 | mkeepdir /etc/rsyslog.d || die |
90 | } |
91 | |
92 | postinstall() |
93 | { |
94 | local CERTDIR |
95 | local CN |
96 | local TMP=$(mktemp) |
97 | |
98 | # make sure the certificates directory exists |
99 | CERTDIR="${MROOT}/etc/ssl/rsyslog" |
100 | [ ! -d ${CERTDIR} ] && install -d ${CERTDIR} |
101 | echo "Your certificates will be stored in ${CERTDIR}" |
102 | |
103 | # create a default CA if needed |
104 | if [ ! -f ${CERTDIR}/rsyslog_ca.cert.pem ] |
105 | then |
106 | echo "No CA key and certificate found in ${CERTDIR}, creating them for you..." |
107 | certtool --generate-privkey --outfile ${CERTDIR}/rsyslog_ca.privkey.pem &>/dev/null |
108 | chmod 400 ${CERTDIR}/rsyslog_ca.privkey.pem |
109 | |
110 | cat > ${TMP} << EOF |
111 | cn = Portage automated CA |
112 | ca |
113 | cert_signing_key |
114 | expiration_days = 3650 |
115 | EOF |
116 | |
117 | certtool --generate-self-signed \ |
118 | --load-privkey ${CERTDIR}/rsyslog_ca.privkey.pem \ |
119 | --outfile ${CERTDIR}/rsyslog_ca.cert.pem \ |
120 | --template ${TMP} &>/dev/null |
121 | chmod 400 ${CERTDIR}/rsyslog_ca.privkey.pem |
122 | |
123 | # Create the server certificate |
124 | |
125 | # use server-hostname as CN! |
126 | CN="server-$(hostname)" |
127 | echo "Creating private key and certificate for server ${CN}..." |
128 | certtool --generate-privkey --outfile ${CERTDIR}/rsyslog_${CN}.key.pem &>/dev/null |
129 | chmod 400 ${CERTDIR}/rsyslog_${CN}.key.pem |
130 | |
131 | cat > ${TMP} << EOF |
132 | cn = ${CN} |
133 | tls_www_server |
134 | dns_name = ${CN} |
135 | expiration_days = 3650 |
136 | EOF |
137 | |
138 | certtool --generate-certificate \ |
139 | --outfile ${CERTDIR}/rsyslog_${CN}.cert.pem \ |
140 | --load-privkey ${CERTDIR}/rsyslog_${CN}.key.pem \ |
141 | --load-ca-certificate ${CERTDIR}/rsyslog_ca.cert.pem \ |
142 | --load-ca-privkey ${CERTDIR}/rsyslog_ca.privkey.pem \ |
143 | --template ${TMP} &>/dev/null |
144 | chmod 400 ${CERTDIR}/rsyslog_${CN}.cert.pem |
145 | else |
146 | echo "Found existing ${CERTDIR}/rsyslog_ca.cert.pem, skipping CA and SERVER creation." |
147 | fi |
148 | |
149 | # Create a client certificate |
150 | # use client-hostname as CN! |
151 | CN="client-$(hostname)" |
152 | echo "Creating private key and certificate for client ${CN}..." |
153 | certtool --generate-privkey --outfile ${CERTDIR}/rsyslog_${CN}.key.pem &>/dev/null |
154 | chmod 400 ${CERTDIR}/rsyslog_${CN}.key.pem |
155 | |
156 | cat > ${TMP} << EOF |
157 | cn = ${CN} |
158 | tls_www_client |
159 | dns_name = ${CN} |
160 | expiration_days = 3650 |
161 | EOF |
162 | |
163 | certtool --generate-certificate \ |
164 | --outfile ${CERTDIR}/rsyslog_${CN}.cert.pem \ |
165 | --load-privkey ${CERTDIR}/rsyslog_${CN}.key.pem \ |
166 | --load-ca-certificate ${CERTDIR}/rsyslog_ca.cert.pem \ |
167 | --load-ca-privkey ${CERTDIR}/rsyslog_ca.privkey.pem \ |
168 | --template ${TMP} &>/dev/null |
169 | chmod 400 ${CERTDIR}/rsyslog_${CN}.cert.pem |
170 | |
171 | if [ -f ${TMP} ] |
172 | then |
173 | rm -f ${TMP} |
174 | fi |
175 | |
176 | echo |
177 | echo "Here is the documentation on how to encrypt your log traffic:" |
178 | echo " http://www.rsyslog.com/doc/rsyslog_tls.html" |
179 | |
180 | # enable systemd units |
181 | mstartunit rsyslog.service rsyslogd |
182 | } |
183 | |
184 | postremove() |
185 | { |
186 | # disable systemd units |
187 | mstopunit rsyslog.service rsyslogd |
188 | } |