Init: Docker FTP VSFtp

This commit is contained in:
Luca 2022-02-26 18:32:23 +01:00
commit 6de8f362ee
4 changed files with 53 additions and 0 deletions

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM registry.sindominio.net/debian
RUN apt -y update && \
apt install -y vsftpd rsyslog
COPY vsftpd.conf /etc/vsftpd.conf
RUN mkdir -p /var/run/vsftpd/empty
RUN mkdir /home/ftp
ADD entrypoint.sh /
ENTRYPOINT [ "/bin/sh", "/entrypoint.sh" ]
CMD ["/usr/sbin/vsftpd"]
EXPOSE 21

12
docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
version: "3"
services:
vsftp:
restart: always
build: .
volumes:
- ./data:/home/ftp
environment:
FTP_USER : user
FTP_PASS : pass
ports:
- "2021:21"

10
entrypoint.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e;
echo $FTP_USER:$FTP_PASS
if [ -z `getent passwd $FTP_USER` ]; then useradd $FTP_USER -d /home/ftp; fi
echo "$FTP_USER:$FTP_PASS" | chpasswd
echo $FTP_USER | tee -a /etc/vsftpd.userlist
exec $@

16
vsftpd.conf Normal file
View File

@ -0,0 +1,16 @@
listen=YES
listen_ipv6=NO
connect_from_port_20=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
pasv_enable=YES
pasv_min_port=40000
pasv_max_port=45000
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO