From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 59285139085 for ; Tue, 10 Jan 2017 23:44:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A389F234127; Tue, 10 Jan 2017 23:44:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6A09B234127 for ; Tue, 10 Jan 2017 23:44:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0C60B341027 for ; Tue, 10 Jan 2017 23:44:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7524624C5 for ; Tue, 10 Jan 2017 23:44:28 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1484091863.91cdb1d537e5a20b0b015fd939722d72bf8a33df.whissi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/rsyslog/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-admin/rsyslog/Manifest app-admin/rsyslog/rsyslog-8.24.0.ebuild X-VCS-Directories: app-admin/rsyslog/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 91cdb1d537e5a20b0b015fd939722d72bf8a33df X-VCS-Branch: master Date: Tue, 10 Jan 2017 23:44:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 79fa56bc-3d68-4368-8fa5-340a7409fd02 X-Archives-Hash: d17915f0563228867d48f467ab0a1bc4 commit: 91cdb1d537e5a20b0b015fd939722d72bf8a33df Author: Thomas Deutschmann gentoo org> AuthorDate: Tue Jan 10 23:43:55 2017 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Tue Jan 10 23:44:23 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91cdb1d5 app-admin/rsyslog: Bump to v8.24.0 Ebuild changes: =============== - New mmrm1stspace modify module added & enabled (no new dependencies) Package-Manager: Portage-2.3.3, Repoman-2.3.1 app-admin/rsyslog/Manifest | 2 + app-admin/rsyslog/rsyslog-8.24.0.ebuild | 453 ++++++++++++++++++++++++++++++++ 2 files changed, 455 insertions(+) diff --git a/app-admin/rsyslog/Manifest b/app-admin/rsyslog/Manifest index f490617..99baaa3 100644 --- a/app-admin/rsyslog/Manifest +++ b/app-admin/rsyslog/Manifest @@ -2,7 +2,9 @@ DIST rsyslog-8.16.0.tar.gz 2132012 SHA256 4fe4f97c10899086d98b9401d7e8d2bcff61c7 DIST rsyslog-8.19.0.tar.gz 2279714 SHA256 3379b30f2e6ef05a0f1c7327c73923fa5877a80b984506cdf48ed068c94a575e SHA512 77c40c9d76591ed3561ec76242be2c647848533df5599320ea988cbc200614c47930e0b63f190d31a0c1cec2443d57ca374f07e0909f11eba8a4bd4b8eee0e44 WHIRLPOOL 3f7d7134a0c6a475453828440a87d0fa68e7afc583ef12556f3b60f3e07621011b4f48e8c4dfbe46cef2bf2decee3827c42bd4ba481611e7cb76a695dcec5c7b DIST rsyslog-8.22.0.tar.gz 2259652 SHA256 06e2884181333dccecceaca82827ae24ca7a258b4fbf7b1e07a80d4caae640ca SHA512 105c7a81bd96c6b68b9e9f4d1ae06e63bf531afe4dfd91efb73b2a96e8264270579ccacc6a1bf77ad284913fb7f4bac55f83c5b38f7fa7675f6c4a6fa9b2f3ca WHIRLPOOL 22cb36592654adf67124f31417ad332163d72c852b7d6e471d58f3a45aa8123d1ce701c4853b4e884927587e26dac3645cbe6ffcf291b22c7f789f9513df81a5 DIST rsyslog-8.23.0.tar.gz 2338318 SHA256 244e79552d37a5729f3f53786062828adc16fd080eeb0de6507bff55ed21693b SHA512 4e4832287f02d4b0435b3711241d58cad9f393ce14318bbccce7b89dceeed01205960e7df4b2629831429e550c0865407374eb6a5548ecb47a3aea90c7d7df2d WHIRLPOOL a4ac676faa6ad09b3e7cf0fbc9c6f827d96a4c14106c3692b523ffc9b90f74745bab7edff2b0c914c160db1f3f83c5f5589203ad8c7cec718c7be8dc2fd0ab66 +DIST rsyslog-8.24.0.tar.gz 2374240 SHA256 37f32ce33e32a88e1bea0511e8e557d90b7378b81520e3236a9af5ba6ea993d7 SHA512 b25b8ae72133376f732f54863c97aea3c8dfbf37c62c6a61840932996913c9d4e63155a24ffc577db48a18514f3e35b6fb109b1864380ba93ddf3fa6d84d728d WHIRLPOOL c5895d50143c21d446d760f5179b47fdae4ec34867711c942cd671b88789588e7244fb8511745efdb701954f7bc390403d30736a1e54af13dca4876f989928df DIST rsyslog-doc-8.16.0.tar.gz 4174347 SHA256 03033d264b29fd791299d5d618bd061853c008ac8087f3b6c4870e1b8f6abc39 SHA512 746e4de102f15ea10085ca21eeed74dd8264742ba7029cb54caf87b72070ab6a73e79af46d97717323be1e68d9d1fa78807d5d4446d15524aa4c565650f7b0d0 WHIRLPOOL ff8dfcc3dd7e87a7316f94a3b8f199cd902cbf99772bb97147b9af37b8c6941f13341438450b3dbf3139d5518488e74df6b77c1eec3182e92a9476ccb951ec5b DIST rsyslog-docs-8.19.0.tar.gz 4271094 SHA256 f76958d2fbcbb3a2db531ec3878d6d9a8c4a622e457b9c97b7c7dcca0ddd6512 SHA512 120f229a641119649fc897948fb0934039a95d0ef63e68b10ab635620d84988d794fd5dc33617353028e786513a86b3a1cd0c4fef9c755dab5bedd8e0246532e WHIRLPOOL fc0642eef4e686fc653db6a654f96fd9037e083a02e06d64b7b2a2e0292d745ca6e24821df3b9825e0eba2c4808b2755dfaeb90b62a49662ab22a171ffe2e63b DIST rsyslog-docs-8.22.0.tar.gz 4307880 SHA256 4367e52dddcaca111c40585aa632a9dc68f27ae2e5a51685a08dbabf4e1d2c59 SHA512 e1d09182d564985ede4826b7366e183d75abf67b24e3aa65d607fc080cf6901612dbbb32188c640b69a4562b2bee2018b4116c6d0fa18ceb1575b9b700e85481 WHIRLPOOL 0f5aa06ce8b4c1c5aabbe378c67052ca54c730709736025b70c553cb4caaf7c9e257ea4146f3cc40d59ec3d3f34ef38df2683421fcffb89dc95fd65644eb2ee2 DIST rsyslog-docs-8.23.0.tar.gz 4316852 SHA256 c2b23952e5878af334a7b71de76fc6bd432e90dff968da545d3bd73f8a4a147f SHA512 5c57159e17c728e0fcada5cd03dfe45edca2f9b6554628729387eedb94936c0ef16254f5b0e3524dd6ce732d57e42994e1293478bd28b51747a49f725f148bc0 WHIRLPOOL 8cb566131a9ae491a2839450b58a67ad3dd2fda41aad93d265b11dc1d33b7f765f65ef82166c79f2588fc4543f1aac570921242b61c226849218649bf6b943b3 +DIST rsyslog-docs-8.24.0.tar.gz 4344877 SHA256 f5e3c27c5b65abdd600b8ad8d99d1f2fe9f0ffca02d6af3c12db5fc10dd889b2 SHA512 b55cde1485a7baec6d4c4928107c22a078cf412a2994c0dfcbb12c47b49c3b263af8a64011b1329567cf86e04927b9e383581dc868eaea81d554adada6b3786b WHIRLPOOL e8b2d10b0de3c33189f859f08db58e319730e709e5a5008909f2166a061952290b0bf96163cdf6e0b3829896916f712ba5d8a2a98f02d796e9174d8919190f8d diff --git a/app-admin/rsyslog/rsyslog-8.24.0.ebuild b/app-admin/rsyslog/rsyslog-8.24.0.ebuild new file mode 100644 index 00000000..4559e20 --- /dev/null +++ b/app-admin/rsyslog/rsyslog-8.24.0.ebuild @@ -0,0 +1,453 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="6" + +inherit autotools eutils linux-info systemd + +DESCRIPTION="An enhanced multi-threaded syslogd with database support and more" +HOMEPAGE="http://www.rsyslog.com/" + +BRANCH="8-stable" + +if [[ ${PV} == "9999" ]]; then + EGIT_REPO_URI=" + git://github.com/rsyslog/${PN}.git + https://github.com/rsyslog/${PN}.git + " + + DOC_REPO_URI=" + git://github.com/rsyslog/${PN}-doc.git + https://github.com/rsyslog/${PN}-doc.git + " + + inherit git-r3 +else + MY_PV=${PV%_rc*} + MY_FILENAME="${PN}-${PV}.tar.gz" + MY_FILENAME_DOCS="${PN}-docs-${PV}.tar.gz" + S="${WORKDIR}/${PN}-${MY_PV}" + + # Upstream URL schema: + # RC: http://www.rsyslog.com/files/download/rsyslog/rc/rsyslog-8.18.0.tar.gz + # http://www.rsyslog.com/files/download/rsyslog/rc2/rsyslog-8.18.0.tar.gz + # Release: http://www.rsyslog.com/files/download/rsyslog/rsyslog-8.18.0.tar.gz + + MY_URL_PREFIX= + if [[ ${PV} = *_rc* ]]; then + _tmp_last_index=$(($(get_last_version_component_index ${PV})+1)) + _tmp_suffix=$(get_version_component_range ${_tmp_last_index} ${PV}) + if [[ ${_tmp_suffix} = *rc* ]]; then + MY_URL_PREFIX="${_tmp_suffix}/" + fi + + # Cleaning up temporary variables + unset _tmp_last_index + unset _tmp_suffix + else + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~x86" + fi + + SRC_URI=" + http://www.rsyslog.com/files/download/${PN}/${MY_URL_PREFIX}${PN}-${MY_PV}.tar.gz -> ${MY_FILENAME} + doc? ( http://www.rsyslog.com/files/download/${PN}/${MY_URL_PREFIX}${PN}-doc-${MY_PV}.tar.gz -> ${MY_FILENAME_DOCS} ) + " +fi + +LICENSE="GPL-3 LGPL-3 Apache-2.0" +SLOT="0" +IUSE="dbi debug doc elasticsearch +gcrypt grok jemalloc kafka kerberos libressl mongodb mysql normalize omhttpfs" +IUSE+=" omudpspoof postgres rabbitmq redis relp rfc3195 rfc5424hmac snmp ssl systemd test usertools +uuid zeromq" + +RDEPEND=" + >=dev-libs/libfastjson-0.99.3:= + >=dev-libs/libestr-0.1.9 + >=dev-libs/liblogging-1.0.1:=[stdlog] + >=sys-libs/zlib-1.2.5 + dbi? ( >=dev-db/libdbi-0.8.3 ) + elasticsearch? ( >=net-misc/curl-7.35.0 ) + gcrypt? ( >=dev-libs/libgcrypt-1.5.3:= ) + grok? ( >=dev-libs/grok-0.9.2 ) + jemalloc? ( >=dev-libs/jemalloc-3.3.1:= ) + kafka? ( >=dev-libs/librdkafka-0.9.0.99:= ) + kerberos? ( virtual/krb5 ) + mongodb? ( >=dev-libs/libmongo-client-0.1.4 ) + mysql? ( virtual/mysql ) + normalize? ( + >=dev-libs/libee-0.4.0 + >=dev-libs/liblognorm-2.0.1:= + ) + omhttpfs? ( >=net-misc/curl-7.35.0 ) + omudpspoof? ( >=net-libs/libnet-1.1.6 ) + postgres? ( >=dev-db/postgresql-8.4.20:= ) + rabbitmq? ( >=net-libs/rabbitmq-c-0.3.0:= ) + redis? ( >=dev-libs/hiredis-0.11.0 ) + relp? ( >=dev-libs/librelp-1.2.12:= ) + rfc3195? ( >=dev-libs/liblogging-1.0.1:=[rfc3195] ) + rfc5424hmac? ( + !libressl? ( >=dev-libs/openssl-0.9.8y:0= ) + libressl? ( dev-libs/libressl:= ) + ) + snmp? ( >=net-analyzer/net-snmp-5.7.2 ) + ssl? ( >=net-libs/gnutls-2.12.23:0= ) + systemd? ( >=sys-apps/systemd-208 ) + uuid? ( sys-apps/util-linux:0= ) + zeromq? ( + >=net-libs/zeromq-4.1.1:= + >=net-libs/czmq-3.0.0 + )" +DEPEND="${RDEPEND} + >=sys-devel/autoconf-archive-2015.02.24 + virtual/pkgconfig + test? ( sys-libs/libfaketime )" + +if [[ ${PV} == "9999" ]]; then + DEPEND+=" doc? ( >=dev-python/sphinx-1.1.3-r7 )" + DEPEND+=" >=sys-devel/flex-2.5.39-r1" + DEPEND+=" >=sys-devel/bison-2.4.3" + DEPEND+=" >=dev-python/docutils-0.12" +fi + +CONFIG_CHECK="~INOTIFY_USER" +WARNING_INOTIFY_USER="CONFIG_INOTIFY_USER isn't set. Imfile module on this system will only support polling mode!" + +src_unpack() { + if [[ ${PV} == "9999" ]]; then + git-r3_fetch + git-r3_checkout + else + unpack ${P}.tar.gz + fi + + if use doc; then + if [[ ${PV} == "9999" ]]; then + local _EGIT_BRANCH= + if [[ -n "${EGIT_BRANCH}" ]]; then + # Cannot use rsyslog commits/branches for documentation repository + _EGIT_BRANCH=${EGIT_BRANCH} + unset EGIT_BRANCH + fi + + git-r3_fetch "${DOC_REPO_URI}" + git-r3_checkout "${DOC_REPO_URI}" "${S}"/docs + + if [[ -n "${_EGIT_BRANCH}" ]]; then + # Restore previous EGIT_BRANCH information + EGIT_BRANCH=${_EGIT_BRANCH} + fi + else + cd "${S}" || die "Cannot change dir into '${S}'" + mkdir docs || die "Failed to create docs directory" + cd docs || die "Failed to change dir into '${S}/docs'" + unpack ${MY_FILENAME_DOCS} + fi + fi +} + +src_prepare() { + default + + eautoreconf +} + +src_configure() { + # Maintainer notes: + # * Guardtime support is missing because libgt isn't yet available + # in portage. + # * Hadoop's HDFS file system output module is currently not + # supported in Gentoo because nobody is able to test it + # (JAVA dependency). + # * dev-libs/hiredis doesn't provide pkg-config (see #504614, + # upstream PR 129 and 136) so we need to export HIREDIS_* + # variables because rsyslog's build system depends on pkg-config. + + if use redis; then + export HIREDIS_LIBS="-L${EPREFIX}/usr/$(get_libdir) -lhiredis" + export HIREDIS_CFLAGS="-I${EPREFIX}/usr/include" + fi + + local myeconfargs=( + --disable-debug-symbols + --disable-generate-man-pages + --without-valgrind-testbench + $(use_enable test testbench) + # Input Plugins without depedencies + --enable-imdiag + --enable-imfile + --enable-impstats + --enable-imptcp + # Message Modificiation Plugins without depedencies + --enable-mmanon + --enable-mmaudit + --enable-mmcount + --enable-mmfields + --enable-mmjsonparse + --enable-mmpstrucdata + --enable-mmrm1stspace + --enable-mmsequence + --enable-mmutf8fix + # Output Modification Plugins without dependencies + --enable-mail + --enable-omprog + --enable-omruleset + --enable-omstdout + --enable-omuxsock + # Misc + --enable-pmaixforwardedfrom + --enable-pmciscoios + --enable-pmcisconames + --enable-pmlastmsg + --enable-pmsnare + # DB + $(use_enable dbi libdbi) + $(use_enable mongodb ommongodb) + $(use_enable mysql) + $(use_enable postgres pgsql) + $(use_enable redis omhiredis) + # Debug + $(use_enable debug) + $(use_enable debug diagtools) + $(use_enable debug memcheck) + $(use_enable debug rtinst) + $(use_enable debug valgrind) + # Misc + $(use_enable elasticsearch) + $(use_enable gcrypt libgcrypt) + $(use_enable jemalloc) + $(use_enable kafka omkafka) + $(use_enable kerberos gssapi-krb5) + $(use_enable normalize mmnormalize) + $(use_enable grok mmgrok) + $(use_enable omhttpfs) + $(use_enable omudpspoof) + $(use_enable rabbitmq omrabbitmq) + $(use_enable relp) + $(use_enable rfc3195) + $(use_enable rfc5424hmac mmrfc5424addhmac) + $(use_enable snmp) + $(use_enable snmp mmsnmptrapd) + $(use_enable ssl gnutls) + $(use_enable systemd imjournal) + $(use_enable systemd omjournal) + $(use_enable usertools) + $(use_enable uuid) + $(use_enable zeromq imczmq) + $(use_enable zeromq imzmq3) + $(use_enable zeromq omczmq) + $(use_enable zeromq omzmq3) + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" + ) + + econf "${myeconfargs[@]}" +} + +src_compile() { + default + + if use doc && [[ "${PV}" == "9999" ]]; then + einfo "Building documentation ..." + local doc_dir="${S}/docs" + cd "${doc_dir}" || die "Cannot chdir into \"${doc_dir}\"!" + sphinx-build -b html source build || die "Building documentation failed!" + fi +} + +src_test() { + local _has_increased_ulimit= + + # Sometimes tests aren't executable (i.e. when added via patch) + einfo "Adjusting permissions of test scripts ..." + find "${S}"/tests -type f -name '*.sh' \! -perm -111 -exec chmod a+x '{}' \; || \ + die "Failed to adjust test scripts permission" + + if ulimit -n 3072; then + _has_increased_ulimit="true" + fi + + if ! emake --jobs 1 check; then + eerror "Test suite failed! :(" + + if [[ -z "${_has_increased_ulimit}" ]]; then + eerror "Probably because open file limit couldn't be set to 3072." + fi + + if has userpriv ${FEATURES}; then + eerror "Please try to reproduce the test suite failure with FEATURES=-userpriv " \ + "before you submit a bug report." + fi + + fi +} + +src_install() { + local DOCS=( + AUTHORS + ChangeLog + "${FILESDIR}"/${BRANCH}/README.gentoo + ) + + use doc && local HTML_DOCS=( "${S}/docs/build/." ) + + default + + newconfd "${FILESDIR}/${BRANCH}/${PN}.confd-r1" ${PN} + newinitd "${FILESDIR}/${BRANCH}/${PN}.initd-r1" ${PN} + + keepdir /var/empty/dev + keepdir /var/spool/${PN} + keepdir /etc/ssl/${PN} + keepdir /etc/${PN}.d + + insinto /etc + newins "${FILESDIR}/${BRANCH}/${PN}.conf" ${PN}.conf + + insinto /etc/rsyslog.d/ + doins "${FILESDIR}/${BRANCH}/50-default.conf" + + insinto /etc/logrotate.d/ + newins "${FILESDIR}/${BRANCH}/${PN}.logrotate" ${PN} + + if use mysql; then + insinto /usr/share/doc/${PF}/scripts/mysql + doins plugins/ommysql/createDB.sql + fi + + if use postgres; then + insinto /usr/share/doc/${PF}/scripts/pgsql + doins plugins/ompgsql/createDB.sql + fi + + prune_libtool_files --modules +} + +pkg_postinst() { + local advertise_readme=0 + + if [[ -z "${REPLACING_VERSIONS}" ]]; then + # This is a new installation + + advertise_readme=1 + + if use mysql || use postgres; then + echo + elog "Sample SQL scripts for MySQL & PostgreSQL have been installed to:" + elog " /usr/share/doc/${PF}/scripts" + fi + + if use ssl; then + echo + elog "To create a default CA and certificates for your server and clients, run:" + elog " emerge --config =${PF}" + elog "on your logging server. You can run it several times," + elog "once for each logging client. The client certificates will be signed" + elog "using the CA certificate generated during the first run." + fi + fi + + if [[ ${advertise_readme} -gt 0 ]]; then + # We need to show the README file location + + echo "" + elog "Please read" + elog "" + elog " ${EPREFIX}/usr/share/doc/${PF}/README.gentoo*" + elog "" + elog "for more details." + fi +} + +pkg_config() { + if ! use ssl ; then + einfo "There is nothing to configure for rsyslog unless you" + einfo "used USE=ssl to build it." + return 0 + fi + + # Make sure the certificates directory exists + local CERTDIR="${EROOT}/etc/ssl/${PN}" + if [[ ! -d "${CERTDIR}" ]]; then + mkdir "${CERTDIR}" || die + fi + einfo "Your certificates will be stored in ${CERTDIR}" + + # Create a default CA if needed + if [[ ! -f "${CERTDIR}/${PN}_ca.cert.pem" ]]; then + einfo "No CA key and certificate found in ${CERTDIR}, creating them for you..." + certtool --generate-privkey \ + --outfile "${CERTDIR}/${PN}_ca.privkey.pem" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" + + cat > "${T}/${PF}.$$" <<- _EOF + cn = Portage automated CA + ca + cert_signing_key + expiration_days = 3650 + _EOF + + certtool --generate-self-signed \ + --load-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ + --outfile "${CERTDIR}/${PN}_ca.cert.pem" \ + --template "${T}/${PF}.$$" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_ca.privkey.pem" + + # Create the server certificate + echo + einfon "Please type the Common Name of the SERVER you wish to create a certificate for: " + read -r CN + + einfo "Creating private key and certificate for server ${CN}..." + certtool --generate-privkey \ + --outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" + + cat > "${T}/${PF}.$$" <<- _EOF + cn = ${CN} + tls_www_server + dns_name = ${CN} + expiration_days = 3650 + _EOF + + certtool --generate-certificate \ + --outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ + --load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ + --load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ + --load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ + --template "${T}/${PF}.$$" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" + + else + einfo "Found existing ${CERTDIR}/${PN}_ca.cert.pem, skipping CA and SERVER creation." + fi + + # Create a client certificate + echo + einfon "Please type the Common Name of the CLIENT you wish to create a certificate for: " + read -r CN + + einfo "Creating private key and certificate for client ${CN}..." + certtool --generate-privkey \ + --outfile "${CERTDIR}/${PN}_${CN}.key.pem" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_${CN}.key.pem" + + cat > "${T}/${PF}.$$" <<- _EOF + cn = ${CN} + tls_www_client + dns_name = ${CN} + expiration_days = 3650 + _EOF + + certtool --generate-certificate \ + --outfile "${CERTDIR}/${PN}_${CN}.cert.pem" \ + --load-privkey "${CERTDIR}/${PN}_${CN}.key.pem" \ + --load-ca-certificate "${CERTDIR}/${PN}_ca.cert.pem" \ + --load-ca-privkey "${CERTDIR}/${PN}_ca.privkey.pem" \ + --template "${T}/${PF}.$$" &>/dev/null + chmod 400 "${CERTDIR}/${PN}_${CN}.cert.pem" + + rm -f "${T}/${PF}.$$" + + echo + einfo "Here is the documentation on how to encrypt your log traffic:" + einfo " http://www.rsyslog.com/doc/rsyslog_tls.html" +}