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 |
epatch "${FILESDIR}"/${BRANCH}/30-rsyslog-imuxsock-shrink.patch |
86 |
epatch "${FILESDIR}"/${BRANCH}/40-rsyslog-fix-building-without-atomic-instructions.patch |
87 |
epatch "${FILESDIR}"/${BRANCH}/41-rsyslog-gcc-pedantic-fixes.patch |
88 |
} |
89 |
|
90 |
src_configure() { |
91 |
# Maintainer notes: |
92 |
# * Guardtime support is missing because libgt isn't yet available |
93 |
# in portage. |
94 |
# * Hadoop's HDFS file system output module is currently not |
95 |
# supported in Gentoo because nobody is able to test it |
96 |
# (JAVA dependency). |
97 |
# * dev-libs/hiredis doesn't provide pkg-config (see #504614, |
98 |
# upstream PR 129 and 136) so we need to export HIREDIS_* |
99 |
# variables because rsyslog's build system depends on pkg-config. |
100 |
|
101 |
if use redis; then |
102 |
export HIREDIS_LIBS="-L${EPREFIX}/usr/$(get_libdir) -lhiredis" |
103 |
export HIREDIS_CFLAGS="-I${EPREFIX}/usr/include" |
104 |
fi |
105 |
|
106 |
local myeconfargs=( |
107 |
--disable-generate-man-pages |
108 |
# Input Plugins without depedencies |
109 |
--enable-imfile |
110 |
--enable-impstats |
111 |
--enable-imptcp |
112 |
--enable-imttcp |
113 |
# Message Modificiation Plugins without depedencies |
114 |
--enable-mmanon |
115 |
--enable-mmaudit |
116 |
--enable-mmcount |
117 |
--enable-mmfields |
118 |
--enable-mmjsonparse |
119 |
--enable-mmpstrucdata |
120 |
--enable-mmsequence |
121 |
--enable-mmutf8fix |
122 |
# Output Modification Plugins without dependencies |
123 |
--enable-mail |
124 |
--enable-omprog |
125 |
--enable-omruleset |
126 |
--enable-omstdout |
127 |
--enable-omuxsock |
128 |
# Misc |
129 |
--enable-pmaixforwardedfrom |
130 |
--enable-pmciscoios |
131 |
--enable-pmcisconames |
132 |
--enable-pmlastmsg |
133 |
--enable-pmrfc3164sd |
134 |
--enable-pmsnare |
135 |
# DB |
136 |
$(use_enable dbi libdbi) |
137 |
$(use_enable mongodb ommongodb) |
138 |
$(use_enable mysql) |
139 |
$(use_enable oracle) |
140 |
$(use_enable postgres pgsql) |
141 |
$(use_enable redis omhiredis) |
142 |
# Debug |
143 |
$(use_enable debug) |
144 |
$(use_enable debug diagtools) |
145 |
$(use_enable debug imdiag) |
146 |
$(use_enable debug memcheck) |
147 |
$(use_enable debug rtinst) |
148 |
$(use_enable debug valgrind) |
149 |
# Misc |
150 |
$(use_enable elasticsearch) |
151 |
$(use_enable gcrypt libgcrypt) |
152 |
$(use_enable jemalloc) |
153 |
$(use_enable kerberos gssapi-krb5) |
154 |
$(use_enable normalize mmnormalize) |
155 |
$(use_enable omudpspoof) |
156 |
$(use_enable rabbitmq omrabbitmq) |
157 |
$(use_enable relp) |
158 |
$(use_enable rfc3195) |
159 |
$(use_enable rfc5424hmac mmrfc5424addhmac) |
160 |
$(use_enable snmp) |
161 |
$(use_enable snmp mmsnmptrapd) |
162 |
$(use_enable ssl gnutls) |
163 |
$(use_enable systemd imjournal) |
164 |
$(use_enable systemd omjournal) |
165 |
$(use_enable usertools) |
166 |
$(use_enable zeromq imzmq3) |
167 |
$(use_enable zeromq omzmq3) |
168 |
"$(systemd_with_unitdir)" |
169 |
) |
170 |
|
171 |
autotools-utils_src_configure |
172 |
} |
173 |
|
174 |
src_install() { |
175 |
use doc && HTML_DOCS=( "${S}/docs/build/" ) |
176 |
autotools-utils_src_install |
177 |
|
178 |
newconfd "${FILESDIR}/${BRANCH}/${PN}.confd" ${PN} |
179 |
newinitd "${FILESDIR}/${BRANCH}/${PN}.initd" ${PN} |
180 |
|
181 |
keepdir /var/empty/dev |
182 |
keepdir /var/spool/${PN} |
183 |
keepdir /etc/ssl/${PN} |
184 |
keepdir /etc/${PN}.d |
185 |
|
186 |
insinto /etc |
187 |
newins "${FILESDIR}/${BRANCH}/${PN}.conf" ${PN}.conf |
188 |
|
189 |
insinto /etc/rsyslog.d/ |
190 |
doins "${FILESDIR}/${BRANCH}/50-default.conf" |
191 |
|
192 |
insinto /etc/logrotate.d/ |
193 |
newins "${FILESDIR}/${BRANCH}/${PN}.logrotate" ${PN} |
194 |
|
195 |
if use mysql; then |
196 |
insinto /usr/share/doc/${PF}/scripts/mysql |
197 |
doins plugins/ommysql/{createDB.sql,contrib/delete_mysql} |
198 |
fi |
199 |
|
200 |
if use postgres; then |
201 |
insinto /usr/share/doc/${PF}/scripts/pgsql |
202 |
doins plugins/ompgsql/createDB.sql |
203 |
fi |
204 |
} |
205 |
|
206 |
pkg_postinst() { |
207 |
local advertise_readme=0 |
208 |
|
209 |
if [[ -z "${REPLACING_VERSIONS}" ]]; then |
210 |
# This is a new installation |
211 |
|
212 |
advertise_readme=1 |
213 |
|
214 |
if use mysql || use postgres; then |
215 |
echo |
216 |
elog "Sample SQL scripts for MySQL & PostgreSQL have been installed to:" |
217 |
elog " /usr/share/doc/${PF}/scripts" |
218 |
fi |
219 |
|
220 |
if use ssl; then |
221 |
echo |
222 |
elog "To create a default CA and certificates for your server and clients, run:" |
223 |
elog " emerge --config =${PF}" |
224 |
elog "on your logging server. You can run it several times," |
225 |
elog "once for each logging client. The client certificates will be signed" |
226 |
elog "using the CA certificate generated during the first run." |
227 |
fi |
228 |
fi |
229 |
|
230 |
if [[ -z "${REPLACING_VERSIONS}" ]] || [[ ${REPLACING_VERSIONS} < 8.0 ]]; then |
231 |
# Show this message until rsyslog-8.x |
232 |
echo |
233 |
elog "Since ${PN}-7.6.3 we no longer use the catch-all log target" |
234 |
elog "\"/var/log/syslog\" due to its redundancy to the other log targets." |
235 |
|
236 |
advertise_readme=1 |
237 |
fi |
238 |
|
239 |
if [[ ${advertise_readme} -gt 0 ]]; then |
240 |
# We need to show the README file location |
241 |
|
242 |
echo "" |
243 |
elog "Please read" |
244 |
elog "" |
245 |
elog " ${EPREFIX}/usr/share/doc/${PF}/README.gentoo*" |
246 |
elog "" |
247 |
elog "for more details." |
248 |
fi |
249 |
} |
250 |
|
251 |
pkg_config() { |
252 |
if ! use ssl ; then |
253 |
einfo "There is nothing to configure for rsyslog unless you" |
254 |
einfo "used USE=ssl to build it." |
255 |
return 0 |
256 |
fi |
257 |
|
258 |
# Make sure the certificates directory exists |
259 |
CERTDIR="${EROOT}/etc/ssl/${PN}" |
260 |
if [ ! -d "${CERTDIR}" ]; then |
261 |
mkdir "${CERTDIR}" || die |
262 |
fi |
263 |
einfo "Your certificates will be stored in ${CERTDIR}" |
264 |
|
265 |
# Create a default CA if needed |
266 |
if [ ! -f "${CERTDIR}/${PN}_ca.cert.pem" ]; then |
267 |
einfo "No CA key and certificate found in ${CERTDIR}, creating them for you..." |
268 |
certtool --generate-privkey \ |
269 |
--outfile "${CERTDIR}/${PN}_ca.privkey.pem" &>/dev/null |
270 |
chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" |
271 |
|
272 |
cat > "${T}/${PF}.$$" <<- _EOF |
273 |
cn = Portage automated CA |
274 |
ca |
275 |
cert_signing_key |
276 |
expiration_days = 3650 |
277 |
_EOF |
278 |
|
279 |
certtool --generate-self-signed \ |
280 |
--load-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
281 |
--outfile "${CERTDIR}/${PN}_ca.cert.pem" \ |
282 |
--template "${T}/${PF}.$$" &>/dev/null |
283 |
chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" |
284 |
|
285 |
# Create the server certificate |
286 |
echo |
287 |
einfon "Please type the Common Name of the SERVER you wish to create a certificate for: " |
288 |
read -r CN |
289 |
|
290 |
einfo "Creating private key and certificate for server ${CN}..." |
291 |
certtool --generate-privkey \ |
292 |
--outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null |
293 |
chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" |
294 |
|
295 |
cat > "${T}/${PF}.$$" <<- _EOF |
296 |
cn = ${CN} |
297 |
tls_www_server |
298 |
dns_name = ${CN} |
299 |
expiration_days = 3650 |
300 |
_EOF |
301 |
|
302 |
certtool --generate-certificate \ |
303 |
--outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ |
304 |
--load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ |
305 |
--load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ |
306 |
--load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
307 |
--template "${T}/${PF}.$$" &>/dev/null |
308 |
chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" |
309 |
|
310 |
else |
311 |
einfo "Found existing ${CERTDIR}/${PN}_ca.cert.pem, skipping CA and SERVER creation." |
312 |
fi |
313 |
|
314 |
# Create a client certificate |
315 |
echo |
316 |
einfon "Please type the Common Name of the CLIENT you wish to create a certificate for: " |
317 |
read -r CN |
318 |
|
319 |
einfo "Creating private key and certificate for client ${CN}..." |
320 |
certtool --generate-privkey \ |
321 |
--outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null |
322 |
chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" |
323 |
|
324 |
cat > "${T}/${PF}.$$" <<- _EOF |
325 |
cn = ${CN} |
326 |
tls_www_client |
327 |
dns_name = ${CN} |
328 |
expiration_days = 3650 |
329 |
_EOF |
330 |
|
331 |
certtool --generate-certificate \ |
332 |
--outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ |
333 |
--load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ |
334 |
--load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ |
335 |
--load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
336 |
--template "${T}/${PF}.$$" &>/dev/null |
337 |
chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" |
338 |
|
339 |
rm -f "${T}/${PF}.$$" |
340 |
|
341 |
echo |
342 |
einfo "Here is the documentation on how to encrypt your log traffic:" |
343 |
einfo " http://www.rsyslog.com/doc/rsyslog_tls.html" |
344 |
} |