Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-block/partimage/, sys-block/partimage/files/
Date: Fri, 04 Jan 2019 20:54:37
Message-Id: 1546635246.3fe8e9910002b6523d995512a646b063565d0447.whissi@gentoo
1 commit: 3fe8e9910002b6523d995512a646b063565d0447
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 4 20:51:46 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 4 20:54:06 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3fe8e991
7
8 sys-block/partimage: add OpenSSL 1.1+ compatibility
9
10 - EAPI bumped to EAPI=6
11
12 - OpenSSL 1.1+ compatibility added
13
14 Closes: https://bugs.gentoo.org/674074
15 Package-Manager: Portage-2.3.53, Repoman-2.3.12
16 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
17
18 ...partimage-0.6.9-openssl-1.1-compatibility.patch | 41 ++++++
19 sys-block/partimage/partimage-0.6.9-r1.ebuild | 144 +++++++++++++++++++++
20 2 files changed, 185 insertions(+)
21
22 diff --git a/sys-block/partimage/files/partimage-0.6.9-openssl-1.1-compatibility.patch b/sys-block/partimage/files/partimage-0.6.9-openssl-1.1-compatibility.patch
23 new file mode 100644
24 index 00000000000..af4d9c153df
25 --- /dev/null
26 +++ b/sys-block/partimage/files/partimage-0.6.9-openssl-1.1-compatibility.patch
27 @@ -0,0 +1,41 @@
28 +--- a/configure.ac
29 ++++ b/configure.ac
30 +@@ -240,7 +240,7 @@ if test "$SSL" = "yes"; then
31 + AC_CHECKING([ for SSL Library and Header files ... ])
32 + AC_SEARCH_HEADERS(rsa.h crypto.h x509.h pem.h ssl.h err.h,
33 + $SSL_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include,
34 +- [ AC_CHECK_LIB(crypto, CRYPTO_lock, [LIBS="$LIBS -lcrypto"],
35 ++ [ AC_CHECK_LIB(crypto, X509_new, [LIBS="$LIBS -lcrypto"],
36 + AC_MSG_ERROR([ Required for SSL Crypto Library not found. ])
37 + )
38 + AC_CHECK_LIB(ssl, SSL_CTX_new,
39 +--- a/src/client/netclient.cpp
40 ++++ b/src/client/netclient.cpp
41 +@@ -43,7 +43,11 @@ CNetClient::CNetClient(bool bMustLogin, bool bUseSSL):CNet()
42 + {
43 + showDebug(3, "initializing client ssl\n");
44 + SSLeay_add_ssl_algorithms();
45 +- meth = SSLv2_client_method();
46 ++#if OPENSSL_VERSION_NUMBER < 0x10100000
47 ++ meth = TLSv1_client_method();
48 ++#else
49 ++ meth = TLS_client_method();
50 ++#endif
51 + SSL_load_error_strings();
52 + ctx = SSL_CTX_new(meth);
53 + if (!ctx)
54 +--- a/src/server/netserver.cpp
55 ++++ b/src/server/netserver.cpp
56 +@@ -39,7 +39,11 @@ CNetServer::CNetServer(unsigned short int port):CNet()
57 + {
58 + SSL_load_error_strings();
59 + SSLeay_add_ssl_algorithms();
60 +- meth = SSLv23_server_method();
61 ++#if OPENSSL_VERSION_NUMBER < 0x10100000
62 ++ meth = TLSv1_server_method();
63 ++#else
64 ++ meth = TLS_server_method();
65 ++#endif
66 + ctx = SSL_CTX_new(meth);
67 + if (!ctx)
68 + {
69
70 diff --git a/sys-block/partimage/partimage-0.6.9-r1.ebuild b/sys-block/partimage/partimage-0.6.9-r1.ebuild
71 new file mode 100644
72 index 00000000000..5828263d381
73 --- /dev/null
74 +++ b/sys-block/partimage/partimage-0.6.9-r1.ebuild
75 @@ -0,0 +1,144 @@
76 +# Copyright 1999-2019 Gentoo Authors
77 +# Distributed under the terms of the GNU General Public License v2
78 +
79 +EAPI=6
80 +inherit autotools flag-o-matic pam user
81 +
82 +DESCRIPTION="Console-based application to efficiently save raw partition data to image file"
83 +HOMEPAGE="http://www.partimage.org/"
84 +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
85 +
86 +LICENSE="GPL-2"
87 +SLOT="0"
88 +KEYWORDS="~amd64 ~ppc ~sparc ~x86"
89 +IUSE="nls nologin pam ssl static"
90 +
91 +LIBS_DEPEND="app-arch/bzip2
92 + >=dev-libs/newt-0.52
93 + >=sys-libs/slang-2
94 + sys-libs/zlib:=
95 + ssl? ( dev-libs/openssl:0= )"
96 +PAM_DEPEND="!static? ( pam? ( virtual/pam ) )"
97 +RDEPEND="${PAM_DEPEND}
98 + !static? ( ${LIBS_DEPEND} )"
99 +DEPEND="${PAM_DEPEND}
100 + ${LIBS_DEPEND}
101 + nls? ( sys-devel/gettext )"
102 +
103 +pkg_setup() {
104 + enewgroup partimag 91
105 + enewuser partimag 91 -1 /var/lib/partimage partimag
106 +}
107 +
108 +src_prepare() {
109 + eapply -p0 "${FILESDIR}"/${P}-zlib-1.2.5.2.patch #405323
110 + eapply "${FILESDIR}"/${P}-minor-typo.patch #580290
111 + eapply "${FILESDIR}"/${P}-openssl-1.1-compatibility.patch
112 +
113 + eapply_user
114 +
115 + eautoreconf
116 +}
117 +
118 +src_configure() {
119 + # XXX: Do we still need these?
120 + filter-flags -fno-exceptions
121 + use ppc && append-flags -fsigned-char
122 +
123 + local myconf
124 +
125 + use nologin && myconf="${myconf} --disable-login"
126 +
127 + if use pam && ! use static; then
128 + myconf="${myconf} --enable-pam"
129 + fi
130 +
131 + econf \
132 + --docdir="${EPREFIX%/}"/usr/share/doc/${PF} \
133 + --sysconfdir="${EPREFIX%/}"/etc \
134 + $(use_enable nls) \
135 + $(use_enable ssl) \
136 + --disable-pam \
137 + $(use_enable static all-static) \
138 + --with-log-dir="${EPREFIX%/}"/var/log/partimage \
139 + ${myconf}
140 +}
141 +
142 +src_install() {
143 + default
144 +
145 + keepdir /var/lib/partimage
146 + keepdir /var/log/partimage
147 +
148 + newinitd "${FILESDIR}"/partimaged.init.2 partimaged
149 + newconfd "${FILESDIR}"/partimaged.conf partimaged
150 +
151 + if use ssl; then
152 + insinto /etc/partimaged
153 + doins "${FILESDIR}"/servercert.cnf
154 + fi
155 +
156 + if use pam; then
157 + newpamd "${FILESDIR}"/partimaged.pam.2 partimaged
158 + fi
159 +}
160 +
161 +confdir=${EROOT%/}/etc/partimaged
162 +privkey=${confdir}/partimaged.key
163 +cnf=${confdir}/servercert.cnf
164 +csr=${confdir}/partimaged.csr
165 +cert=${confdir}/partimaged.cert
166 +
167 +pkg_config() {
168 + if use ssl; then
169 + ewarn "Please customize /etc/partimaged/servercert.cnf before you continue!"
170 + ewarn "Press Ctrl-C to break now for it, or press enter to continue."
171 + read
172 + if [ ! -f ${privkey} ]; then
173 + einfo "Generating unencrypted private key: ${privkey}"
174 + openssl genrsa -out ${privkey} 1024 || die
175 + else
176 + einfo "Private key already exists: ${privkey}"
177 + fi
178 + if [ ! -f ${csr} ]; then
179 + einfo "Generating certificate request: ${csr}"
180 + openssl req -new -x509 -outform PEM -out ${csr} -key ${privkey} -config ${cnf} || die
181 + else
182 + einfo "Certificate request already exists: ${csr}"
183 + fi
184 + if [ ! -f ${cert} ]; then
185 + einfo "Generating self-signed certificate: ${cert}"
186 + openssl x509 -in ${csr} -out ${cert} -signkey ${privkey} || die
187 + else
188 + einfo "Self-signed certifcate already exists: ${cert}"
189 + fi
190 + einfo "Setting permissions"
191 + partimagesslperms || die
192 + einfo "Done"
193 + else
194 + einfo "SSL is disabled, not building certificates"
195 + fi
196 +}
197 +
198 +partimagesslperms() {
199 + local ret=0
200 + chmod 600 ${privkey} 2>/dev/null
201 + ret=$((${ret}+$?))
202 + chown partimag:0 ${privkey} 2>/dev/null
203 + ret=$((${ret}+$?))
204 + chmod 644 ${cert} ${csr} 2>/dev/null
205 + ret=$((${ret}+$?))
206 + chown root:0 ${cert} ${csr} 2>/dev/null
207 + ret=$((${ret}+$?))
208 + return $ret
209 +}
210 +
211 +pkg_postinst() {
212 + if use ssl; then
213 + einfo "To create the required SSL certificates, please do:"
214 + einfo "emerge --config =${PF}"
215 + partimagesslperms
216 + return 0
217 + fi
218 + chown partimag:0 "${EROOT%/}"/etc/partimaged/partimagedusers || die
219 +}