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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sat Nov 9 23:08:03 2013 UTC (6 years ago) by radhermit
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Remove insecure version due to improperly using the 6.3_p1 tarball.

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

  ViewVC Help
Powered by ViewVC 1.1.20