Line 0
Link Here
|
|
|
1 |
# Copyright 1999-2014 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: $ |
4 |
|
5 |
EAPI=5 |
6 |
AUTOTOOLS_AUTORECONF=1 |
7 |
|
8 |
inherit autotools-utils eutils systemd |
9 |
|
10 |
DESCRIPTION="An enhanced multi-threaded syslogd with database support and more" |
11 |
HOMEPAGE="http://www.rsyslog.com/" |
12 |
SRC_URI=" |
13 |
http://www.rsyslog.com/files/download/${PN}/${P}.tar.gz |
14 |
doc? ( http://www.rsyslog.com/files/download/${PN}/${PN}-doc-${PV}.tar.gz ) |
15 |
" |
16 |
|
17 |
LICENSE="GPL-3 LGPL-3 Apache-2.0" |
18 |
KEYWORDS="~amd64 ~arm ~hppa ~x86" |
19 |
SLOT="0" |
20 |
IUSE="dbi debug doc elasticsearch +gcrypt jemalloc kerberos mongodb mysql normalize omudpspoof oracle postgres rabbitmq redis relp rfc3195 rfc5424hmac snmp ssl systemd usertools zeromq" |
21 |
|
22 |
RDEPEND=" |
23 |
>=dev-libs/json-c-0.11:= |
24 |
>=dev-libs/libestr-0.1.9 |
25 |
>=dev-libs/liblogging-1.0.1:=[stdlog] |
26 |
>=sys-libs/zlib-1.2.5 |
27 |
dbi? ( >=dev-db/libdbi-0.8.3 ) |
28 |
elasticsearch? ( >=net-misc/curl-7.35.0 ) |
29 |
gcrypt? ( >=dev-libs/libgcrypt-1.5.3:= ) |
30 |
jemalloc? ( >=dev-libs/jemalloc-3.3.1 ) |
31 |
kerberos? ( virtual/krb5 ) |
32 |
mongodb? ( >=dev-libs/libmongo-client-0.1.4 ) |
33 |
mysql? ( virtual/mysql ) |
34 |
normalize? ( |
35 |
>=dev-libs/libee-0.4.0 |
36 |
>=dev-libs/liblognorm-1.0.0:= |
37 |
) |
38 |
omudpspoof? ( >=net-libs/libnet-1.1.6 ) |
39 |
oracle? ( >=dev-db/oracle-instantclient-basic-10.2 ) |
40 |
postgres? ( >=dev-db/postgresql-base-8.4.20 ) |
41 |
rabbitmq? ( >=net-libs/rabbitmq-c-0.3.0 ) |
42 |
redis? ( >=dev-libs/hiredis-0.11.0 ) |
43 |
relp? ( >=dev-libs/librelp-1.2.5 ) |
44 |
rfc3195? ( >=dev-libs/liblogging-1.0.1:=[rfc3195] ) |
45 |
rfc5424hmac? ( >=dev-libs/openssl-0.9.8y ) |
46 |
snmp? ( >=net-analyzer/net-snmp-5.7.2 ) |
47 |
ssl? ( >=net-libs/gnutls-2.12.23 ) |
48 |
systemd? ( >=sys-apps/systemd-208 ) |
49 |
zeromq? ( >=net-libs/czmq-1.2.0 )" |
50 |
DEPEND="${RDEPEND} |
51 |
virtual/pkgconfig" |
52 |
|
53 |
BRANCH="8-stable" |
54 |
|
55 |
# Test suite requires a special setup or will always fail |
56 |
RESTRICT="test" |
57 |
|
58 |
# Maitainer note : open a bug to upstream |
59 |
# showing that building in a separate dir fails |
60 |
AUTOTOOLS_IN_SOURCE_BUILD=1 |
61 |
|
62 |
AUTOTOOLS_PRUNE_LIBTOOL_FILES="modules" |
63 |
|
64 |
DOCS=( |
65 |
AUTHORS |
66 |
ChangeLog |
67 |
"${FILESDIR}"/${BRANCH}/README.gentoo |
68 |
) |
69 |
|
70 |
src_unpack() { |
71 |
unpack ${P}.tar.gz |
72 |
|
73 |
if use doc; then |
74 |
local doc_tarball="${PN}-doc-${PV}.tar.gz" |
75 |
|
76 |
cd "${S}" || die "Cannot change dir into '$S'" |
77 |
mkdir docs || die "Failed to create docs directory" |
78 |
cd docs || die "Failed to change dir into '${S}/docs'" |
79 |
unpack ${doc_tarball} |
80 |
fi |
81 |
} |
82 |
|
83 |
src_prepare() { |
84 |
epatch "${FILESDIR}"/${BRANCH}/20-rsyslog-json_tokener_errors.patch |
85 |
} |
86 |
|
87 |
src_configure() { |
88 |
# Maintainer notes: |
89 |
# * Guardtime support is missing because libgt isn't yet available |
90 |
# in portage. |
91 |
# * Hadoop's HDFS file system output module is currently not |
92 |
# supported in Gentoo because nobody is able to test it |
93 |
# (JAVA dependency). |
94 |
# * dev-libs/hiredis doesn't provide pkg-config (see #504614, |
95 |
# upstream PR 129 and 136) so we need to export HIREDIS_* |
96 |
# variables because rsyslog's build system depends on pkg-config. |
97 |
|
98 |
if use redis; then |
99 |
export HIREDIS_LIBS="-L${EPREFIX}/usr/$(get_libdir) -lhiredis" |
100 |
export HIREDIS_CFLAGS="-I${EPREFIX}/usr/include" |
101 |
fi |
102 |
|
103 |
local myeconfargs=( |
104 |
--disable-generate-man-pages |
105 |
# Input Plugins without depedencies |
106 |
--enable-imfile |
107 |
--enable-impstats |
108 |
--enable-imptcp |
109 |
--enable-imttcp |
110 |
# Message Modificiation Plugins without depedencies |
111 |
--enable-mmanon |
112 |
--enable-mmaudit |
113 |
--enable-mmcount |
114 |
--enable-mmfields |
115 |
--enable-mmjsonparse |
116 |
--enable-mmpstrucdata |
117 |
--enable-mmsequence |
118 |
--enable-mmutf8fix |
119 |
# Output Modification Plugins without dependencies |
120 |
--enable-mail |
121 |
--enable-omprog |
122 |
--enable-omruleset |
123 |
--enable-omstdout |
124 |
--enable-omuxsock |
125 |
# Misc |
126 |
--enable-pmaixforwardedfrom |
127 |
--enable-pmciscoios |
128 |
--enable-pmcisconames |
129 |
--enable-pmlastmsg |
130 |
--enable-pmrfc3164sd |
131 |
--enable-pmsnare |
132 |
# DB |
133 |
$(use_enable dbi libdbi) |
134 |
$(use_enable mongodb ommongodb) |
135 |
$(use_enable mysql) |
136 |
$(use_enable oracle) |
137 |
$(use_enable postgres pgsql) |
138 |
$(use_enable redis omhiredis) |
139 |
# Debug |
140 |
$(use_enable debug) |
141 |
$(use_enable debug diagtools) |
142 |
$(use_enable debug imdiag) |
143 |
$(use_enable debug memcheck) |
144 |
$(use_enable debug rtinst) |
145 |
$(use_enable debug valgrind) |
146 |
# Misc |
147 |
$(use_enable elasticsearch) |
148 |
$(use_enable gcrypt libgcrypt) |
149 |
$(use_enable jemalloc) |
150 |
$(use_enable kerberos gssapi-krb5) |
151 |
$(use_enable normalize mmnormalize) |
152 |
$(use_enable omudpspoof) |
153 |
$(use_enable rabbitmq omrabbitmq) |
154 |
$(use_enable relp) |
155 |
$(use_enable rfc3195) |
156 |
$(use_enable rfc5424hmac mmrfc5424addhmac) |
157 |
$(use_enable snmp) |
158 |
$(use_enable snmp mmsnmptrapd) |
159 |
$(use_enable ssl gnutls) |
160 |
$(use_enable systemd imjournal) |
161 |
$(use_enable systemd omjournal) |
162 |
$(use_enable usertools) |
163 |
$(use_enable zeromq imzmq3) |
164 |
$(use_enable zeromq omzmq3) |
165 |
"$(systemd_with_unitdir)" |
166 |
) |
167 |
|
168 |
autotools-utils_src_configure |
169 |
} |
170 |
|
171 |
src_install() { |
172 |
use doc && HTML_DOCS=( "${S}/docs/build/" ) |
173 |
autotools-utils_src_install |
174 |
|
175 |
newconfd "${FILESDIR}/${BRANCH}/${PN}.confd" ${PN} |
176 |
newinitd "${FILESDIR}/${BRANCH}/${PN}.initd" ${PN} |
177 |
|
178 |
keepdir /var/empty/dev |
179 |
keepdir /var/spool/${PN} |
180 |
keepdir /etc/ssl/${PN} |
181 |
keepdir /etc/${PN}.d |
182 |
|
183 |
insinto /etc |
184 |
newins "${FILESDIR}/${BRANCH}/${PN}.conf" ${PN}.conf |
185 |
|
186 |
insinto /etc/rsyslog.d/ |
187 |
doins "${FILESDIR}/${BRANCH}/50-default.conf" |
188 |
|
189 |
insinto /etc/logrotate.d/ |
190 |
newins "${FILESDIR}/${BRANCH}/${PN}.logrotate" ${PN} |
191 |
|
192 |
if use mysql; then |
193 |
insinto /usr/share/doc/${PF}/scripts/mysql |
194 |
doins plugins/ommysql/{createDB.sql,contrib/delete_mysql} |
195 |
fi |
196 |
|
197 |
if use postgres; then |
198 |
insinto /usr/share/doc/${PF}/scripts/pgsql |
199 |
doins plugins/ompgsql/createDB.sql |
200 |
fi |
201 |
} |
202 |
|
203 |
pkg_postinst() { |
204 |
local advertise_readme=0 |
205 |
|
206 |
if [[ -z "${REPLACING_VERSIONS}" ]]; then |
207 |
# This is a new installation |
208 |
|
209 |
advertise_readme=1 |
210 |
|
211 |
if use mysql || use postgres; then |
212 |
echo |
213 |
elog "Sample SQL scripts for MySQL & PostgreSQL have been installed to:" |
214 |
elog " /usr/share/doc/${PF}/scripts" |
215 |
fi |
216 |
|
217 |
if use ssl; then |
218 |
echo |
219 |
elog "To create a default CA and certificates for your server and clients, run:" |
220 |
elog " emerge --config =${PF}" |
221 |
elog "on your logging server. You can run it several times," |
222 |
elog "once for each logging client. The client certificates will be signed" |
223 |
elog "using the CA certificate generated during the first run." |
224 |
fi |
225 |
fi |
226 |
|
227 |
if [[ -z "${REPLACING_VERSIONS}" ]] || [[ ${REPLACING_VERSIONS} < 8.0 ]]; then |
228 |
# Show this message until rsyslog-8.x |
229 |
echo |
230 |
elog "Since ${PN}-7.6.3 we no longer use the catch-all log target" |
231 |
elog "\"/var/log/syslog\" due to its redundancy to the other log targets." |
232 |
|
233 |
advertise_readme=1 |
234 |
fi |
235 |
|
236 |
if [[ ${advertise_readme} -gt 0 ]]; then |
237 |
# We need to show the README file location |
238 |
|
239 |
echo "" |
240 |
elog "Please read" |
241 |
elog "" |
242 |
elog " ${EPREFIX}/usr/share/doc/${PF}/README.gentoo*" |
243 |
elog "" |
244 |
elog "for more details." |
245 |
fi |
246 |
} |
247 |
|
248 |
pkg_config() { |
249 |
if ! use ssl ; then |
250 |
einfo "There is nothing to configure for rsyslog unless you" |
251 |
einfo "used USE=ssl to build it." |
252 |
return 0 |
253 |
fi |
254 |
|
255 |
# Make sure the certificates directory exists |
256 |
CERTDIR="${EROOT}/etc/ssl/${PN}" |
257 |
if [ ! -d "${CERTDIR}" ]; then |
258 |
mkdir "${CERTDIR}" || die |
259 |
fi |
260 |
einfo "Your certificates will be stored in ${CERTDIR}" |
261 |
|
262 |
# Create a default CA if needed |
263 |
if [ ! -f "${CERTDIR}/${PN}_ca.cert.pem" ]; then |
264 |
einfo "No CA key and certificate found in ${CERTDIR}, creating them for you..." |
265 |
certtool --generate-privkey \ |
266 |
--outfile "${CERTDIR}/${PN}_ca.privkey.pem" &>/dev/null |
267 |
chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" |
268 |
|
269 |
cat > "${T}/${PF}.$$" <<- _EOF |
270 |
cn = Portage automated CA |
271 |
ca |
272 |
cert_signing_key |
273 |
expiration_days = 3650 |
274 |
_EOF |
275 |
|
276 |
certtool --generate-self-signed \ |
277 |
--load-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
278 |
--outfile "${CERTDIR}/${PN}_ca.cert.pem" \ |
279 |
--template "${T}/${PF}.$$" &>/dev/null |
280 |
chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" |
281 |
|
282 |
# Create the server certificate |
283 |
echo |
284 |
einfon "Please type the Common Name of the SERVER you wish to create a certificate for: " |
285 |
read -r CN |
286 |
|
287 |
einfo "Creating private key and certificate for server ${CN}..." |
288 |
certtool --generate-privkey \ |
289 |
--outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null |
290 |
chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" |
291 |
|
292 |
cat > "${T}/${PF}.$$" <<- _EOF |
293 |
cn = ${CN} |
294 |
tls_www_server |
295 |
dns_name = ${CN} |
296 |
expiration_days = 3650 |
297 |
_EOF |
298 |
|
299 |
certtool --generate-certificate \ |
300 |
--outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ |
301 |
--load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ |
302 |
--load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ |
303 |
--load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
304 |
--template "${T}/${PF}.$$" &>/dev/null |
305 |
chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" |
306 |
|
307 |
else |
308 |
einfo "Found existing ${CERTDIR}/${PN}_ca.cert.pem, skipping CA and SERVER creation." |
309 |
fi |
310 |
|
311 |
# Create a client certificate |
312 |
echo |
313 |
einfon "Please type the Common Name of the CLIENT you wish to create a certificate for: " |
314 |
read -r CN |
315 |
|
316 |
einfo "Creating private key and certificate for client ${CN}..." |
317 |
certtool --generate-privkey \ |
318 |
--outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null |
319 |
chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" |
320 |
|
321 |
cat > "${T}/${PF}.$$" <<- _EOF |
322 |
cn = ${CN} |
323 |
tls_www_client |
324 |
dns_name = ${CN} |
325 |
expiration_days = 3650 |
326 |
_EOF |
327 |
|
328 |
certtool --generate-certificate \ |
329 |
--outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ |
330 |
--load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ |
331 |
--load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ |
332 |
--load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
333 |
--template "${T}/${PF}.$$" &>/dev/null |
334 |
chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" |
335 |
|
336 |
rm -f "${T}/${PF}.$$" |
337 |
|
338 |
echo |
339 |
einfo "Here is the documentation on how to encrypt your log traffic:" |
340 |
einfo " http://www.rsyslog.com/doc/rsyslog_tls.html" |
341 |
} |