Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add Dockerfile(s) for Apache FTP Server #1063

Merged
merged 2 commits into from
Nov 25, 2022
Merged
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
15 changes: 8 additions & 7 deletions FluentFTP.Dockers/Build.bat
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
docker build apache -t apache:fluentftp

docker build proftpd -t proftpd:fluentftp
docker build bftpd -t bftpd:fluentftp

docker build pureftpd -t pureftpd:fluentftp
docker build filezilla -t filezilla:fluentftp

docker build vsftpd -t vsftpd:fluentftp
docker build glftpd -t glftpd:fluentftp

docker build pyftpdlib -t pyftpdlib:fluentftp
docker build proftpd -t proftpd:fluentftp

docker build bftpd -t bftpd:fluentftp
docker build pureftpd -t pureftpd:fluentftp

docker build glftpd -t glftpd:fluentftp
docker build pyftpdlib -t pyftpdlib:fluentftp

docker build filezilla -t filezilla:fluentftp
docker build vsftpd -t vsftpd:fluentftp

pause
15 changes: 8 additions & 7 deletions FluentFTP.Dockers/Build.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
sudo docker build apache -t bftpd:apache

sudo docker build proftpd -t proftpd:fluentftp
sudo docker build bftpd -t bftpd:fluentftp

sudo docker build pureftpd -t pureftpd:fluentftp
sudo docker build filezilla -t filezilla:fluentftp

sudo docker build vsftpd -t vsftpd:fluentftp
sudo docker build glftpd -t glftpd:fluentftp

sudo docker build pyftpdlib -t pyftpdlib:fluentftp
sudo docker build proftpd -t proftpd:fluentftp

sudo docker build bftpd -t bftpd:fluentftp
sudo docker build pureftpd -t pureftpd:fluentftp

sudo docker build glftpd -t glftpd:fluentftp
sudo docker build pyftpdlib -t pyftpdlib:fluentftp

sudo docker build filezilla -t filezilla:fluentftp
sudo docker build vsftpd -t vsftpd:fluentftp
69 changes: 69 additions & 0 deletions FluentFTP.Dockers/apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# FluentFTP Integration Test Server: apache
#

#
# Stage 1: build
#

FROM debian:bullseye-slim AS build

SHELL ["/bin/bash", "-c"]

ARG APACHE_VERSION=1.2.0

ARG APACHE_URL=https://dlcdn.apache.org/mina/ftpserver/${APACHE_VERSION}/apache-ftpserver-${APACHE_VERSION}-bin.tar.gz

ARG DEBIAN_FRONTEND=noninteractive
ARG APT_CMD='apt install -y --no-install-recommends'

RUN apt update && apt upgrade -y && apt install -y apt-utils && \
\
$APT_CMD \
ca-certificates \
wget

WORKDIR /root
RUN wget -O apache.tar.gz ${APACHE_URL} && \
tar xzf apache.tar.gz && \
mv apache-ftpserver-${APACHE_VERSION} apache

#
# Stage 2: production
#

FROM debian:bullseye-slim AS production

LABEL Description="FluentFTP apache-ftp-server docker image based on Debian Bullseye."

SHELL ["/bin/bash", "-c"]

ARG DEBIAN_FRONTEND=noninteractive
ARG APT_CMD='apt install -y --no-install-recommends'

RUN apt update && apt upgrade -y && apt install -y apt-utils && \
\
$APT_CMD \
default-jre

COPY run-apache.sh /usr/bin/

COPY --from=build /root/apache /root/apache

COPY config.xml /root/apache/res/conf/config.xml
COPY users.properties /root/apache/res/conf/users.properties

WORKDIR /
RUN sed -i -e "s/\r//" /root/apache/res/conf/config.xml && \
sed -i -e "s/\r//" /root/apache/res/conf/users.properties && \
sed -i -e "s/\r//" /usr/bin/run-apache.sh && \
chmod +x /usr/bin/run-apache.sh && \
\
useradd -m -p savatlcb.1m26 fluentuser && \
\
mkdir -p /home/fluentuser/ && \
chown -R fluentuser:users /home/fluentuser

EXPOSE 20 21

CMD ["/usr/bin/run-apache.sh"]
30 changes: 30 additions & 0 deletions FluentFTP.Dockers/apache/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the
License.
-->
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1 https://mina.apache.org/ftpserver-project/ftpserver-1.0.xsd"
id="myServer"
anon-enabled="false">
<listeners>
<nio-listener name="default" port="21">
<data-connection idle-timeout="60">
<active enabled="true" local-port="20" />
<passive ports="21100-21199" external-address="127.0.0.1" />
</data-connection>
</nio-listener>
</listeners>
<file-user-manager file="./res/conf/users.properties" />
</server>
15 changes: 15 additions & 0 deletions FluentFTP.Dockers/apache/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
apache:
build:
context: .
network: host
restart: unless-stopped
restart: always
network_mode: "host"
ports:
- 0.0.0.0:20:20
- 0.0.0.0:21:21
- 21100-21199:21100-21199
volumes:
- ./home:/home/apache
- ./logs:/var/log/apache
19 changes: 19 additions & 0 deletions FluentFTP.Dockers/apache/run-apache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# stdout server info:
cat << EOB
*************************************************
* *
* Docker image: fluentftp apache *
* *
*************************************************

SERVER SETTINGS
---------------
· FTP User: fluentuser
· FTP Password: fluentpass
EOB

# Run apache:
cd /root/apache
bin/ftpd.sh res/conf/config.xml
27 changes: 27 additions & 0 deletions FluentFTP.Dockers/apache/users.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# user password is "fluentpass" code in md5
ftpserver.user.fluentuser.userpassword=9AB870DD41C07E40C6C96307DB575E56
ftpserver.user.fluentuser.homedirectory=./res/home
ftpserver.user.fluentuser.enableflag=true
ftpserver.user.fluentuser.writepermission=true
ftpserver.user.fluentuser.maxloginnumber=0
ftpserver.user.fluentuser.maxloginperip=0
ftpserver.user.fluentuser.idletime=0
ftpserver.user.fluentuser.uploadrate=0
ftpserver.user.fluentuser.downloadrate=0
27 changes: 15 additions & 12 deletions FluentFTP.Tests/Integration/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ public class IntegrationTests {

// These can do both FTP and FTPS
[Fact]
public async Task VsFtpd() {
await IntegrationTestRunner.Run(FtpServer.VsFTPd);
}
[Fact]
public async Task VsFtpdSsl() {
await IntegrationTestRunner.Run(FtpServer.VsFTPd, UseSsl);
}
[Fact]
public async Task ProFtpd() {
await IntegrationTestRunner.Run(FtpServer.ProFTPD);
}
Expand All @@ -36,20 +28,31 @@ public async Task PureFtpd() {
public async Task PureFtpdSsl() {
await IntegrationTestRunner.Run(FtpServer.PureFTPd, UseSsl);
}

// These can only do FTPS
[Fact]
public async Task Glftpd() {
await IntegrationTestRunner.Run(FtpServer.glFTPd);
public async Task VsFtpd() {
await IntegrationTestRunner.Run(FtpServer.VsFTPd);
}
[Fact]
public async Task VsFtpdSsl() {
await IntegrationTestRunner.Run(FtpServer.VsFTPd, UseSsl);
}

// These can only do FTPS
[Fact]
public async Task FileZilla() {
await IntegrationTestRunner.Run(FtpServer.FileZilla);
}
[Fact]
public async Task Glftpd() {
await IntegrationTestRunner.Run(FtpServer.glFTPd);
}

// These can only do FTP
[Fact]
public async Task Apache() {
await IntegrationTestRunner.Run(FtpServer.Apache);
}
[Fact]
public async Task Bftpd() {
await IntegrationTestRunner.Run(FtpServer.BFTPd);
}
Expand Down