wok-tiny view dropbear/receipt @ rev 177
Shrink custom-console configuration
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 09 15:38:04 2023 +0000 (15 months ago) |
parents | a28c45a86936 |
children | 1e55ea7da8de |
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 busybox-net"
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 scp dropbear-client"
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|.*define NON_INETD_MODE.*|/*&*/|' \
27 -e 's|.*sftp-server.*|/*&*/|' \
28 -e 's|.*MD5_HMAC.*|/*&*/|' \
29 -e 's|.*_AES128.*|/*&*/|' \
30 -e 's|.*TWOFISH128.*|/*&*/|' \
31 options.h
32 echo "#define DISABLE_X11FWD" >> options.h
33 [ -d $WOK/zlib/taz ] || cook zlib
34 ln -s $WOK/zlib/taz/*/fs/usr/lib/* /usr/share/uclibc-cross-compiler-$TARGET/lib/ 2> /dev/null
35 ln -s /usr/include/z*.h /usr/share/uclibc-cross-compiler-$TARGET/include/ 2> /dev/null
36 ./configure --prefix=/usr --without-pam --host=$TARGET-pc-linux-gnu \
37 CC=uclibc-$TARGET-cc &&
38 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 &&
39 install -d -m 755 $DESTDIR/usr/sbin &&
40 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear &&
41 chown root $DESTDIR/usr/sbin/dropbear &&
42 chgrp 0 $DESTDIR/usr/sbin/dropbear &&
43 install -d -m 755 $DESTDIR/usr/bin &&
44 for i in $DROPBEARS ssh; do
45 ln $DESTDIR/usr/sbin/dropbear $DESTDIR/usr/bin/$i
46 done
47 }
49 # Rules to gen a SliTaz package suitable for Tazpkg.
50 genpkg_rules()
51 {
52 mkdir -p $fs/usr/sbin $fs/etc/init.d $fs/etc/dropbear
53 cp -a $install/usr/bin $fs/usr
54 ln $fs/usr/bin/dbclient $fs/usr/sbin/dropbear
55 ln -s daemon $fs/etc/init.d/dropbear
56 cat > $fs/etc/dropbear/banner <<EOT
58 Secure login on Tiny SliTaz GNU/Linux powered by Dropbear.
59 EOT
61 # Fix dropbear initscript perms
62 chown -R root.root $fs
63 }
65 # Post message when installing.
66 post_install()
67 {
68 if [ "$STARTDAEMON" = "ON" ]; then
69 grep -q inetd $1/etc/rcS.conf ||
70 sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
71 grep -q dropbear $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
72 ssh stream tcp nowait root /usr/sbin/dropbear /usr/sbin/dropbear -i $DROPBEAR_OPTS
73 EOT
74 fi
75 dos2unix <<EOT | uudecode - > $1/etc/dropbear/dropbear_dss_host_key
76 $DSSKEY
77 EOT
78 dos2unix <<EOT | uudecode - > $1/etc/dropbear/dropbear_rsa_host_key
79 $RSAKEY
80 EOT
81 chmod 600 $1/etc/dropbear/dropbear_*_host_key
82 }
84 config_form()
85 {
86 [ -n "$DROPBEAR_OPTS" ] || DROPBEAR_OPTS="-b /etc/dropbear/banner"
87 if [ -z "$DSSKEY" ]; then
88 dropbearkey -t dss -f /tmp/mkssh$$ > /dev/null 2>&1
89 DSSKEY="$(uuencode -m - < /tmp/mkssh$$)"
90 rm -f /tmp/mkssh$$
91 fi
92 uudecode - > /tmp/mkssh$$ <<EOT
93 $DSSKEY
94 EOT
95 DSSPUB="$(dropbearkey -y -f /tmp/mkssh$$ | grep ^ssh)"
96 rm -f /tmp/mkssh$$
97 if [ -z "$RSAKEY" ]; then
98 dropbearkey -t rsa -f /tmp/mkssh$$ > /dev/null 2>&1
99 RSAKEY="$(uuencode -m - < /tmp/mkssh$$)"
100 rm -f /tmp/mkssh$$
101 fi
102 uudecode - > /tmp/mkssh$$ <<EOT
103 $RSAKEY
104 EOT
105 RSAPUB="$(dropbearkey -y -f /tmp/mkssh$$ | grep ^ssh)"
106 rm -f /tmp/mkssh$$
107 cat <<EOT
108 <input type="checkbox" name="STARTDAEMON" value="ON" ${STARTDAEMON:+checked="checked" }/>
109 Start server during boot<br>
110 <table>
111 <tr>
112 <td>Server options</td>
113 <td><input type="text" name="DROPBEAR_OPTS" value="$DROPBEAR_OPTS" /></td>
114 </tr>
115 <tr>
116 <td>DSS key</td>
117 <td><textarea name="DSSKEY" cols="60" rows="13" wrap="off">
118 $DSSKEY
119 </textarea></td>
120 </tr>
121 <tr>
122 <td>RSA key</td>
123 <td><textarea name="RSAKEY" cols="60" rows="12" wrap="off">
124 $RSAKEY
125 </textarea></td>
126 </tr>
127 </table>
128 You can set your dropbear key
129 <pre>
130 # uuencode -m - < /etc/dropbear/dropbear_dss_host_key
131 </pre>
132 Or your ssh key
133 <pre>
134 # dropbearconvert openssh dropbear /etc/ssh/id_dsa /dev/stdout | uuencode -m -
135 </pre>
136 Default DSS public key is
137 <pre>
138 $DSSPUB
139 </pre>
140 Default RSA public key is
141 <pre>
142 $RSAPUB
143 </pre>
144 EOT
145 }