1 |
# Copyright 1999-2003 Gentoo Technologies, Inc. |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /home/cvsroot/gentoo-x86/net-misc/openssh/openssh-3.4_p1-r2.ebuild,v 1.12 2003/03/11 21:11:46 seemant Exp $ |
4 |
|
5 |
IUSE="ipv6 static pam tcpd" |
6 |
|
7 |
# Make it more portable between straight releases |
8 |
# and _p? releases. |
9 |
PARCH=${P/_/} |
10 |
S=${WORKDIR}/${PARCH} |
11 |
DESCRIPTION="Port of OpenBSD's free SSH release" |
12 |
HOMEPAGE="http://www.openssh.com/" |
13 |
SRC_URI="ftp://ftp.openbsd.org/pub/unix/OpenBSD/OpenSSH/portable/${PARCH}.tar.gz" |
14 |
|
15 |
# openssh recognizes when openssl has been slightly upgraded and refuses to run. |
16 |
# This new rev will use the new openssl. |
17 |
RDEPEND="virtual/glibc |
18 |
pam? ( >=sys-libs/pam-0.73 >=sys-apps/shadow-4.0.2-r2 ) |
19 |
>=dev-libs/openssl-0.9.6d |
20 |
sys-libs/zlib" |
21 |
|
22 |
DEPEND="${RDEPEND} |
23 |
dev-lang/perl |
24 |
sys-apps/groff |
25 |
tcpd? ( >=sys-apps/tcp-wrappers-7.6 )" |
26 |
|
27 |
LICENSE="as-is" |
28 |
SLOT="0" |
29 |
KEYWORDS="x86 sparc " |
30 |
|
31 |
src_compile() { |
32 |
local myconf |
33 |
use tcpd || myconf="${myconf} --without-tcp-wrappers" |
34 |
use tcpd && myconf="${myconf} --with-tcp-wrappers" |
35 |
use pam || myconf="${myconf} --without-pam" |
36 |
use pam && myconf="${myconf} --with-pam" |
37 |
use ipv6 || myconf="${myconf} --with-ipv4-default" |
38 |
|
39 |
./configure \ |
40 |
--prefix=/usr \ |
41 |
--sysconfdir=/etc/ssh \ |
42 |
--mandir=/usr/share/man \ |
43 |
--libexecdir=/usr/lib/misc \ |
44 |
--datadir=/usr/share/openssh \ |
45 |
--disable-suid-ssh \ |
46 |
--with-privsep-path=/var/empty \ |
47 |
--with-privsep-user=sshd \ |
48 |
--host=${CHOST} ${myconf} || die "bad configure" |
49 |
|
50 |
if [ "`use static`" ] |
51 |
then |
52 |
# statically link to libcrypto -- good for the boot cd |
53 |
perl -pi -e "s|-lcrypto|/usr/lib/libcrypto.a|g" Makefile |
54 |
fi |
55 |
|
56 |
make || die " compile problem" |
57 |
} |
58 |
|
59 |
src_install() { |
60 |
make install-files DESTDIR=${D} || die |
61 |
chmod 600 ${D}/etc/ssh/sshd_config |
62 |
dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config |
63 |
insinto /etc/pam.d ; newins ${FILESDIR}/sshd.pam sshd |
64 |
exeinto /etc/init.d ; newexe ${FILESDIR}/sshd.rc6 sshd |
65 |
touch ${D}/var/empty/.keep |
66 |
} |
67 |
|
68 |
pkg_preinst() { |
69 |
|
70 |
userdel sshd 2> /dev/null |
71 |
if ! groupmod sshd; then |
72 |
groupadd -g 90 sshd 2> /dev/null || \ |
73 |
die "Failed to create sshd group" |
74 |
fi |
75 |
useradd -u 22 -g sshd -s /dev/null -d /var/empty -c "sshd" sshd || \ |
76 |
die "Failed to create sshd user" |
77 |
|
78 |
} |
79 |
|
80 |
pkg_postinst() { |
81 |
|
82 |
# empty dir for the new priv separation auth chroot.. |
83 |
install -d -m0755 -o root -g root ${ROOT}/var/empty |
84 |
|
85 |
einfo |
86 |
einfo "Remember to merge your config files in /etc/ssh!" |
87 |
einfo "As of version 3.4 the default is to enable the UsePrivelegeSeparation" |
88 |
einfo "functionality, but please ensure that you do not explicitly disable" |
89 |
einfo "this in your configuration as disabling it opens security holes" |
90 |
einfo |
91 |
einfo "This revision has removed your sshd user id and replaced it with a" |
92 |
einfo "new one with UID 22. If you have any scripts or programs that" |
93 |
einfo "that referenced the old UID directly, you will need to update them." |
94 |
einfo |
95 |
if use pam; then |
96 |
einfo "Please be aware users need a valid shell in /etc/passwd" |
97 |
einfo "in order to be allowed to login." |
98 |
einfo |
99 |
fi |
100 |
} |