1 |
commit: 4c5e423bbc8ce5ba504fcf637e1ea4288d50635c |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Dec 11 16:16:39 2018 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 11 16:32:16 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c5e423b |
7 |
|
8 |
app-admin/rsyslog: bump to v8.40.0 |
9 |
|
10 |
Package-Manager: Portage-2.3.52, Repoman-2.3.12 |
11 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
12 |
|
13 |
app-admin/rsyslog/Manifest | 2 + |
14 |
app-admin/rsyslog/rsyslog-8.40.0.ebuild | 456 ++++++++++++++++++++++++++++++++ |
15 |
2 files changed, 458 insertions(+) |
16 |
|
17 |
diff --git a/app-admin/rsyslog/Manifest b/app-admin/rsyslog/Manifest |
18 |
index 05b6f702c77..e61c657990d 100644 |
19 |
--- a/app-admin/rsyslog/Manifest |
20 |
+++ b/app-admin/rsyslog/Manifest |
21 |
@@ -1,6 +1,8 @@ |
22 |
DIST rsyslog-8.35.0.tar.gz 2590108 BLAKE2B e201c1366b8ab96c070829d51de079212e82216a793eb7622aa91c66e2330981de8be547b1ee7f102ed7d8c8de054d58ba151e95238146a61fba8fe908c5f929 SHA512 3b8845fc057147c2dd740b3bb432e7fb101ad60be5c6bc86a2c2796bcd3f3526c617d45b9e8301388d51047a125ca18ba4ac54f8be2a13eabbbe8fb9361beecc |
23 |
DIST rsyslog-8.38.0.tar.gz 2721798 BLAKE2B 578bc9eefce4893a9c1eb54ee7360cd9fa51b3c87ffe07a0fd5b122987f991835f603417243084de0b59286e993ad1c84237e61c44bc18457b3660668421101b SHA512 9dc3bdc4ef01c2af433478e182704694cb50849d811d476a03e4ce03b3c5aecfb506e7f1c1e51fadcd63da60b067d8011b92b8c9354a688fe66f7b6ffd8f9254 |
24 |
DIST rsyslog-8.39.0.tar.gz 2721560 BLAKE2B 0680cb31d0a07e5676a5c5626e46fa174b8df08ceec49b514624ff8ffeb750bbf199f73af1d89b9dfad121a292084d75b0a1218fb33138f1d7a149fd730cb3d9 SHA512 f46ead433f703df4af6ddc4bbb178ea145d7d2a35ee7749c32b9889f299ba20c83ed76c246530608198e84fef1f2bf10097344c31d5df38b9e0ae47cf4bee479 |
25 |
+DIST rsyslog-8.40.0.tar.gz 2726022 BLAKE2B 33f7f2018200a20b01dbfabeeab592aa09d530edd313bb13f16c47cf3f67aebd9c465af3f1e468ca3d352cd83e4f4eee567c6fd54bbaee1723bee56f4631b440 SHA512 3d5d4f92e37ad9bf3767d5d7fc87fcb7956656f676a9495c78abd12fe9072ec8763b50543b198308a71d5d919721fb9b84b6725dd83a9d9b8a1639d81382c0dd |
26 |
DIST rsyslog-doc-8.35.0.tar.gz 7427270 BLAKE2B 5441080c07a8398cd5d513ba6abe0335f62762f105354105549f0440c0429c62a4f28a4cc84a71d049bc8134cd64bda2c2210a2f30fd5b94f53e0bc783e7c8d1 SHA512 f78d0451eef789d60f7c5ae1eed46c4a9f7a6ade73b829f65aa2373aa786b00e84e8957089532b1b652838bd9f62b41d92530276a0d27e21b8e94d5f0e4728a6 |
27 |
DIST rsyslog-doc-8.38.0.tar.gz 7662314 BLAKE2B 57a121950a3f6630e4736a1ff998e93b543389107d146ddb148ecd2702bb208d21a7f4d77f2fd958f2a56e092341fc6a24ed1cc80a910cb1adb54c65b5b2da04 SHA512 e28a09ae2fcddc711d2cfd31207c9862192598e49964a47b41fc8fa3ae5b1e08b7e2589fb5af859d58d4bf028574eb56cac6514401aa56cb482fa1166863e6a5 |
28 |
DIST rsyslog-doc-8.39.0.tar.gz 7674833 BLAKE2B 1526e0637c3ab9846f447dcea48efbfd17aa517c2fc875c46ac190428db6aa2a0f81f8aaed6e5b0b6991a5c13f45bc818be76c0fe4444c0eb45628ebf48b4956 SHA512 a6d09d384616a264fdf6e09fa0f61bd82a42340bac426d93119e11158f293dd58f894623aca30f2137e51bf701531f07938d014c9b8ec97d0a796447de3089de |
29 |
+DIST rsyslog-doc-8.40.0.tar.gz 7709769 BLAKE2B cda3bbd005120e7100bb36cf4c0f99d3a037525c5451ead5957f4dfe06eaceeba8fb2e266f53203bee6fae97898774ee17862a52ca1dae99aeb3534bbfadcd60 SHA512 2e2f37336948984a8cf0e098eb46e61fe4de6366d63a98204ecd558f4e21b7c1f222659f7bdecdd22e0a61d34c442b4734dbe72a72e8716c768a900b954d473f |
30 |
|
31 |
diff --git a/app-admin/rsyslog/rsyslog-8.40.0.ebuild b/app-admin/rsyslog/rsyslog-8.40.0.ebuild |
32 |
new file mode 100644 |
33 |
index 00000000000..62debd0de64 |
34 |
--- /dev/null |
35 |
+++ b/app-admin/rsyslog/rsyslog-8.40.0.ebuild |
36 |
@@ -0,0 +1,456 @@ |
37 |
+# Copyright 1999-2018 Gentoo Authors |
38 |
+# Distributed under the terms of the GNU General Public License v2 |
39 |
+ |
40 |
+EAPI="6" |
41 |
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6,3_7} ) |
42 |
+ |
43 |
+inherit autotools eutils linux-info python-any-r1 systemd |
44 |
+ |
45 |
+DESCRIPTION="An enhanced multi-threaded syslogd with database support and more" |
46 |
+HOMEPAGE="https://www.rsyslog.com/" |
47 |
+ |
48 |
+if [[ ${PV} == "9999" ]]; then |
49 |
+ EGIT_REPO_URI="https://github.com/rsyslog/${PN}.git" |
50 |
+ |
51 |
+ DOC_REPO_URI="https://github.com/rsyslog/${PN}-doc.git" |
52 |
+ |
53 |
+ inherit git-r3 |
54 |
+else |
55 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~x86" |
56 |
+ |
57 |
+ SRC_URI=" |
58 |
+ https://www.rsyslog.com/files/download/${PN}/${P}.tar.gz |
59 |
+ doc? ( https://www.rsyslog.com/files/download/${PN}/${PN}-doc-${PV}.tar.gz ) |
60 |
+ " |
61 |
+fi |
62 |
+ |
63 |
+LICENSE="GPL-3 LGPL-3 Apache-2.0" |
64 |
+SLOT="0" |
65 |
+IUSE="curl dbi debug doc elasticsearch +gcrypt grok gnutls jemalloc kafka kerberos kubernetes libressl mdblookup" |
66 |
+IUSE+=" mongodb mysql normalize omhttp omhttpfs omudpspoof openssl postgres rabbitmq redis relp rfc3195 rfc5424hmac" |
67 |
+IUSE+=" snmp ssl systemd test usertools +uuid xxhash zeromq" |
68 |
+RESTRICT="!test? ( test )" |
69 |
+ |
70 |
+RDEPEND=" |
71 |
+ >=dev-libs/libfastjson-0.99.8:= |
72 |
+ >=dev-libs/libestr-0.1.9 |
73 |
+ >=sys-libs/zlib-1.2.5 |
74 |
+ curl? ( >=net-misc/curl-7.35.0 ) |
75 |
+ dbi? ( >=dev-db/libdbi-0.8.3 ) |
76 |
+ elasticsearch? ( >=net-misc/curl-7.35.0 ) |
77 |
+ gcrypt? ( >=dev-libs/libgcrypt-1.5.3:= ) |
78 |
+ grok? ( >=dev-libs/grok-0.9.2 ) |
79 |
+ jemalloc? ( >=dev-libs/jemalloc-3.3.1:= ) |
80 |
+ kafka? ( >=dev-libs/librdkafka-0.9.0.99:= ) |
81 |
+ kerberos? ( virtual/krb5 ) |
82 |
+ kubernetes? ( >=net-misc/curl-7.35.0 ) |
83 |
+ mdblookup? ( dev-libs/libmaxminddb:= ) |
84 |
+ mongodb? ( >=dev-libs/mongo-c-driver-1.1.10:= ) |
85 |
+ mysql? ( virtual/libmysqlclient:= ) |
86 |
+ normalize? ( |
87 |
+ >=dev-libs/libee-0.4.0 |
88 |
+ >=dev-libs/liblognorm-2.0.3:= |
89 |
+ ) |
90 |
+ omhttpfs? ( >=net-misc/curl-7.35.0 ) |
91 |
+ omudpspoof? ( >=net-libs/libnet-1.1.6 ) |
92 |
+ postgres? ( >=dev-db/postgresql-8.4.20:= ) |
93 |
+ rabbitmq? ( >=net-libs/rabbitmq-c-0.3.0:= ) |
94 |
+ redis? ( >=dev-libs/hiredis-0.11.0:= ) |
95 |
+ relp? ( >=dev-libs/librelp-1.2.17:= ) |
96 |
+ rfc3195? ( >=dev-libs/liblogging-1.0.1:=[rfc3195] ) |
97 |
+ rfc5424hmac? ( |
98 |
+ !libressl? ( >=dev-libs/openssl-0.9.8y:0= ) |
99 |
+ libressl? ( dev-libs/libressl:= ) |
100 |
+ ) |
101 |
+ snmp? ( >=net-analyzer/net-snmp-5.7.2 ) |
102 |
+ ssl? ( |
103 |
+ gnutls? ( >=net-libs/gnutls-2.12.23:0= ) |
104 |
+ openssl? ( |
105 |
+ !libressl? ( dev-libs/openssl:0= ) |
106 |
+ libressl? ( dev-libs/libressl:0= ) |
107 |
+ ) |
108 |
+ ) |
109 |
+ systemd? ( >=sys-apps/systemd-234 ) |
110 |
+ uuid? ( sys-apps/util-linux:0= ) |
111 |
+ xxhash? ( dev-libs/xxhash:= ) |
112 |
+ zeromq? ( |
113 |
+ >=net-libs/czmq-3.0.2 |
114 |
+ )" |
115 |
+DEPEND="${RDEPEND} |
116 |
+ >=sys-devel/autoconf-archive-2015.02.24 |
117 |
+ virtual/pkgconfig |
118 |
+ test? ( |
119 |
+ >=dev-libs/liblogging-1.0.1[stdlog] |
120 |
+ jemalloc? ( <sys-libs/libfaketime-0.9.7 ) |
121 |
+ !jemalloc? ( sys-libs/libfaketime ) |
122 |
+ ${PYTHON_DEPS} |
123 |
+ )" |
124 |
+ |
125 |
+REQUIRED_USE=" |
126 |
+ kubernetes? ( normalize ) |
127 |
+ ssl? ( || ( gnutls openssl ) ) |
128 |
+" |
129 |
+ |
130 |
+if [[ ${PV} == "9999" ]]; then |
131 |
+ DEPEND+=" doc? ( >=dev-python/sphinx-1.1.3-r7 )" |
132 |
+ DEPEND+=" >=sys-devel/flex-2.5.39-r1" |
133 |
+ DEPEND+=" >=sys-devel/bison-2.4.3" |
134 |
+ DEPEND+=" >=dev-python/docutils-0.12" |
135 |
+fi |
136 |
+ |
137 |
+CONFIG_CHECK="~INOTIFY_USER" |
138 |
+WARNING_INOTIFY_USER="CONFIG_INOTIFY_USER isn't set. Imfile module on this system will only support polling mode!" |
139 |
+ |
140 |
+pkg_setup() { |
141 |
+ use test && python-any-r1_pkg_setup |
142 |
+} |
143 |
+ |
144 |
+src_unpack() { |
145 |
+ if [[ ${PV} == "9999" ]]; then |
146 |
+ git-r3_fetch |
147 |
+ git-r3_checkout |
148 |
+ else |
149 |
+ unpack ${P}.tar.gz |
150 |
+ fi |
151 |
+ |
152 |
+ if use doc; then |
153 |
+ if [[ ${PV} == "9999" ]]; then |
154 |
+ local _EGIT_BRANCH= |
155 |
+ if [[ -n "${EGIT_BRANCH}" ]]; then |
156 |
+ # Cannot use rsyslog commits/branches for documentation repository |
157 |
+ _EGIT_BRANCH=${EGIT_BRANCH} |
158 |
+ unset EGIT_BRANCH |
159 |
+ fi |
160 |
+ |
161 |
+ git-r3_fetch "${DOC_REPO_URI}" |
162 |
+ git-r3_checkout "${DOC_REPO_URI}" "${S}"/docs |
163 |
+ |
164 |
+ if [[ -n "${_EGIT_BRANCH}" ]]; then |
165 |
+ # Restore previous EGIT_BRANCH information |
166 |
+ EGIT_BRANCH=${_EGIT_BRANCH} |
167 |
+ fi |
168 |
+ else |
169 |
+ cd "${S}" || die "Cannot change dir into '${S}'" |
170 |
+ mkdir docs || die "Failed to create docs directory" |
171 |
+ cd docs || die "Failed to change dir into '${S}/docs'" |
172 |
+ unpack ${PN}-doc-${PV}.tar.gz |
173 |
+ fi |
174 |
+ fi |
175 |
+} |
176 |
+ |
177 |
+src_prepare() { |
178 |
+ default |
179 |
+ |
180 |
+ eautoreconf |
181 |
+} |
182 |
+ |
183 |
+src_configure() { |
184 |
+ # Maintainer notes: |
185 |
+ # * Guardtime support is missing because libgt isn't yet available |
186 |
+ # in portage. |
187 |
+ # * Hadoop's HDFS file system output module is currently not |
188 |
+ # supported in Gentoo because nobody is able to test it |
189 |
+ # (JAVA dependency). |
190 |
+ # * dev-libs/hiredis doesn't provide pkg-config (see #504614, |
191 |
+ # upstream PR 129 and 136) so we need to export HIREDIS_* |
192 |
+ # variables because rsyslog's build system depends on pkg-config. |
193 |
+ |
194 |
+ if use redis; then |
195 |
+ export HIREDIS_LIBS="-L${EPREFIX}/usr/$(get_libdir) -lhiredis" |
196 |
+ export HIREDIS_CFLAGS="-I${EPREFIX}/usr/include" |
197 |
+ fi |
198 |
+ |
199 |
+ local myeconfargs=( |
200 |
+ --disable-debug-symbols |
201 |
+ --disable-generate-man-pages |
202 |
+ --without-valgrind-testbench |
203 |
+ --disable-liblogging-stdlog |
204 |
+ $(use_enable test testbench) |
205 |
+ $(use_enable test libfaketime) |
206 |
+ $(use_enable test extended-tests) |
207 |
+ # Input Plugins without depedencies |
208 |
+ --enable-imdiag |
209 |
+ --enable-imfile |
210 |
+ --enable-impstats |
211 |
+ --enable-imptcp |
212 |
+ # Message Modificiation Plugins without depedencies |
213 |
+ --enable-mmanon |
214 |
+ --enable-mmaudit |
215 |
+ --enable-mmcount |
216 |
+ --enable-mmfields |
217 |
+ --enable-mmjsonparse |
218 |
+ --enable-mmpstrucdata |
219 |
+ --enable-mmrm1stspace |
220 |
+ --enable-mmsequence |
221 |
+ --enable-mmutf8fix |
222 |
+ # Output Modification Plugins without dependencies |
223 |
+ --enable-mail |
224 |
+ --enable-omprog |
225 |
+ --enable-omruleset |
226 |
+ --enable-omstdout |
227 |
+ --enable-omuxsock |
228 |
+ # Misc |
229 |
+ --enable-fmhash |
230 |
+ $(use_enable xxhash fmhash-xxhash) |
231 |
+ --enable-pmaixforwardedfrom |
232 |
+ --enable-pmciscoios |
233 |
+ --enable-pmcisconames |
234 |
+ --enable-pmlastmsg |
235 |
+ $(use_enable normalize pmnormalize) |
236 |
+ --enable-pmnull |
237 |
+ --enable-pmpanngfw |
238 |
+ --enable-pmsnare |
239 |
+ # DB |
240 |
+ $(use_enable dbi libdbi) |
241 |
+ $(use_enable mongodb ommongodb) |
242 |
+ $(use_enable mysql) |
243 |
+ $(use_enable postgres pgsql) |
244 |
+ $(use_enable redis omhiredis) |
245 |
+ # Debug |
246 |
+ $(use_enable debug) |
247 |
+ $(use_enable debug diagtools) |
248 |
+ $(use_enable debug valgrind) |
249 |
+ # Misc |
250 |
+ $(use_enable curl fmhttp) |
251 |
+ $(use_enable elasticsearch) |
252 |
+ $(use_enable gcrypt libgcrypt) |
253 |
+ $(use_enable jemalloc) |
254 |
+ $(use_enable kafka imkafka) |
255 |
+ $(use_enable kafka omkafka) |
256 |
+ $(use_enable kerberos gssapi-krb5) |
257 |
+ $(use_enable kubernetes mmkubernetes) |
258 |
+ $(use_enable normalize mmnormalize) |
259 |
+ $(use_enable mdblookup mmdblookup) |
260 |
+ $(use_enable grok mmgrok) |
261 |
+ $(use_enable omhttp) |
262 |
+ $(use_enable omhttpfs) |
263 |
+ $(use_enable omudpspoof) |
264 |
+ $(use_enable rabbitmq omrabbitmq) |
265 |
+ $(use_enable relp) |
266 |
+ $(use_enable rfc3195) |
267 |
+ $(use_enable rfc5424hmac mmrfc5424addhmac) |
268 |
+ $(use_enable snmp) |
269 |
+ $(use_enable snmp mmsnmptrapd) |
270 |
+ $(use_enable gnutls) |
271 |
+ $(use_enable openssl) |
272 |
+ $(use_enable systemd imjournal) |
273 |
+ $(use_enable systemd omjournal) |
274 |
+ $(use_enable usertools) |
275 |
+ $(use_enable uuid) |
276 |
+ $(use_enable zeromq imczmq) |
277 |
+ $(use_enable zeromq omczmq) |
278 |
+ --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" |
279 |
+ ) |
280 |
+ |
281 |
+ econf "${myeconfargs[@]}" |
282 |
+} |
283 |
+ |
284 |
+src_compile() { |
285 |
+ default |
286 |
+ |
287 |
+ if use doc && [[ "${PV}" == "9999" ]]; then |
288 |
+ einfo "Building documentation ..." |
289 |
+ local doc_dir="${S}/docs" |
290 |
+ cd "${doc_dir}" || die "Cannot chdir into \"${doc_dir}\"!" |
291 |
+ sphinx-build -b html source build || die "Building documentation failed!" |
292 |
+ fi |
293 |
+} |
294 |
+ |
295 |
+src_test() { |
296 |
+ local _has_increased_ulimit= |
297 |
+ |
298 |
+ # Sometimes tests aren't executable (i.e. when added via patch) |
299 |
+ einfo "Adjusting permissions of test scripts ..." |
300 |
+ find "${S}"/tests -type f -name '*.sh' \! -perm -111 -exec chmod a+x '{}' \; || \ |
301 |
+ die "Failed to adjust test scripts permission" |
302 |
+ |
303 |
+ if ulimit -n 3072; then |
304 |
+ _has_increased_ulimit="true" |
305 |
+ fi |
306 |
+ |
307 |
+ if ! emake --jobs 1 check; then |
308 |
+ eerror "Test suite failed! :(" |
309 |
+ |
310 |
+ if [[ -z "${_has_increased_ulimit}" ]]; then |
311 |
+ eerror "Probably because open file limit couldn't be set to 3072." |
312 |
+ fi |
313 |
+ |
314 |
+ if has userpriv ${FEATURES}; then |
315 |
+ eerror "Please try to reproduce the test suite failure with FEATURES=-userpriv " \ |
316 |
+ "before you submit a bug report." |
317 |
+ fi |
318 |
+ |
319 |
+ fi |
320 |
+} |
321 |
+ |
322 |
+src_install() { |
323 |
+ local DOCS=( |
324 |
+ AUTHORS |
325 |
+ ChangeLog |
326 |
+ "${FILESDIR}"/README.gentoo |
327 |
+ ) |
328 |
+ |
329 |
+ use doc && local HTML_DOCS=( "${S}/docs/build/." ) |
330 |
+ |
331 |
+ default |
332 |
+ |
333 |
+ newconfd "${FILESDIR}/${PN}.confd-r1" ${PN} |
334 |
+ newinitd "${FILESDIR}/${PN}.initd-r1" ${PN} |
335 |
+ |
336 |
+ keepdir /var/empty/dev |
337 |
+ keepdir /var/spool/${PN} |
338 |
+ keepdir /etc/ssl/${PN} |
339 |
+ keepdir /etc/${PN}.d |
340 |
+ |
341 |
+ insinto /etc |
342 |
+ newins "${FILESDIR}/${PN}.conf" ${PN}.conf |
343 |
+ |
344 |
+ insinto /etc/rsyslog.d/ |
345 |
+ newins "${FILESDIR}/50-default-r1.conf" 50-default.conf |
346 |
+ |
347 |
+ insinto /etc/logrotate.d/ |
348 |
+ newins "${FILESDIR}/${PN}-r1.logrotate" ${PN} |
349 |
+ |
350 |
+ if use mysql; then |
351 |
+ insinto /usr/share/doc/${PF}/scripts/mysql |
352 |
+ doins plugins/ommysql/createDB.sql |
353 |
+ fi |
354 |
+ |
355 |
+ if use postgres; then |
356 |
+ insinto /usr/share/doc/${PF}/scripts/pgsql |
357 |
+ doins plugins/ompgsql/createDB.sql |
358 |
+ fi |
359 |
+ |
360 |
+ prune_libtool_files --modules |
361 |
+} |
362 |
+ |
363 |
+pkg_postinst() { |
364 |
+ local advertise_readme=0 |
365 |
+ |
366 |
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then |
367 |
+ # This is a new installation |
368 |
+ |
369 |
+ advertise_readme=1 |
370 |
+ |
371 |
+ if use mysql || use postgres; then |
372 |
+ echo |
373 |
+ elog "Sample SQL scripts for MySQL & PostgreSQL have been installed to:" |
374 |
+ elog " /usr/share/doc/${PF}/scripts" |
375 |
+ fi |
376 |
+ |
377 |
+ if use ssl; then |
378 |
+ echo |
379 |
+ elog "To create a default CA and certificates for your server and clients, run:" |
380 |
+ elog " emerge --config =${PF}" |
381 |
+ elog "on your logging server. You can run it several times," |
382 |
+ elog "once for each logging client. The client certificates will be signed" |
383 |
+ elog "using the CA certificate generated during the first run." |
384 |
+ fi |
385 |
+ fi |
386 |
+ |
387 |
+ if [[ ${advertise_readme} -gt 0 ]]; then |
388 |
+ # We need to show the README file location |
389 |
+ |
390 |
+ echo "" |
391 |
+ elog "Please read" |
392 |
+ elog "" |
393 |
+ elog " ${EPREFIX}/usr/share/doc/${PF}/README.gentoo*" |
394 |
+ elog "" |
395 |
+ elog "for more details." |
396 |
+ fi |
397 |
+} |
398 |
+ |
399 |
+pkg_config() { |
400 |
+ if ! use ssl ; then |
401 |
+ einfo "There is nothing to configure for rsyslog unless you" |
402 |
+ einfo "used USE=ssl to build it." |
403 |
+ return 0 |
404 |
+ fi |
405 |
+ |
406 |
+ # Make sure the certificates directory exists |
407 |
+ local CERTDIR="${EROOT}/etc/ssl/${PN}" |
408 |
+ if [[ ! -d "${CERTDIR}" ]]; then |
409 |
+ mkdir "${CERTDIR}" || die |
410 |
+ fi |
411 |
+ einfo "Your certificates will be stored in ${CERTDIR}" |
412 |
+ |
413 |
+ # Create a default CA if needed |
414 |
+ if [[ ! -f "${CERTDIR}/${PN}_ca.cert.pem" ]]; then |
415 |
+ einfo "No CA key and certificate found in ${CERTDIR}, creating them for you..." |
416 |
+ certtool --generate-privkey \ |
417 |
+ --outfile "${CERTDIR}/${PN}_ca.privkey.pem" &>/dev/null |
418 |
+ chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" |
419 |
+ |
420 |
+ cat > "${T}/${PF}.$$" <<- _EOF |
421 |
+ cn = Portage automated CA |
422 |
+ ca |
423 |
+ cert_signing_key |
424 |
+ expiration_days = 3650 |
425 |
+ _EOF |
426 |
+ |
427 |
+ certtool --generate-self-signed \ |
428 |
+ --load-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
429 |
+ --outfile "${CERTDIR}/${PN}_ca.cert.pem" \ |
430 |
+ --template "${T}/${PF}.$$" &>/dev/null |
431 |
+ chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" |
432 |
+ |
433 |
+ # Create the server certificate |
434 |
+ echo |
435 |
+ einfon "Please type the Common Name of the SERVER you wish to create a certificate for: " |
436 |
+ read -r CN |
437 |
+ |
438 |
+ einfo "Creating private key and certificate for server ${CN}..." |
439 |
+ certtool --generate-privkey \ |
440 |
+ --outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null |
441 |
+ chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" |
442 |
+ |
443 |
+ cat > "${T}/${PF}.$$" <<- _EOF |
444 |
+ cn = ${CN} |
445 |
+ tls_www_server |
446 |
+ dns_name = ${CN} |
447 |
+ expiration_days = 3650 |
448 |
+ _EOF |
449 |
+ |
450 |
+ certtool --generate-certificate \ |
451 |
+ --outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ |
452 |
+ --load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ |
453 |
+ --load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ |
454 |
+ --load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
455 |
+ --template "${T}/${PF}.$$" &>/dev/null |
456 |
+ chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" |
457 |
+ |
458 |
+ else |
459 |
+ einfo "Found existing ${CERTDIR}/${PN}_ca.cert.pem, skipping CA and SERVER creation." |
460 |
+ fi |
461 |
+ |
462 |
+ # Create a client certificate |
463 |
+ echo |
464 |
+ einfon "Please type the Common Name of the CLIENT you wish to create a certificate for: " |
465 |
+ read -r CN |
466 |
+ |
467 |
+ einfo "Creating private key and certificate for client ${CN}..." |
468 |
+ certtool --generate-privkey \ |
469 |
+ --outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null |
470 |
+ chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" |
471 |
+ |
472 |
+ cat > "${T}/${PF}.$$" <<- _EOF |
473 |
+ cn = ${CN} |
474 |
+ tls_www_client |
475 |
+ dns_name = ${CN} |
476 |
+ expiration_days = 3650 |
477 |
+ _EOF |
478 |
+ |
479 |
+ certtool --generate-certificate \ |
480 |
+ --outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ |
481 |
+ --load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ |
482 |
+ --load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ |
483 |
+ --load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ |
484 |
+ --template "${T}/${PF}.$$" &>/dev/null |
485 |
+ chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" |
486 |
+ |
487 |
+ rm -f "${T}/${PF}.$$" |
488 |
+ |
489 |
+ echo |
490 |
+ einfo "Here is the documentation on how to encrypt your log traffic:" |
491 |
+ einfo " https://www.rsyslog.com/doc/rsyslog_tls.html" |
492 |
+} |