# WHP vsftpd Configuration
# Secure FTP server configuration with chroot jailing for hosting users

# Basic Settings
listen=YES
listen_ipv6=NO
anonymous_enable=NO
local_enable=YES
write_enable=YES

# Security Settings
chroot_local_user=YES
chroot_list_enable=NO
allow_writeable_chroot=YES

# User Management
user_sub_token=$USER
local_root=/docker/users/$USER
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO

# Connection Settings
ftpd_banner=Welcome to WHP FTP Server
dirmessage_enable=YES
use_localtime=YES

# Transfer Settings
ascii_upload_enable=YES
ascii_download_enable=YES

# Logging
xferlog_enable=YES
xferlog_std_format=YES
xferlog_file=/var/log/vsftpd.log

# Network Settings
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty

# PAM Service
pam_service_name=vsftpd

# SSL/TLS Settings (optional, can be enabled later)
ssl_enable=NO
# ssl_tlsv1=YES
# ssl_sslv2=NO
# ssl_sslv3=NO
# rsa_cert_file=/etc/ssl/certs/vsftpd.pem

# Performance Settings
max_clients=50
max_per_ip=3
local_max_rate=0

# Additional Security
hide_ids=NO
ls_recurse_enable=NO
download_enable=YES

# Directory Listing Settings
force_dot_files=YES
force_local_logins_ssl=NO
force_local_data_ssl=NO

# Port Settings
ftp_data_port=20
listen_port=21

# Passive Mode Settings (important for firewalls)
pasv_enable=YES
pasv_min_port=60000
pasv_max_port=60100
pasv_address=$PUBLIC_IP

# File Creation Permissions
file_open_mode=0666
local_umask=022

# Directory Permissions
# anon_mkdir_write_enable=NO  # Not needed since anonymous_enable=NO 