diff options
author | Omar Vega Ramos <ovruni@gnu.org.pe> | 2013-02-18 17:31:52 -0500 |
---|---|---|
committer | Omar Vega Ramos <ovruni@gnu.org.pe> | 2013-02-18 17:31:52 -0500 |
commit | 0be78807ac1a050c88f847ef0e36f5cd4d9b5725 (patch) | |
tree | ba2266308391192112ed3a843f144a2d33d59d97 /pcr/dropbear | |
parent | 4d8ea59baa9963ebbca29b35c9a7ceb914119376 (diff) |
Adding packages to pcr
Diffstat (limited to 'pcr/dropbear')
-rw-r--r-- | pcr/dropbear/PKGBUILD | 46 | ||||
-rw-r--r-- | pcr/dropbear/dropbear-conf.d | 15 | ||||
-rw-r--r-- | pcr/dropbear/dropbear-rc.d | 88 |
3 files changed, 149 insertions, 0 deletions
diff --git a/pcr/dropbear/PKGBUILD b/pcr/dropbear/PKGBUILD new file mode 100644 index 000000000..1e50534a3 --- /dev/null +++ b/pcr/dropbear/PKGBUILD @@ -0,0 +1,46 @@ +# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org> +# Contributor: Jason Pierce <`echo 'moc tod liamg ta nosaj tod ecreip' | rev`> +# Contributor: Jeremy Cowgar <jeremy@cowgar.com> + +pkgname=dropbear +pkgver=0.53.1 +pkgrel=2 +pkgdesc="Lightweight replacement for sshd" +arch=('i686' 'x86_64' 'mips64el') +url="http://matt.ucc.asn.au/dropbear/dropbear.html" +license=('custom:BSD' 'custom:PD') +depends=('zlib') +source=(http://matt.ucc.asn.au/$pkgname/releases/$pkgname-$pkgver.tar.bz2 \ + $pkgname-conf.d \ + $pkgname-rc.d) +sha256sums=('e24d3cbecd3bc850b2b336b8eb50c845a285ceef8e22544938a582e163d36393' + 'eaec8cecae4476a660351ba9079c91b7c379146a22df881bd24b81af8f50d74c' + '29ab5438d15bfa727620fc04ec52ff55d676577b903c9261ce00bb291ae171a8') + +build() { + cd ${srcdir}/$pkgname-$pkgver + + sed -i 's:usr/libexec/sftp:usr/lib/ssh/sftp:' options.h + + ./configure --prefix=/usr + LIBS="-lcrypt" make +} + +package() { + cd ${srcdir}/$pkgname-$pkgver + + make prefix=${pkgdir}/usr install + +#man pages + install -D -m644 dbclient.1 ${pkgdir}/usr/share/man/man1/dbclient.1 + install -D -m644 $pkgname.8 ${pkgdir}/usr/share/man/man8/$pkgname.8 + install -D -m644 dropbearkey.8 ${pkgdir}/usr/share/man/man8/dropbearkey.8 + +#configuration files + install -d ${pkgdir}/etc/$pkgname + install -D -m644 ${srcdir}/$pkgname-conf.d ${pkgdir}/etc/conf.d/$pkgname + install -D -m755 ${srcdir}/$pkgname-rc.d ${pkgdir}/etc/rc.d/$pkgname + +#license file + install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE +} diff --git a/pcr/dropbear/dropbear-conf.d b/pcr/dropbear/dropbear-conf.d new file mode 100644 index 000000000..6f3b8f0c5 --- /dev/null +++ b/pcr/dropbear/dropbear-conf.d @@ -0,0 +1,15 @@ +# the TCP port that Dropbear listens on +DROPBEAR_PORT="127.0.0.1:22" # Default to local-only. + +# any additional arguments for Dropbear +DROPBEAR_EXTRA_ARGS="-w" # Default to no-root logins. + +# specify an optional banner file containing a message to be +# sent to clients before they connect, such as "/etc/issue.net" +DROPBEAR_BANNER="" + +# RSA hostkey file (default: /etc/dropbear/dropbear_rsa_host_key) +#DROPBEAR_RSAKEY="/etc/dropbear/dropbear_rsa_host_key" + +# DSS hostkey file (default: /etc/dropbear/dropbear_dss_host_key) +DROPBEAR_DSSKEY="/etc/dropbear/dropbear_dss_host_key" diff --git a/pcr/dropbear/dropbear-rc.d b/pcr/dropbear/dropbear-rc.d new file mode 100644 index 000000000..011880b3b --- /dev/null +++ b/pcr/dropbear/dropbear-rc.d @@ -0,0 +1,88 @@ +#!/bin/bash +daemon_name=dropbear + +. /etc/rc.conf +. /etc/rc.d/functions + +. /etc/conf.d/$daemon_name + +for port in $DROPBEAR_PORT; do + daemon_args="$daemon_args -p $port" +done + +[ ! -z $DROPBEAR_BANNER ] && daemon_args="$daemon_args -b $DROPBEAR_BANNER" +[ ! -z $DROPBEAR_DSSKEY ] && daemon_args="$daemon_args -d $DROPBEAR_DSSKEY" +[ ! -z $DROPBEAR_RSAKEY ] && daemon_args="$daemon_args -r $DROPBEAR_RSAKEY" +[ ! -z $DROPBEAR_EXTRA_ARGS ] && daemon_args="$daemon_args $DROPBEAR_EXTRA_ARGS" +[ -z $DROPBEAR_PIDFILE ] && DROPBEAR_PIDFILE="/var/run/$daemon_name.pid" +daemon_args="$daemon_args -P $DROPBEAR_PIDFILE" + +get_pid() { + PID='' + if [ -r $DROPBEAR_PIDFILE -a -f $DROPBEAR_PIDFILE -a -w $DROPBEAR_PIDFILE ]; then + if kill -0 "`< $DROPBEAR_PIDFILE`" &>/dev/null; then # kill -0 == "exit code indicates if a signal may be sent" + PID="`< $DROPBEAR_PIDFILE`" + else # may not send signals to dropbear, because it's probably not running => remove pidfile + rm -f $DROPBEAR_PIDFILE + fi + fi +} + +case "$1" in + start) + stat_busy "Starting $daemon_name" + get_pid + if [ -z "$PID" ]; then + printhl "Checking for hostkeys" + if [ ! -z $DROPBEAR_DSSKEY ]; then + [ ! -f $DROPBEAR_DSSKEY ] && dropbearkey -t dss -f $DROPBEAR_DSSKEY + fi; + if [ ! -z $DROPBEAR_RSAKEY ]; then + [ ! -f $DROPBEAR_RSAKEY ] && dropbearkey -t rsa -f $DROPBEAR_RSAKEY + fi; + + $daemon_name $daemon_args # Make it Go Joe! + if [ $? -gt 0 ]; then + stat_die + else + add_daemon $daemon_name + stat_done + fi + else + stat_die + fi + ;; + + stop) + stat_busy "Stopping $daemon_name" + + get_pid + [ ! -z "$PID" ] && kill $PID &> /dev/null # Be dead (please), I say! + if [ $? -gt 0 ]; then + stat_die + else + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + fingerprint) + stat_busy "Fingerprinting $daemon_name hostkeys" + if [ ! -z $DROPBEAR_DSSKEY ]; then + printhl "DSS/DSA Key $(dropbearkey -y -f $DROPBEAR_DSSKEY | grep Fingerprint)" + fi; + if [ ! -z $DROPBEAR_RSAKEY ]; then + printhl "RSA Key $(dropbearkey -y -f $DROPBEAR_RSAKEY | grep Fingerprint)" + fi; + ;; + + *) + echo "usage: $0 {start|stop|restart|fingerprint}" +esac +exit 0 |