Replace opessh-server with dropbear #25

Merged
PeterSurda merged 1 commits from PeterSurda/openwrt:replace-openssh-with-dropbear into main 2023-02-23 15:11:18 +01:00
4 changed files with 25 additions and 7 deletions
Showing only changes of commit 85c081df3d - Show all commits

View File

@ -50,10 +50,10 @@ echo "CONFIG_TARGET_ROOTFS_PARTSIZE=208" >> .config
echo "CONFIG_TARGET_ROOTFS_EXT4FS=n" >> .config
# Setup files
mkdir -p files/root/.ssh
chmod 0700 files/root files/root/.ssh
cp ${pwd}/authorized_keys files/root/.ssh/
chmod 0400 files/root/.ssh/authorized_keys
mkdir -p files/etc/dropbear
chmod 0750 files/etc/dropbear
cp ${pwd}/authorized_keys files/etc/dropbear
chmod 0400 files/etc/dropbear/authorized_keys
mkdir -p files/etc/uci-defaults
cp ${pwd}/defaults/* files/etc/uci-defaults
@ -90,7 +90,6 @@ PACKAGES="kmod-nf-nathelper-extra kmod-rtc-ds1307 \
luci-ssl-nginx luci-app-acme \
python3-packages python3-yaml \
wireguard-tools wget-ssl \
openssh-server \
"
make image PROFILE=rpi-4 \

4
defaults/00-defaults Normal file
View File

@ -0,0 +1,4 @@
touch /etc/config/defaults
/sbin/uci get defaults.version || /sbin/uci set defaults.version=version && \
/sbin/uci commit defaults

17
defaults/50-dropbear Normal file
View File

@ -0,0 +1,17 @@
VERSION=1
[ "$(uci -q get defaults.version.dropbear)" -ge "$VERSION" ] && exit 0
# save version
/sbin/uci set defaults.version.dropbear="$VERSION"
/sbin/uci -q batch << EOF
set defaults.version.dropbear="$VERSION"
commit defaults
set dropbear.@dropbear[0].PasswordAuth='off'
set dropbear.@dropbear[0].RootPasswordAuth='off'
commit dropbear
EOF
/sbin/service dropbear enable
/sbin/service dropbear restart

View File

@ -1,2 +0,0 @@
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
/sbin/service sshd restart