wok-tiny annotate dropbear-without-zlib/receipt @ rev 138

dropbear: shrink
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Mar 05 22:31:30 2018 +0100 (20 months ago)
parents 10cf1a5f187d
children 1869a110d35f
rev   line source
pascal@69 1 # SliTaz package receipt.
pascal@69 2
pascal@69 3 PACKAGE="dropbear-without-zlib"
pascal@88 4 SOURCE="dropbear"
pascal@69 5 VERSION="0.53"
pascal@69 6 CATEGORY="security"
pascal@69 7 SHORT_DESC="Light SSH client and server without compression support."
pascal@69 8 MAINTAINER="pascal.bellard@slitaz.org"
pascal@90 9 LICENSE="MIT"
pascal@88 10 TARBALL="$SOURCE-$VERSION.tar.gz"
pascal@69 11 DEPENDS="libutil"
pascal@69 12 [ -n "$TARGET" ] || TARGET="i486"
pascal@69 13 BUILD_DEPENDS="dropbear uclibc-cross-compiler-$TARGET"
pascal@69 14 WEB_SITE="http://matt.ucc.asn.au/dropbear/dropbear.html"
pascal@69 15 WGET_URL="http://matt.ucc.asn.au/dropbear/releases/$TARBALL"
pascal@69 16 CONFIG_FILES="/etc/dropbear /etc/daemons.conf /etc/rcS.conf"
pascal@69 17 PROVIDE="ssh dropbear"
pascal@69 18 TAGS="ssh"
pascal@69 19
pascal@69 20 # Rules to configure and make the package.
pascal@69 21 compile_rules()
pascal@69 22 {
pascal@69 23 local i
pascal@69 24 local DROPBEARS
pascal@69 25 DROPBEARS="dbclient scp"
pascal@69 26 sed -i -e 's|/usr/X11R6/bin/xauth|/usr/bin/xauth|' \
pascal@69 27 -e 's|/usr/libexec/sftp-server|/usr/sbin/sftp-server|' \
pascal@138 28 -e 's|.*MD5_HMAC.*|/*&*/|' \
pascal@138 29 -e 's|.*_AES128.*|/*&*/|' \
pascal@138 30 -e 's|.*TWOFISH128.*|/*&*/|' \
pascal@69 31 options.h
pascal@69 32 ./configure --prefix=/usr --without-pam --host=$TARGET-pc-linux-gnu \
pascal@69 33 --disable-zlib CC=uclibc-$TARGET-cc &&
pascal@69 34 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 &&
pascal@94 35 install -d -m 755 $DESTDIR/usr/sbin &&
pascal@94 36 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear &&
pascal@94 37 chown root $DESTDIR/usr/sbin/dropbear &&
pascal@94 38 chgrp 0 $DESTDIR/usr/sbin/dropbear &&
pascal@94 39 install -d -m 755 $DESTDIR/usr/bin &&
pascal@69 40 for i in $DROPBEARS ssh; do
pascal@112 41 ln $DESTDIR/usr/sbin/dropbear $DESTDIR/usr/bin/$i
pascal@69 42 done
pascal@69 43 }
pascal@69 44
pascal@69 45 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@69 46 genpkg_rules()
pascal@69 47 {
pascal@112 48 mkdir -p $fs/usr/sbin $fs/etc/init.d $fs/etc/dropbear
pascal@94 49 cp -a $install/usr/bin $fs/usr
pascal@112 50 ln $fs/usr/bin/dbclient $fs/usr/sbin/dropbear
pascal@69 51 ln -s daemon $fs/etc/init.d/dropbear
pascal@69 52 cat > $fs/etc/dropbear/banner <<EOT
pascal@69 53
pascal@69 54 Secure login on Tiny SliTaz GNU/Linux powered by Dropbear.
pascal@69 55 EOT
pascal@69 56
pascal@69 57 # Fix dropbear initscript perms
pascal@69 58 chown -R root.root $fs
pascal@69 59 }
pascal@69 60
pascal@69 61 # Post message when installing.
pascal@69 62 post_install()
pascal@69 63 {
pascal@87 64 if [ "$STARTDAEMON" = "ON" ]; then
pascal@87 65 grep -q inetd $1/etc/rcS.conf ||
pascal@87 66 sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
pascal@87 67 grep -q dropbear $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
pascal@86 68 ssh stream tcp nowait root /usr/sbin/dropbear /usr/sbin/dropbear -i $DROPBEAR_OPTS
pascal@69 69 EOT
pascal@87 70 fi
pascal@69 71 dos2unix <<EOT | uudecode - > $1/etc/dropbear/dropbear_dss_host_key
pascal@69 72 $DSSKEY
pascal@69 73 EOT
pascal@69 74 dos2unix <<EOT | uudecode - > $1/etc/dropbear/dropbear_rsa_host_key
pascal@69 75 $RSAKEY
pascal@69 76 EOT
pascal@69 77 chmod 600 $1/etc/dropbear/dropbear_*_host_key
pascal@69 78 }
pascal@69 79
pascal@69 80 config_form()
pascal@69 81 {
pascal@69 82 [ -n "$DROPBEAR_OPTS" ] || DROPBEAR_OPTS="-b /etc/dropbear/banner"
pascal@69 83 if [ -z "$DSSKEY" ]; then
pascal@69 84 dropbearkey -t dss -f /tmp/mkssh$$ > /dev/null 2>&1
pascal@69 85 DSSKEY="$(uuencode -m - < /tmp/mkssh$$)"
pascal@69 86 rm -f /tmp/mkssh$$
pascal@69 87 fi
pascal@69 88 uudecode - > /tmp/mkssh$$ <<EOT
pascal@69 89 $DSSKEY
pascal@69 90 EOT
pascal@69 91 DSSPUB="$(dropbearkey -y -f /tmp/mkssh$$ | grep ^ssh)"
pascal@69 92 rm -f /tmp/mkssh$$
pascal@69 93 if [ -z "$RSAKEY" ]; then
pascal@69 94 dropbearkey -t rsa -f /tmp/mkssh$$ > /dev/null 2>&1
pascal@69 95 RSAKEY="$(uuencode -m - < /tmp/mkssh$$)"
pascal@69 96 rm -f /tmp/mkssh$$
pascal@69 97 fi
pascal@69 98 uudecode - > /tmp/mkssh$$ <<EOT
pascal@69 99 $RSAKEY
pascal@69 100 EOT
pascal@69 101 RSAPUB="$(dropbearkey -y -f /tmp/mkssh$$ | grep ^ssh)"
pascal@69 102 rm -f /tmp/mkssh$$
pascal@69 103 cat <<EOT
pascal@126 104 <input type="checkbox" name="STARTDAEMON" value="ON" ${STARTDAEMON:+checked="checked" }/>
pascal@87 105 Start server during boot<br>
pascal@69 106 <table>
pascal@69 107 <tr>
pascal@69 108 <td>Server options</td>
pascal@69 109 <td><input type="text" name="DROPBEAR_OPTS" value="$DROPBEAR_OPTS" /></td>
pascal@69 110 </tr>
pascal@69 111 <tr>
pascal@69 112 <td>DSS key</td>
pascal@69 113 <td><textarea name="DSSKEY" cols="60" rows="13" wrap="off">
pascal@69 114 $DSSKEY
pascal@69 115 </textarea></td>
pascal@69 116 </tr>
pascal@69 117 <tr>
pascal@69 118 <td>RSA key</td>
pascal@69 119 <td><textarea name="RSAKEY" cols="60" rows="12" wrap="off">
pascal@69 120 $RSAKEY
pascal@69 121 </textarea></td>
pascal@69 122 </tr>
pascal@69 123 </table>
pascal@69 124 You can set your dropbear key
pascal@69 125 <pre>
pascal@69 126 # uuencode -m - < /etc/dropbear/dropbear_dss_host_key
pascal@69 127 </pre>
pascal@69 128 Or your ssh key
pascal@69 129 <pre>
pascal@69 130 # dropbearconvert openssh dropbear /etc/ssh/id_dsa /dev/stdout | uuencode -m -
pascal@69 131 </pre>
pascal@69 132 Default DSS public key is
pascal@69 133 <pre>
pascal@69 134 $DSSPUB
pascal@69 135 </pre>
pascal@69 136 Default RSA public key is
pascal@69 137 <pre>
pascal@69 138 $RSAPUB
pascal@69 139 </pre>
pascal@69 140 EOT
pascal@69 141 }