wok-tiny view dropbear/receipt @ rev 112

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