diff --git a/templates/openssh-client b/templates/openssh-client new file mode 120000 index 00000000000..dc275a7a7e1 --- /dev/null +++ b/templates/openssh-client @@ -0,0 +1 @@ +openssh \ No newline at end of file diff --git a/templates/openssh-server b/templates/openssh-server new file mode 120000 index 00000000000..dc275a7a7e1 --- /dev/null +++ b/templates/openssh-server @@ -0,0 +1 @@ +openssh \ No newline at end of file diff --git a/templates/openssh/client.template b/templates/openssh/client.template new file mode 100644 index 00000000000..4dfbcc4938b --- /dev/null +++ b/templates/openssh/client.template @@ -0,0 +1,34 @@ +# Template file for 'openssh-client'. +# +short_desc="${short_desc} (client files)" +long_desc="${long_desc} + + This package contains the ${pkgname} client files." + +conf_files="/etc/ssh/ssh_config" + +Add_dependency run glibc +Add_dependency run zlib +Add_dependency run openssl +Add_dependency run openssh + +do_install() +{ + local destdir=${XBPS_DESTDIR}/${pkgname}-${version} + local origdir=${XBPS_DESTDIR}/${sourcepkg}-${version} + + mkdir -p ${destdir}/usr/bin + mkdir -p ${destdir}/etc/ssh + mkdir -p ${destdir}/usr/share/man/man1 + mkdir -p ${destdir}/usr/share/man/man5 + for f in scp sftp slogin ssh ssh-add ssh-agent \ + ssh-copy-id ssh-keyscan findssl; do + mv ${origdir}/usr/bin/${f} ${destdir}/usr/bin + [ ! -f ${origdir}/usr/share/man/man1/${f}.1 ] && continue + mv ${origdir}/usr/share/man/man1/${f}.1 \ + ${destdir}/usr/share/man/man1 + done + mv ${origdir}/etc/ssh/ssh_config ${destdir}/etc/ssh + mv ${origdir}/usr/share/man/man5/ssh_config.5 \ + ${destdir}/usr/share/man/man5 +} diff --git a/templates/openssh/files/sshd b/templates/openssh/files/sshd new file mode 100644 index 00000000000..2e5aeeb585e --- /dev/null +++ b/templates/openssh/files/sshd @@ -0,0 +1,58 @@ +#!/bin/sh +# +# $NetBSD: sshd.sh,v 1.11 2003/05/22 09:05:38 wiz Exp $ +# +# PROVIDE: sshd +# REQUIRE: DAEMON LOGIN + +$_rc_subr_loaded . /etc/rc.subr + +name="sshd" +rcvar=$name +command="/usr/sbin/${name}" +keygen_command="/usr/bin/ssh-keygen" +pidfile="/var/run/${name}.pid" +required_files="/etc/ssh/sshd_config" +extra_commands="keygen reload" + +sshd_keygen() +{ + ( + umask 022 + if [ -f /etc/ssh/ssh_host_key ]; then + echo "You already have an RSA host key in /etc/ssh/ssh_host_key" + echo "Skipping protocol version 1 RSA Key Generation" + else + ${keygen_command} -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N '' + fi + + if [ -f /etc/ssh/ssh_host_dsa_key ]; then + echo "You already have a DSA host key in /etc/ssh/ssh_host_dsa_key" + echo "Skipping protocol version 2 DSA Key Generation" + else + ${keygen_command} -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' + fi + + if [ -f /etc/ssh/ssh_host_rsa_key ]; then + echo "You already have a RSA host key in /etc/ssh/ssh_host_rsa_key" + echo "Skipping protocol version 2 RSA Key Generation" + else + ${keygen_command} -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' + fi + ) +} + +sshd_precmd() +{ + if [ ! -f /etc/ssh/ssh_host_key -o \ + ! -f /etc/ssh/ssh_host_dsa_key -o \ + ! -f /etc/ssh/ssh_host_rsa_key ]; then + run_rc_command keygen + fi +} + +keygen_cmd=sshd_keygen +start_precmd=sshd_precmd + +load_rc_config $name +run_rc_command "$1" diff --git a/templates/openssh/install.diff b/templates/openssh/install.diff new file mode 100644 index 00000000000..95c0e5b0d69 --- /dev/null +++ b/templates/openssh/install.diff @@ -0,0 +1,11 @@ +--- Makefile.in.orig 2009-03-08 19:04:14.598965190 +0100 ++++ Makefile.in 2009-03-08 19:04:27.324968206 +0100 +@@ -232,7 +232,7 @@ distprep: catman-do + -rm -rf autom4te.cache + (cd scard && $(MAKE) -f Makefile.in distprep) + +-install: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config ++install: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files install-sysconf host-key + install-nokeys: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files install-sysconf + install-nosysconf: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files + diff --git a/templates/openssh/server.template b/templates/openssh/server.template new file mode 100644 index 00000000000..e04d6108b31 --- /dev/null +++ b/templates/openssh/server.template @@ -0,0 +1,37 @@ +# Template file for 'openssh-server'. +# +short_desc="${short_desc} (server files)" +long_desc="${long_desc} + + This package contains the ${pkgname} server files." + +conf_files="/etc/ssh/sshd_config /etc/pam.d/sshd" +Add_dependency run glibc +Add_dependency run zlib +Add_dependency run openssl +Add_dependency run pam +Add_dependency run openssh + +do_install() +{ + local destdir=${XBPS_DESTDIR}/${pkgname}-${version} + local origdir=${XBPS_DESTDIR}/${sourcepkg}-${version} + + mkdir -p ${destdir}/etc/ssh + mkdir -p ${destdir}/usr/libexec/openssh + mkdir -p ${destdir}/usr/share/man/man5 + mkdir -p ${destdir}/usr/share/man/man8 + mv ${origdir}/usr/libexec/openssh/sftp-server \ + ${destdir}/usr/libexec/openssh + mv ${origdir}/etc/ssh/sshd_config ${destdir}/etc/ssh + mv ${origdir}/usr/sbin ${destdir}/usr + mv ${origdir}/usr/share/man/man5/sshd_config.5 \ + ${destdir}/usr/share/man/man5 + for f in sftp-server sshd; do + mv ${origdir}/usr/share/man/man8/${f}.8 \ + ${destdir}/usr/share/man/man8 + done + mv ${origdir}/etc/pam.d ${destdir}/etc + mv ${origdir}/etc/rc.d ${destdir}/etc + mv ${origdir}/var ${destdir} +} diff --git a/templates/openssh/template b/templates/openssh/template new file mode 100644 index 00000000000..c5f727b07bd --- /dev/null +++ b/templates/openssh/template @@ -0,0 +1,62 @@ +# Template file for 'openssh' +pkgname=openssh +sourcepkg=openssh +version=5.2p1 +distfiles=" +http://sunsite.rediris.es/pub/OpenBSD/OpenSSH/portable/$pkgname-$version.tar.gz" +build_style=gnu_configure +configure_args="--libexecdir=/usr/libexec/openssh + --datadir=/usr/share/openssh --sysconfdir=/etc/ssh + --with-privsep-user=nobody --with-md5-passwords + --with-pam --with-mantype=man --mandir=/usr/share/man + --with-xauth=/usr/bin/xauth --without-rpath --with-ssl-engine + --without-selinux --with-privsep-path=/var/chroot/ssh" +make_install_target="DESTDIR=$XBPS_DESTDIR/$pkgname-$version install" +short_desc="The OpenSSH implementation of SSH protocol versions 1 and 2" +maintainer="Juan RP " +checksum=4023710c37d0b3d79e6299cb79b6de2a31db7d581fe59e775a5351784034ecae +long_desc=" + SSH (Secure SHell) is a program for logging into and executing + commands on a remote machine. SSH is intended to replace rlogin and + rsh, and to provide secure encrypted communications between two + untrusted hosts over an insecure network. X11 connections and + arbitrary TCP/IP ports can also be forwarded over the secure channel. + + OpenSSH is OpenBSD's version of the last free version of SSH, bringing + it up to date in terms of security and features, as well as removing + all patented algorithms to separate libraries. + + This package includes the core files necessary for both the OpenSSH + client and server. To make this package useful, you should also + install openssh-client, openssh-server, or both." + +conf_files="/etc/ssh/moduli" + +subpackages="client server" + +Add_dependency full glibc +Add_dependency full zlib +Add_dependency full openssl +Add_dependency full pam +Add_dependency full shadow + +post_install() +{ + local destdir=$XBPS_DESTDIR/$pkgname-$version + + install -D -m644 ${wrksrc}/contrib/sshd.pam.generic \ + ${destdir}/etc/pam.d/sshd + install -D -m755 ${wrksrc}/contrib/findssl.sh \ + ${destdir}/usr/bin/findssl + install -D -m755 ${wrksrc}/contrib/ssh-copy-id \ + ${destdir}/usr/bin/ssh-copy-id + install -D -m644 ${wrksrc}/contrib/ssh-copy-id.1 \ + ${destdir}/usr/share/man/man1/ssh-copy-id.1 + install -D -m755 ${FILESDIR}/sshd ${destdir}/etc/rc.d/sshd + + sed -i \ + -e 's|^#ListenAddress 0.0.0.0|ListenAddress 0.0.0.0|g' \ + -e 's|^#UsePAM no|UsePAM yes|g' \ + -e 's|^#ChallengeResponseAuthentication yes|ChallengeResponseAuthentication no|g' \ + ${destdir}/etc/ssh/sshd_config +}