Merge pull request #6953 from antonlacon/proftpd-passwd

proftpd: update to 1.3.7e and change password hash generation
This commit is contained in:
Rudi Heitbaum 2022-10-02 19:25:51 +11:00 committed by GitHub
commit be009ddb37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 36 deletions

View File

@ -1,21 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="whois"
PKG_VERSION="5.5.13"
PKG_SHA256="a96cf60722e5c3962f8abef36184a101011447d3fe5fa053ea97f593826568fb"
PKG_LICENSE="GPL"
PKG_SITE="http://www.linux.it/~md/software/"
PKG_URL="https://github.com/rfc1036/whois/archive/v${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="A tool that queries the whois directory service for information pertaining to a particular domain name."
PKG_BUILD_FLAGS="-sysroot"
make_target() {
make mkpasswd
}
makeinstall_target() {
make install BASEDIR=${INSTALL}
}

View File

@ -1,3 +1,8 @@
106
- update to proftpd 1.3.7e
- generate password hashes with python
- drop whois requirement
105
- update to proftpd 1.3.7d
- update to whois 5.5.13

View File

@ -3,14 +3,14 @@
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="proftpd"
PKG_VERSION="1.3.7d"
PKG_SHA256="b231536e2978116801d06278e805b18e5240568d2bc921693ac7147652e267e4"
PKG_REV="105"
PKG_VERSION="1.3.7e"
PKG_SHA256="6e716a3b53ee069290399fce6dccf4c229fafe6ec2cb14db3778b7aa3f9a8c92"
PKG_REV="106"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.proftpd.org/"
PKG_URL="https://github.com/proftpd/proftpd/archive/v${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain libcap openssl ncurses pcre whois"
PKG_DEPENDS_TARGET="toolchain libcap openssl ncurses pcre"
PKG_SECTION="service"
PKG_SHORTDESC="ProFTPD: a FTP server for linux"
PKG_LONGDESC="ProFTPD (${PKG_VERSION}): is a secure and configurable FTP server with SSL/TLS support"
@ -50,10 +50,8 @@ addon() {
cp ${PKG_INSTALL}/usr/bin/ftpwho ${ADDON_BUILD}/${PKG_ADDON_ID}/bin
cp ${PKG_INSTALL}/usr/bin/ftptop ${ADDON_BUILD}/${PKG_ADDON_ID}/bin
cp $(get_install_dir whois)/usr/bin/mkpasswd ${ADDON_BUILD}/${PKG_ADDON_ID}/bin
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/locale
for i in ${PKG_INSTALL}/storage/.kodi/addons/${PKG_ADDON_ID}/locale/*; do
cp ${i}/LC_MESSAGES/proftpd.mo ${ADDON_BUILD}/${PKG_ADDON_ID}/locale/$(basename ${i}).mo
cp ${i}/LC_MESSAGES/proftpd.mo ${ADDON_BUILD}/${PKG_ADDON_ID}/locale/${i##*/}.mo
done
}

View File

@ -4,6 +4,7 @@
# Copyright (C) 2012 x23
# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2012-2015 ultraman
# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv)
. /etc/profile
@ -25,7 +26,7 @@ fi
if [ ! -f "$ADDON_HOME/proftpd.cert.pem" -o ! -f "$ADDON_HOME/proftpd.key.pem" ]; then
openssl req -newkey rsa:1024 -config $ADDON_HOME/openssl.cnf -new -x509 -days "$CertTTL" -nodes -out "$ADDON_HOME/proftpd.cert.pem" -keyout "$ADDON_HOME/proftpd.key.pem"
fi
# Edit proftpd.conf with user settings
if [ "$TLSEngine" = "false" ]; then
sed -i 's/TLSEngine.*/TLSEngine off/g' $ADDON_HOME/proftpd.conf
@ -91,24 +92,25 @@ fi
cd "$ADDON_DIR/bin"
case "$CryptoHash" in
"0") CryptoHash="sha-512"; SALTLength="16";;
"1") CryptoHash="sha-256"; SALTLength="16";;
"2") CryptoHash="md5"; SALTLength="8";;
esac
mkdir -p /var/config/
rm -f /var/config/proftpd.passwd
touch /var/config/proftpd.passwd
chmod 700 /var/config/proftpd.passwd
for NUM in $(seq 1 100); do
case "$CryptoHash" in
"0") password_salt=$(python -c "import crypt; print(crypt.mksalt(crypt.METHOD_SHA512))");;
"1") password_salt=$(python -c "import crypt; print(crypt.mksalt(crypt.METHOD_SHA256))");;
"2") password_salt=$(python -c "import crypt; print(crypt.mksalt(crypt.METHOD_MD5))");;
esac
USERNAME=$(eval echo \$Username${NUM})
USERPASS=$(eval echo \$Userpass${NUM})
USERPATH=$(eval echo \$Userpath${NUM})
if [ -n "$USERNAME" ]; then
echo $USERNAME:$(./mkpasswd --hash=$CryptoHash --salt=$(cat /dev/urandom | tr -cd "[:alnum:]" | head -c $SALTLength) $USERPASS):10:10::$USERPATH:/bin/false >> /var/config/proftpd.passwd
echo $USERNAME:$(python -c "import crypt; print(crypt.crypt('${USERPASS}', '${password_salt}'))"):10:10::$USERPATH:/bin/false >> /var/config/proftpd.passwd
# user writes with different user/group
mkdir -p "$USERPATH"
chmod 777 "$USERPATH"