You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.6 KiB

#!/usr/bin/env bash
set -u
DESC="Fixe proftp (serveur:bigboss et client:tiny)"
HELP="
Bigboss et tiny doivent avoir été configurés par baseConfig.
ATTENTION, le fichier suivant est modifié :
- /etc/proftpd/proftpd.conf
Une copie de l'original est faite avec l'extension .vdn
"
repairProftpd() {
echo
echo "Repair proftpd"
vdn-ssh root@bigboss "
[ ! -e /etc/proftpd/proftpd.conf.vdn ] && \
cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf.vnd
grep -q '^<Anonymous' /etc/proftpd/proftpd.conf && exit 0
cat << EOF >> /etc/proftpd/proftpd.conf
# A basic anonymous configuration, no upload directories.
<Anonymous ~ftp>
User ftp
Group nogroup
# We want clients to be able to login with \"anonymous\" as well as \"ftp\"
UserAlias anonymous ftp
# Cosmetic changes, all files belongs to ftp user
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell off
# Limit the maximum number of anonymous logins
MaxClients 10
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayChdir .message
# Limit WRITE everywhere in the anonymous chroot
<Directory *>
<Limit WRITE>
DenyAll
</Limit>
</Directory>
</Anonymous>
EOF
systemctl enable proftpd
systemctl restart proftpd
"
}
run() {
setErrorHandler
echoStart
requireSshGuests bigboss tiny
repairProftpd
echoDoneWithTestErrors
}