diff --git a/conf/aarch32_support_list.yaml b/conf/aarch32_support_list.yaml index 58e39dd6d15388886f5e330407a0f0bdb2cbca26..9c8cf1851fc23447f2156e147a5acfa1c9c4a052 100644 --- a/conf/aarch32_support_list.yaml +++ b/conf/aarch32_support_list.yaml @@ -91,3 +91,7 @@ packages: src: branch: None version: 1.0-2 +- name: dropbear + src: + branch: None + version: 2019.78-6 diff --git a/src/dropbear/dropbear-2019.78.tar.bz2 b/src/dropbear/dropbear-2019.78.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..5d0ff2654947abf0793dc08d4dd84a5c8e901f62 Binary files /dev/null and b/src/dropbear/dropbear-2019.78.tar.bz2 differ diff --git a/src/dropbear/dropbear-keygen.service b/src/dropbear/dropbear-keygen.service new file mode 100644 index 0000000000000000000000000000000000000000..633971abc7cf7e5f1cc3150e23cb32d48d4a5372 --- /dev/null +++ b/src/dropbear/dropbear-keygen.service @@ -0,0 +1,13 @@ +[Unit] +Description=Dropbear SSH Key Generator +Documentation=man:dropbearkey(8) +Before=dropbear.service +ConditionPathExists=!/etc/dropbear/dropbear_rsa_host_key +ConditionPathExists=!/etc/dropbear/dropbear_dss_host_key + +[Service] +Type=oneshot +ExecStart=/usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key +ExecStart=/usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key +RemainAfterExit=yes + diff --git a/src/dropbear/dropbear.service b/src/dropbear/dropbear.service new file mode 100644 index 0000000000000000000000000000000000000000..987e86875f6bd047a8f268be003acece82db2cf5 --- /dev/null +++ b/src/dropbear/dropbear.service @@ -0,0 +1,12 @@ +[Unit] +Description=Dropbear SSH Server Daemon +Documentation=man:dropbear(8) +Wants=dropbear-keygen.service +After=network.target + +[Service] +EnvironmentFile=-/etc/sysconfig/dropbear +ExecStart=/usr/sbin/dropbear -E -F $OPTIONS + +[Install] +WantedBy=multi-user.target diff --git a/src/dropbear/dropbear.spec b/src/dropbear/dropbear.spec new file mode 100644 index 0000000000000000000000000000000000000000..76713008962fd63c7a1c61b14e223ca570c8380e --- /dev/null +++ b/src/dropbear/dropbear.spec @@ -0,0 +1,124 @@ +%global _hardened_build 1 +Name: dropbear +Version: 2019.78 +Release: 6 +Summary: Lightweight SSH server and client +License: MIT +URL: https://matt.ucc.asn.au/dropbear/dropbear.html +Source0: https://matt.ucc.asn.au/%{name}/releases/%{name}-%{version}.tar.bz2 +Source1: dropbear.service +Source2: dropbear-keygen.service +Source3: sshd +BuildRequires: gcc +BuildRequires: libtomcrypt-devel +BuildRequires: libtommath-devel +BuildRequires: pam-devel +%ifnarch %{arm} +BuildRequires: systemd +%{?systemd_requires} +# For triggerun +Requires(post): systemd-sysv +%endif +BuildRequires: zlib-devel + +%description +Dropbear is a relatively small SSH server and client. It's particularly useful +for "embedded"-type Linux (or other Unix) systems, such as wireless routers. + +%package help +Summary: Including man file for dropbear +Requires: man + +%description help +This contains man files for the using of dropbear + +%prep +%setup -q +iconv -f iso-8859-1 -t utf-8 -o CHANGES{.utf8,} +mv CHANGES{.utf8,} + +%build +%configure --enable-pam --disable-bundled-libtom + +cat > localoptions.h </dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +chkconfig --del dropbear >/dev/null 2>&1 || : +systemctl try-restart dropbear.service >/dev/null 2>&1 || : +%endif + +%files +%ifnarch %{arm} +%doc CHANGES README +%license LICENSE +%{_mandir}/man1/*.1* +%{_mandir}/man8/*.8* +%{_unitdir}/dropbear* +%else +%{_bindir}/ssh +%{_sbindir}/sshd +/etc/init.d/* +%endif +%dir %{_sysconfdir}/dropbear +%{_bindir}/dropbearkey +%{_bindir}/dropbearconvert +%{_bindir}/dbclient +%{_bindir}/scp +%{_sbindir}/dropbear + +%ifarch %{arm} +%files help +%doc CHANGES README +%license LICENSE +%{_mandir}/man1/*.1* +%{_mandir}/man8/*.8* +%endif + +%changelog +* Mon Dec 7 2020 liang_dong - 2019.78-6 +- chmod sshd file + +* Fri Dec 4 2020 liang_dong - 2019.78-5 +- add scp bin into pkg + +* Wed Dec 2 2020 liang_dong - 2019.78-4 +- add SysVinit support in busybox env + +* Fri Nov 27 2020 liang_dong - 2019.78-3 +- Add arm32 compilation support + +* Wed Nov 18 2020 liang_dong - 2019.78-2 +- package init diff --git a/src/dropbear/sshd b/src/dropbear/sshd new file mode 100644 index 0000000000000000000000000000000000000000..f779bb126795003647549298eef0565f4c162897 --- /dev/null +++ b/src/dropbear/sshd @@ -0,0 +1,60 @@ +#!/bin/bash +option="-p 22" +key_files="dropbear_dss_host_key dropbear_ecdsa_host_key dropbear_rsa_host_key" + +check_key_files() +{ + if [ ! -d /etc/dropbear ];then + mkdir /etc/dropbear > /dev/null 2>&1 + fi + if [ ! -f /etc/dropbear/dropbear_dss_host_key ];then + dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key > /dev/null 2>&1 + fi + + if [ ! -f /etc/dropbear/dropbear_ecdsa_host_key ];then + dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key > /dev/null 2>&1 + fi + + if [ ! -f /etc/dropbear/dropbear_rsa_host_key ];then + dropbearkey -t rsa -s 1024 -f /etc/dropbear/dropbear_rsa_host_key > /dev/null 2>&1 + fi +} + +start() +{ + echo -n "Starting dropbear: " + check_key_files + start-stop-daemon -S -b -n dropbear -a /usr/sbin/dropbear -- $option + echo "done" +} + +stop() +{ + echo -n "Stopping dropbear " + start-stop-daemon -K -n dropbear + echo "done" +} + +restart() +{ + stop + sleep 1 + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + *) + echo "Usage: syslog { start | stop | restart }" >&2 + exit 1 + ;; +esac +exit 0