Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SSL Certificate as default and Update centos 9 #92

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
.idea
compose-*.yaml
compose.yaml
compose-*.yml
compose.yml
home
log
logs
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
FROM centos:7
FROM quay.io/centos/centos:stream9

ARG USER_ID=14
ARG GROUP_ID=50

MAINTAINER Fer Uria <fauria@gmail.com>
LABEL Description="vsftpd Docker image based on Centos 7. Supports passive mode and virtual users." \
License="Apache License 2.0" \
Usage="docker run -d -p [HOST PORT NUMBER]:21 -v [HOST FTP HOME]:/home/vsftpd fauria/vsftpd" \
Version="1.0"

RUN yum -y update && yum clean all
RUN yum install -y \
vsftpd \
db4-utils \
db4 \
iproute && yum clean all
RUN yum install -y vsftpd libdb-utils iproute && yum clean all

RUN usermod -u ${USER_ID} ftp
RUN groupmod -g ${GROUP_ID} ftp
Expand All @@ -34,6 +29,12 @@ ENV REVERSE_LOOKUP_ENABLE YES
ENV PASV_PROMISCUOUS NO
ENV PORT_PROMISCUOUS NO

# Create directory for SSL certificate and generate it without prompts
RUN mkdir -p /etc/ssl/private && \
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem \
-subj "/C=US/ST=State/L=City/O=Organization/OU=Department/CN=example.com"

COPY vsftpd.conf /etc/vsftpd/
COPY vsftpd_virtual /etc/pam.d/
COPY run-vsftpd.sh /usr/sbin/
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml → example-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:

vsftpd:
Expand All @@ -9,6 +7,10 @@ services:
args:
USER_ID: 1000
GROUP_ID: 1000
environment:
FTP_USER: xxx
FTP_PASS: xxx
PASV_ADDRESS: xx.xx.xx.xx
restart: always
ports:
- 0.0.0.0:20:20
Expand Down
13 changes: 13 additions & 0 deletions vsftpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ allow_writeable_chroot=YES
## Hide ids from user
hide_ids=YES

## Enable SSL
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
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

## Enable logging
xferlog_enable=YES
xferlog_file=/var/log/vsftpd/vsftpd.log
Expand Down