diff --git a/PKGBUILD b/PKGBUILD index 70c5d1a..410db05 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -18,13 +18,15 @@ source=( "dropbear_install" "LICENSE" ) +backup=( "etc/dropbear/config" ) changelog=ChangeLog -sha256sums=('6c529408125bd0c446162f8d4a16d7262d6b39896d8e6f87d364f7b299203315' - '6e6fcb6a1f3b1ffae85a8b72b56b8fd2b221777713d221641d8cbfd2ad5637b3' +sha256sums=('9852ab6a3ba4191ed3eabbfebb2876fe7ff1003f62309043ec0b8b9374e3b9ee' + '3f6cb2c6edd2a5510e9d2366b68815b0d0f9d7cfc066c26c4b842af44d2024fd' 'ac69d63ecc672c698582b0fc260dbfe42d71adcdab707f807c8e1113be11abd8') package() { install -Dm0644 dropbear_hook "$pkgdir/usr/lib/initcpio/hooks/dropbear" install -Dm0644 dropbear_install "$pkgdir/usr/lib/initcpio/install/dropbear" + install -Dm0644 dropbear_config "$pkgdir/etc/dropbear/config" install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE } diff --git a/dropbear_config b/dropbear_config new file mode 100644 index 0000000..dbbdcc8 --- /dev/null +++ b/dropbear_config @@ -0,0 +1 @@ +DROPBEAR_PORT=22 diff --git a/dropbear_hook b/dropbear_hook index 68d25e1..1fc0d6e 100644 --- a/dropbear_hook +++ b/dropbear_hook @@ -4,8 +4,15 @@ run_hook() { [ -d /dev/pts ] || mkdir -p /dev/pts mount -t devpts devpts /dev/pts - echo "Starting dropbear" - /usr/sbin/dropbear -E -s -j -k + if [ -s /etc/dropbear/config ]; then + echo "Found dropbear config file" + . /etc/dropbear/config + fi + + port=${DROPBEAR_PORT:-22} + + echo "Starting dropbear on port $port" + /usr/sbin/dropbear -E -s -j -k -p "$port" } run_cleanuphook() { diff --git a/dropbear_install b/dropbear_install index 30a6009..8e1be6a 100644 --- a/dropbear_install +++ b/dropbear_install @@ -2,6 +2,7 @@ set -e +CONFIG_FILE="/etc/dropbear/config" KEY_TYPES="ed25519 ecdsa rsa" get_fingerprint() { @@ -83,6 +84,12 @@ build() { add_dir "/var/log" touch "${BUILDROOT}"/var/log/lastlog + if [ -s $CONFIG_FILE ]; then + echo "Using config file $CONFIG_FILE:" + cat $CONFIG_FILE + add_file $CONFIG_FILE + fi + add_runscript }