/[gentoo-x86]/net-misc/openssh/openssh-6.6.1_p1-r4.ebuild
Gentoo

Contents of /net-misc/openssh/openssh-6.6.1_p1-r4.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sat Jan 31 18:05:34 2015 UTC (4 years, 7 months ago) by polynomial-c
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Removed old (and vulnerable) versions

(Portage version: 2.2.15/cvs/Linux x86_64, signed Manifest commit with key 0x981CA6FC)

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

  ViewVC Help
Powered by ViewVC 1.1.20