/[gentoo-x86]/net-misc/openssh/openssh-6.1_p1-r1.ebuild
Gentoo

Contents of /net-misc/openssh/openssh-6.1_p1-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Sun Mar 23 09:55:55 2014 UTC (5 years, 7 months ago) by ago
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +1 -1 lines
FILE REMOVED
Remove old

(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 7194459F)

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/openssh-6.1_p1-r1.ebuild,v 1.7 2013/12/11 09:37:15 radhermit Exp $
4
5 EAPI="4"
6 inherit eutils user flag-o-matic multilib autotools pam systemd versionator
7
8 # Make it more portable between straight releases
9 # and _p? releases.
10 PARCH=${P/_}
11
12 HPN_PATCH="${PARCH}-hpn13v11.diff.bz2"
13 LDAP_PATCH="${PARCH/-/-lpk-}-0.3.14.patch.gz"
14 X509_VER="7.2.1" X509_PATCH="${PARCH}+x509-${X509_VER}.diff.gz"
15
16 DESCRIPTION="Port of OpenBSD's free SSH release"
17 HOMEPAGE="http://www.openssh.org/"
18 SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz
19 ${HPN_PATCH:+hpn? ( http://www.psc.edu/networking/projects/hpn-ssh/${HPN_PATCH} mirror://gentoo/${HPN_PATCH} )}
20 ${LDAP_PATCH:+ldap? ( mirror://gentoo/${LDAP_PATCH} )}
21 ${X509_PATCH:+X509? ( http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH} )}
22 "
23
24 LICENSE="BSD GPL-2"
25 SLOT="0"
26 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
27 IUSE="bindist ${HPN_PATCH:++}hpn kerberos ldap ldns libedit pam selinux skey static tcpd X X509"
28
29 LIB_DEPEND="selinux? ( >=sys-libs/libselinux-1.28[static-libs(+)] )
30 skey? ( >=sys-auth/skey-1.1.5-r1[static-libs(+)] )
31 libedit? ( dev-libs/libedit[static-libs(+)] )
32 >=dev-libs/openssl-0.9.6d:0[bindist=]
33 dev-libs/openssl[static-libs(+)]
34 >=sys-libs/zlib-1.2.3[static-libs(+)]
35 tcpd? ( >=sys-apps/tcp-wrappers-7.6[static-libs(+)] )"
36 RDEPEND="
37 !static? (
38 ${LIB_DEPEND//\[static-libs(+)]}
39 ldns? (
40 !bindist? ( net-libs/ldns[ecdsa,ssl] )
41 bindist? ( net-libs/ldns[-ecdsa,ssl] )
42 )
43 )
44 pam? ( virtual/pam )
45 kerberos? ( virtual/krb5 )
46 ldap? ( net-nds/openldap )"
47 DEPEND="${RDEPEND}
48 static? (
49 ${LIB_DEPEND}
50 ldns? (
51 !bindist? ( net-libs/ldns[ecdsa,ssl,static-libs(+)] )
52 bindist? ( net-libs/ldns[-ecdsa,ssl,static-libs(+)] )
53 )
54 )
55 virtual/pkgconfig
56 virtual/os-headers
57 sys-devel/autoconf"
58 RDEPEND="${RDEPEND}
59 pam? ( >=sys-auth/pambase-20081028 )
60 userland_GNU? ( virtual/shadow )
61 X? ( x11-apps/xauth )"
62
63 S=${WORKDIR}/${PARCH}
64
65 pkg_setup() {
66 # this sucks, but i'd rather have people unable to `emerge -u openssh`
67 # than not be able to log in to their server any more
68 maybe_fail() { [[ -z ${!2} ]] && echo ${1} ; }
69 local fail="
70 $(use X509 && maybe_fail X509 X509_PATCH)
71 $(use ldap && maybe_fail ldap LDAP_PATCH)
72 $(use hpn && maybe_fail hpn HPN_PATCH)
73 "
74 fail=$(echo ${fail})
75 if [[ -n ${fail} ]] ; then
76 eerror "Sorry, but this version does not yet support features"
77 eerror "that you requested: ${fail}"
78 eerror "Please mask ${PF} for now and check back later:"
79 eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
80 die "booooo"
81 fi
82 }
83
84 save_version() {
85 # version.h patch conflict avoidence
86 mv version.h version.h.$1
87 cp -f version.h.pristine version.h
88 }
89
90 src_prepare() {
91 sed -i \
92 -e '/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:${EPREFIX}/usr/bin/xauth:' \
93 pathnames.h || die
94 # keep this as we need it to avoid the conflict between LPK and HPN changing
95 # this file.
96 cp version.h version.h.pristine
97
98 # don't break .ssh/authorized_keys2 for fun
99 sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
100
101 epatch "${FILESDIR}"/${PN}-5.9_p1-sshd-gssapi-multihomed.patch #378361
102 if use X509 ; then
103 pushd .. >/dev/null
104 epatch "${FILESDIR}"/${PN}-6.1_p1-x509-glue.patch
105 popd >/dev/null
106 epatch "${WORKDIR}"/${X509_PATCH%.*}
107 epatch "${FILESDIR}"/${PN}-6.1_p1-x509-hpn-glue.patch
108 save_version X509
109 fi
110 if ! use X509 ; then
111 if [[ -n ${LDAP_PATCH} ]] && use ldap ; then
112 epatch "${WORKDIR}"/${LDAP_PATCH%.*}
113 save_version LPK
114 fi
115 else
116 use ldap && ewarn "Sorry, X509 and LDAP conflict internally, disabling LDAP"
117 fi
118 epatch "${FILESDIR}"/${PN}-6.0_p1-fix-freebsd-compilation.patch #391011
119 epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
120 if [[ -n ${HPN_PATCH} ]] && use hpn; then
121 epatch "${WORKDIR}"/${HPN_PATCH%.*}
122 epatch "${FILESDIR}"/${PN}-5.6_p1-hpn-progressmeter.patch
123 save_version HPN
124 # The AES-CTR multithreaded variant is broken, and causes random hangs
125 # when combined background threading and control sockets. To avoid
126 # this, we change the internal table to use the non-multithread version
127 # for the meantime. Do NOT remove this in new versions. See bug #354113
128 # comment #6 for testcase.
129 # Upstream reference: http://www.psc.edu/networking/projects/hpn-ssh/
130 ## Additionally, the MT-AES-CTR mode cipher replaces the default ST-AES-CTR mode
131 ## cipher. Be aware that if the client process is forked using the -f command line
132 ## option the process will hang as the parent thread gets 'divorced' from the key
133 ## generation threads. This issue will be resolved as soon as possible
134 sed -i \
135 -e '/aes...-ctr.*SSH_CIPHER_SSH2/s,evp_aes_ctr_mt,evp_aes_128_ctr,' \
136 cipher.c || die
137 fi
138
139 tc-export PKG_CONFIG
140 sed -i "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):" configure{,.ac} || die
141
142 # Disable PATH reset, trust what portage gives us. bug 254615
143 sed -i -e 's:^PATH=/:#PATH=/:' configure || die
144
145 epatch_user #473004
146
147 # Now we can build a sane merged version.h
148 (
149 sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
150 macros=()
151 for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
152 printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
153 ) > version.h
154
155 eautoreconf
156 }
157
158 static_use_with() {
159 local flag=$1
160 if use static && use ${flag} ; then
161 ewarn "Disabling '${flag}' support because of USE='static'"
162 # rebuild args so that we invert the first one (USE flag)
163 # but otherwise leave everything else working so we can
164 # just leverage use_with
165 shift
166 [[ -z $1 ]] && flag="${flag} ${flag}"
167 set -- !${flag} "$@"
168 fi
169 use_with "$@"
170 }
171
172 src_configure() {
173 local myconf
174 addwrite /dev/ptmx
175 addpredict /etc/skey/skeykeys #skey configure code triggers this
176
177 use static && append-ldflags -static
178
179 # Special settings for Gentoo/FreeBSD 9.0 or later (see bug #391011)
180 if use elibc_FreeBSD && version_is_at_least 9.0 "$(uname -r|sed 's/\(.\..\).*/\1/')" ; then
181 myconf="${myconf} --disable-utmp --disable-wtmp --disable-wtmpx"
182 append-ldflags -lutil
183 fi
184
185 econf \
186 --with-ldflags="${LDFLAGS}" \
187 --disable-strip \
188 --with-pid-dir="${EPREFIX}"/var/run \
189 --sysconfdir="${EPREFIX}"/etc/ssh \
190 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/misc \
191 --datadir="${EPREFIX}"/usr/share/openssh \
192 --with-privsep-path="${EPREFIX}"/var/empty \
193 --with-privsep-user=sshd \
194 --with-md5-passwords \
195 --with-ssl-engine \
196 $(static_use_with pam) \
197 $(static_use_with kerberos kerberos5 /usr) \
198 ${LDAP_PATCH:+$(use X509 || ( use ldap && use_with ldap ))} \
199 $(use_with ldns) \
200 $(use_with libedit) \
201 $(use_with selinux) \
202 $(use_with skey) \
203 $(use_with tcpd tcp-wrappers) \
204 ${myconf}
205 }
206
207 src_install() {
208 emake install-nokeys DESTDIR="${D}"
209 fperms 600 /etc/ssh/sshd_config
210 dobin contrib/ssh-copy-id
211 newinitd "${FILESDIR}"/sshd.rc6.4 sshd
212 newconfd "${FILESDIR}"/sshd.confd sshd
213 keepdir /var/empty
214
215 # not all openssl installs support ecc, or are functional #352645
216 if ! grep -q '#define OPENSSL_HAS_ECC 1' config.h ; then
217 elog "dev-libs/openssl was built with 'bindist' - disabling ecdsa support"
218 sed -i 's:&& gen_key ecdsa::' "${ED}"/etc/init.d/sshd || die
219 fi
220
221 newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
222 if use pam ; then
223 sed -i \
224 -e "/^#UsePAM /s:.*:UsePAM yes:" \
225 -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
226 -e "/^#PrintMotd /s:.*:PrintMotd no:" \
227 -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
228 "${ED}"/etc/ssh/sshd_config || die "sed of configuration file failed"
229 fi
230
231 # Gentoo tweaks to default config files
232 cat <<-EOF >> "${ED}"/etc/ssh/sshd_config
233
234 # Allow client to pass locale environment variables #367017
235 AcceptEnv LANG LC_*
236 EOF
237 cat <<-EOF >> "${ED}"/etc/ssh/ssh_config
238
239 # Send locale environment variables #367017
240 SendEnv LANG LC_*
241 EOF
242
243 # This instruction is from the HPN webpage,
244 # Used for the server logging functionality
245 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
246 keepdir /var/empty/dev
247 fi
248
249 if ! use X509 && [[ -n ${LDAP_PATCH} ]] && use ldap ; then
250 insinto /etc/openldap/schema/
251 newins openssh-lpk_openldap.schema openssh-lpk.schema
252 fi
253
254 doman contrib/ssh-copy-id.1
255 dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
256
257 diropts -m 0700
258 dodir /etc/skel/.ssh
259
260 systemd_dounit "${FILESDIR}"/sshd.{service,socket}
261 systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service'
262 }
263
264 src_test() {
265 local t tests skipped failed passed shell
266 tests="interop-tests compat-tests"
267 skipped=""
268 shell=$(egetshell ${UID})
269 if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
270 elog "Running the full OpenSSH testsuite"
271 elog "requires a usable shell for the 'portage'"
272 elog "user, so we will run a subset only."
273 skipped="${skipped} tests"
274 else
275 tests="${tests} tests"
276 fi
277 # It will also attempt to write to the homedir .ssh
278 local sshhome=${T}/homedir
279 mkdir -p "${sshhome}"/.ssh
280 for t in ${tests} ; do
281 # Some tests read from stdin ...
282 HOMEDIR="${sshhome}" \
283 emake -k -j1 ${t} </dev/null \
284 && passed="${passed}${t} " \
285 || failed="${failed}${t} "
286 done
287 einfo "Passed tests: ${passed}"
288 ewarn "Skipped tests: ${skipped}"
289 if [[ -n ${failed} ]] ; then
290 ewarn "Failed tests: ${failed}"
291 die "Some tests failed: ${failed}"
292 else
293 einfo "Failed tests: ${failed}"
294 return 0
295 fi
296 }
297
298 pkg_preinst() {
299 enewgroup sshd 22
300 enewuser sshd 22 -1 /var/empty sshd
301 }
302
303 pkg_postinst() {
304 if has_version "<${CATEGORY}/${PN}-5.8_p1" ; then
305 elog "Starting with openssh-5.8p1, the server will default to a newer key"
306 elog "algorithm (ECDSA). You are encouraged to manually update your stored"
307 elog "keys list as servers update theirs. See ssh-keyscan(1) for more info."
308 fi
309 ewarn "Remember to merge your config files in /etc/ssh/ and then"
310 ewarn "reload sshd: '/etc/init.d/sshd reload'."
311 # This instruction is from the HPN webpage,
312 # Used for the server logging functionality
313 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
314 echo
315 einfo "For the HPN server logging patch, you must ensure that"
316 einfo "your syslog application also listens at /var/empty/dev/log."
317 fi
318 }

  ViewVC Help
Powered by ViewVC 1.1.20