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

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

  ViewVC Help
Powered by ViewVC 1.1.20