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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Thu Jul 18 20:15:31 2013 UTC (6 years, 2 months ago) by radhermit
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +1 -1 lines
FILE REMOVED
Remove old.

(Portage version: 2.2.0_alpha188/cvs/Linux x86_64, signed Manifest commit with key 4AB3E85B4F064CA3)

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

  ViewVC Help
Powered by ViewVC 1.1.20