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