-
Notifications
You must be signed in to change notification settings - Fork 0
/
vsftpd.yml
80 lines (70 loc) · 1.56 KB
/
vsftpd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
- name: Install vsftpd
apt:
name: [vsftpd]
# Stop vsftpd service before making changes
- name: Stop vsftpd service
systemd:
name: vsftpd
state: stopped
- name: Add ftpupload user
user:
name: ftpupload
group: ftp
# Need shadow for PAM authentication
groups: [shadow, docker]
create_home: no
password: !
state: present
- name: Set up vsftpd configuration file
template:
src: vsftpd.conf
dest: /etc/vsftpd.conf
mode: 0644
owner: root
group: root
- name: Create ftp home directory
file:
path: /mnt/data/data1/ftp
state: directory
owner: ftp
group: ftp
mode: 0500
- name: Create ftp upload directory
file:
path: /mnt/data/data1/ftp/uploads
state: directory
owner: ftp
group: ftp
mode: 0755
- name: copy vsftpd home directory README
template:
src: vsftpd-readme-home.txt
dest: /mnt/data/data1/ftp/README
mode: 0644
owner: ftp
group: ftp
- name: copy vsftpd uploads directory README
template:
src: vsftpd-readme-uploads.txt
dest: /mnt/data/data1/ftp/uploads/README
mode: 0644
owner: ftp
group: ftp
- name: allow ftp through the firewall
ufw:
rule: allow
proto: tcp
port: '{{ item }}'
with_items: [20, 21]
- name: set ftp passive range
ufw:
rule: allow
proto: tcp
port: '{{ item }}'
with_items: [10090, 10091, 10092, 10093, 10094, 10095,
10096, 10097, 10098, 10099, 10100]
# Stop vsftpd service before making changes
- name: Start vsftpd service
systemd:
name: vsftpd
state: started