Created
March 10, 2020 01:18
-
-
Save tlesh989/243649b38e8b2548f049624e66f57be8 to your computer and use it in GitHub Desktop.
CentOS 7.7 vsftpd server with monit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process vsftpd | |
matching vsftpd | |
start program = "/usr/bin/systemctl start vsftpd" with timeout 60 seconds | |
stop program = "/usr/bin/systemctl stop vsftpd" | |
if cpu > 60% for 5 cycles then alert | |
if cpu > 80% for 10 cycles then restart | |
if memory usage > 75% then alert | |
if memory usage > 90% then restart | |
if failed port 21000 protocol ftp for 2 cycles then alert | |
if failed port 21000 protocol ftp for 4 cycles then restart | |
if 5 restarts within 50 cycles then timeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ftpuser1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listen_port=21000 | |
tcp_wrappers=YES | |
connect_from_port_20=YES | |
listen=NO | |
listen_ipv6=YES | |
pasv_enable=YES | |
pasv_min_port=40000 | |
pasv_max_port=41000 | |
anonymous_enable=NO | |
local_enable=YES | |
write_enable=YES | |
local_umask=022 | |
dirmessage_enable=YES | |
xferlog_enable=YES | |
xferlog_std_format=YES | |
pam_service_name=vsftpd | |
userlist_enable=YES | |
userlist_file=/etc/vsftpd/user_list | |
userlist_deny=NO | |
chroot_local_user=YES | |
user_sub_token=$USER | |
local_root=/home/$USER/ftp | |
ssl_enable=YES | |
rsa_cert_file=/etc/pki/tls/certs/ssl.crt | |
rsa_private_key_file=/etc/pki/tls/private/ssl.key | |
allow_anon_ssl=NO | |
force_local_data_ssl=YES | |
force_local_logins_ssl=YES | |
ssl_tlsv1=YES | |
ssl_sslv2=NO | |
ssl_sslv3=NO | |
require_ssl_reuse=NO | |
ssl_ciphers=HIGH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
yum install vsftpd -y | |
systemctl enable vsftpd | |
echo /sbin/nologin >> /etc/shells | |
useradd -m -s /sbin/nologin ftpuser1 | |
mkdir /home/ftpuser1/ftp | |
chown nobody:nobody /home/ftpuser1/ftp | |
chmod a-w /home/ftpuser1/ftp | |
mkdir /home/ftpuser1/ftp/upload | |
chown ftpuser1:ftpuser1 /home/ftpuser1/ftp/upload | |
setsebool -P allow_ftpd_full_access 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment