wok view dropbear/receipt @ rev 25791

Up dropbear (2024.86), libssh2 (1.11.1), xz (5.6.3)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Oct 23 13:27:53 2024 +0000 (4 weeks ago)
parents c7c7d41a7d82
children
line source
1 # SliTaz package receipt.
3 PACKAGE="dropbear"
4 VERSION="2024.86"
5 CATEGORY="security"
6 SHORT_DESC="Lightweight SSH2 server and client"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="MIT"
9 TARBALL="$PACKAGE-$VERSION.tar.bz2"
10 WEB_SITE="https://github.com/mkj/dropbear"
11 WGET_URL="https://matt.ucc.asn.au/dropbear/releases/$TARBALL"
12 CONFIG_FILES="/etc/dropbear/banner"
13 SECRET_FILES="/etc/dropbear/*key"
14 SUGGESTED="sftp-server"
15 PROVIDE="ssh"
16 TAGS="ssh"
17 HOST_ARCH="i486 arm"
19 DEPENDS="zlib"
20 BUILD_DEPENDS="zlib-dev pam pam-dev"
22 # Handle multiarch compilation.
23 case "$ARCH" in
24 arm)
25 BUILD_DEPENDS=""
26 CROSS_ARGS="--disable-zlib"
27 CROSS_BUGS="Fails to find zlib: -lz... no" ;;
28 esac
30 # What is the latest version available today?
31 current_version()
32 {
33 wget -O - https://github.com/mkj/dropbear/releases 2>/dev/null | \
34 sed '/tag\//!d;s|.*tag/[A-Z_]*||;s|".*||;q'
35 }
37 # Rules to configure and make the package.
38 compile_rules()
39 {
40 local i
41 local DROPBEARS
42 DROPBEARS="dropbearkey dropbearconvert dbclient scp"
43 cat > localoptions.h <<EOT
44 #define SFTPSERVER_PATH "/usr/sbin/sftp-server"
45 #define DROPBEAR_X11FWD 1
46 EOT
47 sed -i 's|shell arch|shell uname -m|' libtommath/makefile_include.mk
48 ./configure --prefix=/usr --without-pam $CONFIGURE_ARGS $CROSS_ARGS &&
49 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 SCPPROGRESS=1 &&
50 install -d -m 755 $DESTDIR/usr/sbin &&
51 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear &&
52 chown 0.0 $DESTDIR/usr/sbin/dropbear || exit 1
54 # No pam support in ARM
55 case "$ARCH" in
56 arm) echo "Skipping Dropbear PAM..." ;;
57 i?86)
58 cat >> localoptions.h <<EOT
59 #define DROPBEAR_SVR_PASSWORD_AUTH 0
60 #define DROPBEAR_SVR_PAM_AUTH 1
61 EOT
62 ./configure --prefix=/usr --enable-pam $CONFIGURE_ARGS &&
63 make PROGRAMS="dropbear $DROPBEARS" MULTI=1 SCPPROGRESS=1 &&
64 install -m 755 dropbearmulti $DESTDIR/usr/sbin/dropbear-pam &&
65 chown 0.0 $DESTDIR/usr/sbin/dropbear-pam || exit 1 ;;
66 esac
68 install -d -m 755 $DESTDIR/usr/bin &&
69 for i in $DROPBEARS ssh; do
70 ln -s ../sbin/dropbear $DESTDIR/usr/bin/$i || exit 1
71 done
72 install -d -m 755 $DESTDIR/usr/share/man/man1 &&
73 install -m 644 $src/manpages/*.1 $DESTDIR/usr/share/man/man1 &&
74 install -d -m 755 $DESTDIR/usr/share/man/man8 &&
75 install -m 644 $src/manpages/*.8 $DESTDIR/usr/share/man/man8 &&
76 install -d -m 755 $DESTDIR/usr/share/doc &&
77 install -m 644 $src/[A-Z][A-Z]* $DESTDIR/usr/share/doc
78 }
80 # Rules to gen a SliTaz package suitable for Tazpkg.
81 genpkg_rules()
82 {
83 mkdir -p $fs/usr
84 cp -a $install/usr/bin $fs/usr
85 cp -a $install/usr/sbin $fs/usr
86 rm -f $fs/usr/sbin/dropbear-pam
87 # Config file and init script.
88 mkdir -p $fs/etc
89 cp -a $stuff/dropbear $fs/etc
90 cp -a $stuff/init.d $fs/etc
91 ln -s daemon $fs/etc/init.d/sshd
92 cp -a $stuff/sshx $fs/usr/bin
93 ln -s sshx $fs/usr/bin/pppssh
94 ln -s sshx $fs/usr/bin/sshfbvnc
95 touch $fs/etc/dropbear/dropbear_rsa_host_key \
96 $fs/etc/dropbear/dropbear_ecdsa_host_key \
97 $fs/etc/dropbear/dropbear_ed25519_host_key
99 # Fix dropbear initscript perms
100 chown -R root.root $fs
101 }
103 # Pre and post install commands for Tazpkg.
104 pre_install()
105 {
106 for key in dropbear_rsa_host_key dropbear_ecdsa_host_key dropbear_ed25519_host_key ; do
107 [ -s "$1/etc/dropbear/$key" ] && mv "$1/etc/dropbear/$key" "$1/etc/dropbear/$key.saved"
108 done
109 }
111 post_install()
112 {
113 while read dropbear openssh ; do
114 [ -s "$1/$dropbear.saved" ] && mv "$1/$dropbear.saved" "$1/$dropbear"
115 [ -s "$1/$openssh" ] || continue
116 [ -s "$1/$dropbear" ] && continue
117 chroot "$1/" dropbearconvert openssh dropbear $openssh $dropbear
118 chroot "$1/" dropbearkey -y -f $dropbear | grep Fingerprint
119 done <<EOT
120 /etc/dropbear/dropbear_rsa_host_key /etc/ssh/ssh_host_rsa_key
121 /etc/dropbear/dropbear_ecdsa_host_key /etc/ssh/ssh_host_ecdsa_key
122 /etc/dropbear/dropbear_ed25519_host_key /etc/ssh/ssh_host_ed25519_key
123 EOT
124 grep -q ssh "$1/etc/inetd.conf" || cat >> "$1/etc/inetd.conf" <<EOT
125 #ssh stream tcp nowait root dropbear dropbear -i -b /etc/dropbear/banner
126 EOT
127 [ -n "$quiet" ] && return
128 echo -e "\nTo starts $PACKAGE server you can run :\n"
129 echo "/etc/init.d/$PACKAGE start"
130 echo -e "Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf\n"
131 }
133 post_remove()
134 {
135 grep -q dropbear "$1/etc/inetd.conf" && sed -i '/dropbear/d' "$1/etc/inetd.conf"
136 }