---
- hosts: centos8_init
user: ioniere
become: yes
tasks:
- name: vsftpd 설치
yum:
name: vsftpd
state: latest
- name: vsftpd.conf 수정 1 - 20번 포트 미사용
lineinfile:
path: /etc/vsftpd/vsftpd.conf
regexp: '^connect_from_port_20=YES$'
line: connect_from_port_20=NO
- name: vsftpd.conf 수정 2 - chroot 주석해제
lineinfile:
path: /etc/vsftpd/vsftpd.conf
regexp: '^#chroot_local_user=YES$'
line: chroot_local_user=YES
- name: vsftpd.conf 수정 3 - ipv4 listen
lineinfile:
path: /etc/vsftpd/vsftpd.conf
regexp: '^listen=NO$'
line: listen=YES
- name: vsftpd.conf 수정 4 - ipv6 listen off
lineinfile:
path: /etc/vsftpd/vsftpd.conf
regexp: '^listen_ipv6=YES$'
line: listen_ipv6=NO
- name: 기타 추가 설정
blockinfile:
path: /etc/vsftpd/vsftpd.conf
insertafter: EOF
block: |
use_localtime=YES
max_clients=30
max_per_ip=5
pasv_enable=YES
pasv_min_port=50001
pasv_max_port=50005
allow_writeable_chroot=YES
- name: vsftpd 구동
service:
name: vsftpd
state: started
enabled: yes
host, user는 상황에 맞게 수정 후 사용
방화벽 설정은 별도로 진행(21, 50001, 50002, 50003, 50004, 50005)