wok-tiny rev 38

Add dropbear
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 13 22:03:24 2011 +0100 (2011-03-13)
parents 4ba2d11dfa87
children aa941f70de5c
files dropbear/receipt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dropbear/receipt	Sun Mar 13 22:03:24 2011 +0100
     1.3 @@ -0,0 +1,112 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="dropbear"
     1.7 +VERSION="0.53"
     1.8 +CATEGORY="security"
     1.9 +SHORT_DESC="Light SSH client and server."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.12 +DEPENDS=""
    1.13 +[ -n "$TARGET" ] || TARGET="i486"
    1.14 +BUILD_DEPENDS="dropbear uclibc-cross-compiler-$TARGET"
    1.15 +SUGGESTED="sftp-server"
    1.16 +WEB_SITE="http://matt.ucc.asn.au/dropbear/dropbear.html"
    1.17 +WGET_URL="http://matt.ucc.asn.au/dropbear/releases/$TARBALL"
    1.18 +CONFIG_FILES="/etc/dropbear"
    1.19 +PROVIDE="ssh"
    1.20 +TAGS="ssh"
    1.21 +BUGS="should enable zlib"
    1.22 +
    1.23 +# Rules to configure and make the package.
    1.24 +compile_rules()
    1.25 +{
    1.26 +	local i
    1.27 +	local DROPBEARS
    1.28 +	DROPBEARS="dbclient scp"
    1.29 +	cd $src
    1.30 +	sed -i  -e 's|/usr/X11R6/bin/xauth|/usr/bin/xauth|' \
    1.31 +		-e 's|/usr/libexec/sftp-server|/usr/sbin/sftp-server|' \
    1.32 +		options.h
    1.33 +	./configure --prefix=/usr --without-pam --host=$TARGET-pc-linux-gnu \
    1.34 +		--disable-zlib CC=uclibc-$TARGET-cc &&
    1.35 +	make PROGRAMS="dropbear $DROPBEARS" MULTI=1 &&
    1.36 +	install -d -m 755 $PWD/_pkg/usr/sbin &&
    1.37 +	install -m 755 dropbearmulti $PWD/_pkg/usr/sbin/dropbear &&
    1.38 +	chown root $PWD/_pkg/usr/sbin/dropbear &&
    1.39 +	chgrp 0 $PWD/_pkg/usr/sbin/dropbear &&
    1.40 +	install -d -m 755 $PWD/_pkg/usr/bin &&
    1.41 +	for i in $DROPBEARS ssh; do
    1.42 +		ln -s ../sbin/dropbear $PWD/_pkg/usr/bin/$i
    1.43 +	done
    1.44 +}
    1.45 +
    1.46 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.47 +genpkg_rules()
    1.48 +{
    1.49 +	mkdir -p $fs/usr $fs/etc/init.d $fs/etc/dropbear
    1.50 +	cp -a $_pkg/usr/bin $fs/usr
    1.51 +	cp -a $_pkg/usr/sbin $fs/usr
    1.52 +	ln -s daemon $fs/etc/init.d/dropbear
    1.53 +	cat > $fs/etc/dropbear/banner <<EOT
    1.54 +
    1.55 +Secure login on Tiny SliTaz GNU/Linux powered by Dropbear.
    1.56 +EOT
    1.57 +	
    1.58 +	# Fix dropbear initscript perms
    1.59 +	chown -R root.root $fs
    1.60 +}
    1.61 +
    1.62 +# Post message when installing.
    1.63 +post_install()
    1.64 +{
    1.65 +	echo "$DSSKEY" | uudecode - > $1/etc/dropbear/dropbear_dss_host_key
    1.66 +	echo "$RSAKEY" | uudecode - > $1/etc/dropbear/dropbear_rsa_host_key
    1.67 +	chmod 600 $1/etc/dropbear/dropbear_*_host_key
    1.68 +	grep -q dropbear $1/etc/rcS.conf ||
    1.69 +	sed -i 's/^RUN_DAEMONS="/&dropbear /' $1/etc/rcS.conf
    1.70 +	sed -i "s/^DROPBEAR_OPTIONS=.*/DROPBEAR_OPTIONS=\"$DROPBEAR_OPTS\"/" \
    1.71 +		$1/etc/daemons.conf
    1.72 +}
    1.73 +
    1.74 +config_form()
    1.75 +{
    1.76 +	[ -n "$DROPBEAR_OPTS" ] || DROPBEAR_OPTS="-b /etc/dropbear/banner"
    1.77 +	if [ -z "$DSSKEY" ]; then
    1.78 +		dropbearkey -t dss -f /tmp/mkssh$$ > /dev/null 2>&1
    1.79 +		DSSKEY="$(uuencode -m - < /tmp/mkssh$$)"
    1.80 +		rm -f /tmp/mkssh$$
    1.81 +	fi
    1.82 +	if [ -z "$RSAKEY" ]; then
    1.83 +		dropbearkey -t rsa -f /tmp/mkssh$$ > /dev/null 2>&1
    1.84 +		RSAKEY="$(uuencode -m - < /tmp/mkssh$$)"
    1.85 +		rm -f /tmp/mkssh$$
    1.86 +	fi
    1.87 +	cat <<EOT
    1.88 +<table>
    1.89 +<tr>
    1.90 +<td>Server options</td>
    1.91 +<td><input type="text" name="DROPBEAR_OPTS" value="$DROPBEAR_OPTS" /></td>
    1.92 +</tr>
    1.93 +<tr>
    1.94 +<td>DSS key</td>
    1.95 +<td><textarea name="DSSKEY" cols="60" rows="13" wrap="off">
    1.96 +$DSSKEY
    1.97 +</textarea></td>
    1.98 +</tr>
    1.99 +<tr>
   1.100 +<td>RSA key</td>
   1.101 +<td><textarea name="RSAKEY" cols="60" rows="12" wrap="off">
   1.102 +$RSAKEY
   1.103 +</textarea></td>
   1.104 +</tr>
   1.105 +</table>
   1.106 +You can set your dropbear key
   1.107 +<pre>
   1.108 +# uuencode -m - < /etc/dropbear/dropbear_dss_host_key
   1.109 +</pre>
   1.110 +Or your ssh key
   1.111 +<pre>
   1.112 +# dropbearconvert openssh dropbear /etc/ssh/id_dsa /dev/stdout | uuencode -m -
   1.113 +</pre>
   1.114 +EOT
   1.115 +}