Skip to content

Commit

Permalink
add docker servers, docker system, new FluentFTPServer
Browse files Browse the repository at this point in the history
  • Loading branch information
robinrodricks committed Jul 31, 2022
1 parent f69fcb9 commit edfb3af
Show file tree
Hide file tree
Showing 56 changed files with 3,458 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ HTML
API_Reference_CHM.shfbproj_jp
.DS_Store
.vs

FluentFTP.Tests/testdata
7 changes: 7 additions & 0 deletions FluentFTP.Tests/FluentFTP.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
<Compile Remove="testdata\**" />
<EmbeddedResource Remove="testdata\**" />
<None Remove="testdata\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand All @@ -22,6 +28,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FluentFTPServer\FluentFTPServer.csproj" />
<ProjectReference Include="..\FluentFTP\FluentFTP.csproj" />
</ItemGroup>

Expand Down
18 changes: 13 additions & 5 deletions FluentFTP.Tests/ServerTests.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
using System;
using FluentFTP.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Net;
using Xunit;
using Xunit.Sdk;

namespace FluentFTP.Tests {
public class ServerTests {

[Fact]
public void FileUpload() {

FtpClient client = new FtpClient("localhost", 21, );
client.AutoConnect();

}

}
}
}
12 changes: 11 additions & 1 deletion FluentFTP.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpExamples", "FluentFTP
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VBExamples", "FluentFTP.VBExamples\VBExamples.vbproj", "{FC62AA30-F9F0-4DC1-A9EA-51A24C624973}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentFTP.Tests", "FluentFTP.Tests\FluentFTP.Tests.csproj", "{0B17384E-6849-46D0-B880-2F97FE11A1B3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FluentFTP.Tests", "FluentFTP.Tests\FluentFTP.Tests.csproj", "{0B17384E-6849-46D0-B880-2F97FE11A1B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentFTPServer", "FluentFTPServer\FluentFTPServer.csproj", "{7ED366D7-5ABD-487C-8632-81A025644B15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -51,6 +53,14 @@ Global
{0B17384E-6849-46D0-B880-2F97FE11A1B3}.Release|Any CPU.Build.0 = Release|Any CPU
{0B17384E-6849-46D0-B880-2F97FE11A1B3}.Release|x64.ActiveCfg = Release|x64
{0B17384E-6849-46D0-B880-2F97FE11A1B3}.Release|x64.Build.0 = Release|x64
{7ED366D7-5ABD-487C-8632-81A025644B15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7ED366D7-5ABD-487C-8632-81A025644B15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7ED366D7-5ABD-487C-8632-81A025644B15}.Debug|x64.ActiveCfg = Debug|Any CPU
{7ED366D7-5ABD-487C-8632-81A025644B15}.Debug|x64.Build.0 = Debug|Any CPU
{7ED366D7-5ABD-487C-8632-81A025644B15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7ED366D7-5ABD-487C-8632-81A025644B15}.Release|Any CPU.Build.0 = Release|Any CPU
{7ED366D7-5ABD-487C-8632-81A025644B15}.Release|x64.ActiveCfg = Release|Any CPU
{7ED366D7-5ABD-487C-8632-81A025644B15}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions FluentFTP/Enums/FtpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public enum FtpServer {
Rumpus,

/// <summary>
/// Definitely ABB IDAL server
/// Definitely ABB IDAL FTP server
/// </summary>
ABBIDAL,
IDALFTP,
}
}
2 changes: 1 addition & 1 deletion FluentFTP/Servers/FtpServerSpecificHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal static class FtpServerSpecificHandler {
new XLightServer(),
new TitanFtpServer(),
new RumpusServer(),
new ABBIDALServer(),
new IDALFtpServer(),
};

#region Working Connection Profiles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ namespace FluentFTP.Servers.Handlers {
/// <summary>
/// Server-specific handling for ABB IDAL FTP servers
/// </summary>
public class ABBIDALServer : FtpBaseServer {
public class IDALFtpServer : FtpBaseServer {

/// <summary>
/// Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
/// </summary>
public override FtpServer ToEnum() {
return FtpServer.ABBIDAL;
return FtpServer.IDALFTP;
}

/// <summary>
Expand Down
14 changes: 14 additions & 0 deletions FluentFTPServer.Docker/Build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

docker build crushftp -t crushftp:fluentftp

docker build filezilla -t filezilla1:fluentftp

docker build glftpd -t glftpd:fluentftp

docker build proftpd -t proftpd:fluentftp

docker build pureftpd -t pureftpd:fluentftp

docker build vsftpd -t vsftpd:fluentftp

pause
25 changes: 25 additions & 0 deletions FluentFTPServer.Docker/crushftp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM microblink/java:latest
MAINTAINER MarkusMcNugen
# Forked from shokinn

RUN apk upgrade --no-cache \
&& apk --no-cache add bash bash-completion bash-doc ca-certificates curl wget \
&& update-ca-certificates

RUN wget -O /tmp/CrushFTP10.zip https://www.crushftp.com/early10/CrushFTP10.zip
ADD ./setup.sh /var/opt/setup.sh

RUN chmod +x /var/opt/setup.sh

VOLUME [ "/var/opt/CrushFTP10" ]

ENTRYPOINT [ "/bin/bash", "/var/opt/setup.sh" ]
CMD ["-c"]

HEALTHCHECK --interval=1m --timeout=3s \
CMD curl -f ${CRUSH_ADMIN_PROTOCOL}://localhost:${CRUSH_ADMIN_PORT}/favivon.ico -H 'Connection: close' || exit 1

ENV CRUSH_ADMIN_PROTOCOL http
ENV CRUSH_ADMIN_PORT 8080

EXPOSE 21 443 2000-2100 2222 8080 9090
23 changes: 23 additions & 0 deletions FluentFTPServer.Docker/crushftp/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
MIT License

Copyright (c) 2018 Dennis Dalstrøm
Copyright (c) 2020 Philip Henning
Copyright (c) 2021 Mark Newton

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
55 changes: 55 additions & 0 deletions FluentFTPServer.Docker/crushftp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[preview]: https://raw.githubusercontent.com/MarkusMcNugen/docker-templates/master/crushftp10/crushftp.png "CrushFTP Logo"

![alt text][preview]

# CrushFTP 10

Share your files securely with FTP, Implicit FTPS, SFTP, HTTP, or HTTPS using CrushFTP

## Docker Features
* Base: Alpine 3.12 Linux (microblink/java)
* CrushFTP 10
* Size: 234.8MB

This container is distributed under the [MIT Licence](LICENSE).

# Volumes, Paths, Ports, and Envrionmental Variables
## Volumes
| Volume | Required | Function | Example |
|----------|----------|----------|----------|
| `/var/opt/CrushFTP10` | Yes | Persistent storage for CrushFTP config | `/your/config/path/:/var/opt/CrushFTP10`|
| `/mnt/FTP/Shared` | No | Shared host folder for file sharing with users | `/your/host/path/:/mnt/FTP/Shared`|

* You can add as many volumes as you want between host and the container and change their mount location within the container. You will configure individual folder access and permissions for each user in CrushFTPs User Manager. The "/mnt/FTP/Shared" in the table above is just one such example.

## Ports
| Port | Proto | Required | Function | Example |
|----------|----------|----------|----------|----------|
| `21` | TCP | Yes | FTP Port | `21:21`|
| `443` | TCP | Yes | HTTPS Port | `443:443`|
| `2000-2100` | TCP | Yes | Passive FTP Ports | `2000-2100:2000-2100`|
| `2222` | TCP | Yes | SFTP Port | `2222:2222`|
| `8080` | TCP | Yes | HTTP Port | `8080:8080`|
| `9090` | TCP | Yes | HTTP Alt Port | `9090:9090`|

* If you wish to run certain protocols on different ports you will need to change these to match the CrushFTP config. If you enable implicit or explicit FTPS those ports will also need to be opened.

## Environment Variables
| Variable | Description | Default |
|:-----------------------|:--------------------------|:-------------|
| `CRUSH_ADMIN_USER` | Admin user of CrushFTP | `crushadmin` |
| `CRUSH_ADMIN_PASSWORD` | Password for admin user | `crushadmin` |
| `CRUSH_ADMIN_PROTOCOL` | Protocol for health cecks | `http` |
| `CRUSH_ADMIN_PORT` | Port for health cecks | `8080` |

# Installation
Run this container and mount the containers `/var/opt/CrushFTP10` volume to the host to keep CrushFTP's configuration persistent. Open a browser and go to `http://<IP>:8080`. Note that the default username and password are both `crushadmin` unless the default environment variables are changed.

This command will create a new container and expose all ports. Remember to change the `<volume>` to a location on your host machine.

```
docker run -p 21:21 -p 443:443 -p 2000-2100:2000-2100 -p 2222:2222 -p 8080:8080 -p 9090:9090 -v <volume>:/var/opt/CrushFTP10 markusmcnugen/crushftp:latest
```

# CrushFTP Configuration
Visit the [CrushFTP 10 Wiki](https://www.crushftp.com/crush10wiki/)
48 changes: 48 additions & 0 deletions FluentFTPServer.Docker/crushftp/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

CRUSH_FTP_BASE_DIR="/var/opt/CrushFTP10"

if [[ -f /tmp/CrushFTP10.zip ]] ; then
echo "Unzipping CrushFTP..."
unzip -o -q /tmp/CrushFTP10.zip -d /var/opt/
rm -f /tmp/CrushFTP10.zip
fi

if [ -z ${CRUSH_ADMIN_USER} ]; then
CRUSH_ADMIN_USER=crushadmin
fi

if [ -z ${CRUSH_ADMIN_PASSWORD} ] && [ -f ${CRUSH_FTP_BASE_DIR}/admin_user_set ]; then
CRUSH_ADMIN_PASSWORD="NOT DISPLAYED!"
elif [ -z ${CRUSH_ADMIN_PASSWORD} ] && [ ! -f ${CRUSH_FTP_BASE_DIR}/admin_user_set ]; then
CRUSH_ADMIN_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
fi

if [ -z ${CRUSH_ADMIN_PROTOCOL} ]; then
CRUSH_ADMIN_PROTOCOL=http
fi

if [ -z ${CRUSH_ADMIN_PORT} ]; then
CRUSH_ADMIN_PORT=8080
fi

if [[ ! -d ${CRUSH_FTP_BASE_DIR}/users/MainUsers/${CRUSH_ADMIN_USER} ]] || [[ -f ${CRUSH_FTP_BASE_DIR}/admin_user_set ]] ; then
echo "Creating default admin..."
cd ${CRUSH_FTP_BASE_DIR} && java -jar ${CRUSH_FTP_BASE_DIR}/CrushFTP.jar -a "${CRUSH_ADMIN_USER}" "${CRUSH_ADMIN_PASSWORD}"
touch ${CRUSH_FTP_BASE_DIR}/admin_user_set
fi

chmod +x crushftp_init.sh
${CRUSH_FTP_BASE_DIR}/crushftp_init.sh start

until [ -f prefs.XML ]
do
sleep 1
done

echo "########################################"
echo "# User: ${CRUSH_ADMIN_USER}"
echo "# Password: ${CRUSH_ADMIN_PASSWORD}"
echo "########################################"

while true; do sleep 86400; done
86 changes: 86 additions & 0 deletions FluentFTPServer.Docker/filezilla/.drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#
# Drone pipeline to build Docker image.
#

kind: pipeline
type: docker
name: default

steps:

- name: build-only
image: plugins/docker
settings:
repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-}
build_args:
- DOCKER_IMAGE_VERSION=drone-ci
dry_run: true
when:
ref:
exclude:
- refs/tags/v*

- name: set-docker-tags
image: alpine
commands:
# Always tag the Docker image with the Git tag (i.e. vX.Y.Z).
- printf "${DRONE_TAG}" >> .tags
# Tag the Docker image with with 'latest' only if not a prerelease.
- printf "${DRONE_TAG}" | grep -q '-' || printf ",latest" >> .tags
when:
ref:
- refs/tags/v*

- name: build-and-push
image: plugins/docker
settings:
repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-}
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
build_args:
- DOCKER_IMAGE_VERSION=${DRONE_TAG:1}
when:
ref:
- refs/tags/v*

- name: push-dockerhub-readme
image: jlesage/drone-push-readme
settings:
repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-}
username:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
readme: DOCKERHUB.md
when:
ref:
- refs/tags/v*

- name: microbadger
image: plugins/webhook
settings:
urls:
from_secret: microbadger_webhook
failure: ignore
when:
ref:
- refs/tags/v*

- name: notification
image: plugins/pushover
settings:
message: "{{ repo.owner }}/{{ repo.name }}#{{ truncate build.commit 8 }} ({{ build.branch }}) by {{ build.author }} - {{ build.message }}"
token:
from_secret: pushover_token
user:
from_secret: pushover_user
failure: ignore
when:
event:
exclude:
- pull_request
status:
- success
- failure
14 changes: 14 additions & 0 deletions FluentFTPServer.Docker/filezilla/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Travis CI recipe to build docker image.
#

sudo: required

language: generic

services:
- docker

script:
- echo "Starting build of Docker image..."
- docker build --no-cache --pull -t $TRAVIS_REPO_SLUG:$TRAVIS_JOB_ID .
Loading

0 comments on commit edfb3af

Please sign in to comment.