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