Adding FTP server

This commit is contained in:
VC
2024-07-05 11:53:07 +02:00
parent 949c9bbb13
commit 9fc3efae7f
8 changed files with 68 additions and 1 deletions

4
ftp.yml Normal file
View File

@@ -0,0 +1,4 @@
- hosts: ftpservers
diff: yes
roles:
- ftp

View File

@@ -93,3 +93,6 @@ muse-macbookair.lan
[unifiservers] [unifiservers]
unifi.dmz.mateu.be unifi.dmz.mateu.be
[ftpservers]
ftp.dmz.mateu.be

View File

@@ -499,6 +499,16 @@ config rule
option dest_port '123' option dest_port '123'
option target 'ACCEPT' option target 'ACCEPT'
# FTP
config rule
option name 'Allow-OUTPUT-FTP'
option src 'iot'
list proto 'tcp'
option dest 'dmz'
option dest_ip '{{ hostvars['ftp.dmz.mateu.be']['ansible_default_ipv4']['address'] }}'
option dest_port '21 10100-10110'
option target 'ACCEPT'
## Default configuration ## Default configuration
config defaults config defaults
option syn_flood '1' option syn_flood '1'

View File

@@ -0,0 +1,20 @@
listen=NO
listen_ipv6=YES
anonymous_enable=YES
local_enable=NO
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
utf8_filesystem=YES
no_anon_password=YES
anon_root=/srv/ftp
pasv_enable=YES
pasv_min_port=10100
pasv_max_port=10110

View File

@@ -0,0 +1,4 @@
- name: restart vsftpd
service:
name: vsftpd
state: restarted

25
roles/ftp/tasks/main.yml Normal file
View File

@@ -0,0 +1,25 @@
- name: Install vsftpd
package:
name: vsftpd
state: present
- name: Create ftp directory
file:
path: /srv/ftp
state: directory
- name: Create upload directory
file:
path: /srv/ftp/upload
owner: ftp
group: root
state: directory
- name: Config vsftpd
copy:
src: files/vsftpd.conf
dest: /etc/vsftpd.conf
owner: root
group: root
notify: restart vsftpd

View File

@@ -1,5 +1,5 @@
- name: install acme.sh - name: install acme.sh
shell: curl https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 LE_WORKING_DIR=/etc/x509 sh shell: curl https://get.acme.sh | INSTALLONLINE=1 LE_WORKING_DIR=/etc/x509 sh
args: args:
creates: /etc/x509 creates: /etc/x509

View File

@@ -18,3 +18,4 @@
- import_playbook: icecast2.yml - import_playbook: icecast2.yml
- import_playbook: munin.yml - import_playbook: munin.yml
- import_playbook: unifi.yml - import_playbook: unifi.yml
- import_playbook: ftp.yml