Giter VIP home page Giter VIP logo

docker-pure-ftpd's Introduction

Docker Pure-ftpd Server with API

https://hub.docker.com/r/cashstory/pureftpd-api/

Based on stilliard pure ftpd thanks to his work ! And Chaperone to manage our APi and pure-ftpd.


Starting it

docker-compose up ftpd_server


Setting runtime FTP options

To check all available options go to stilliard README Keep in your mind, change docker command will not affect ftp command since now the image run with chaperon to manage both API and ftp process Fork this repo and edit chaperone conf instead.

The only env option in our docker-compose we provide in addition to stilliard image is X_API_KEY => if you don't provide it it will be auto created when you run the container. Don't do it in production it will change at each restart.


Operating it though API

To add user curl -X POST --header "X-api-key:YOURAPIKEY" -F 'username=davidwalsh' -F 'password=toto' localhost:5000/user/add

To get user info curl -X GET --header "X-api-key:YOURAPIKEY" -F 'username=davidwalsh' localhost:5000/user/info

To get list all username curl -X GET --header "X-api-key:YOURAPIKEY" localhost:5000/user/list

To delete user curl -X POST --header "X-api-key:YOURAPIKEY" -F 'username=davidwalsh' localhost:5000/user/del

To delete user and keep is folder curl -X POST --header "X-api-key:YOURAPIKEY" -F 'username=davidwalsh' -F 'archive=true' localhost:5000/user/del

To update user curl -X PUT --header "X-api-key:YOURAPIKEY" -F 'username=davidwalsh' -F 'directory=toto' localhost:5000/user/edit

To update user password curl -X PUT --header "X-api-key:YOURAPIKEY" -F 'username=davidwalsh' -F 'password=toto' localhost:5000/user/password

all allowed config for add and edit, to understand better check https://download.pureftpd.org/pub/pure-ftpd/doc/README.Virtual-Users

{
chroot: boolean,
directory: string,
download_bandwidth: number,
upload_bandwidth: number,
max_files_number: number,
max_files_Mbytes: number,
upload_ratio: number,
download_ratio: number,
allow_client_ip: string,
deny_client_ip: string,
allow_local_ip: string,
deny_local_ip: string,
max_concurrent_sessions: number,
max_concurrent_login_attempts: number,
memory_reserve_password_hashing: number,
allowed_range_day: string,
}

Our default pure-ftpd options explained

they differ from the original repo, we add more secure option, and some sharing options to have facility in volume sharing.

/usr/sbin/pure-ftpd # path to pure-ftpd executable
-c 50 # no more than 50 people at once (Speed optimisation)
-C 5 # no more than 5 requests from the same ip (Speed optimisation)
-E # Anonymous logins are prohibited (Security)
-H # avoids host names resolution (Speed optimisation)
-j # --createhomedir (auto create home directory if it doesnt already exist)
-k 90 # Don't allow uploads if the partition is more than 95% full (Security)
-l puredb:/etc/pure-ftpd/pureftpd.pdb # --login (login file for virtual users)
-P $PUBLICHOST # IP/Host setting for PASV support, passed in your the PUBLICHOST env var
-p 30000:30099 # PASV port range (100 ports for 50 max clients)
-R # Disallow users usage of the CHMOD command. (Security)
-U 113:002 # set umask to allow shared volume to work (Facility)
-X # users can't *read* files and directories beginning with a dot (Security)
-Z # protect customers against common mistakes, bad chmod (Security)
-tls 1 # Enables optional TLS support (Security)

For more information please see man pure-ftpd, or visit: https://www.pureftpd.org/


Docker Volumes

There are a few spots onto which you can mount a docker volume to configure the server and persist uploaded data. It's recommended to use them in production.

  • /home/ftpusers/ The ftp's data volume (by convention).
  • /etc/pure-ftpd A directory containing the single pureftpd.passwd file which contains the user database (i.e., all virtual users, their passwords and their home directories). This is read on startup of the container and updated by the pure-pw useradd -f /etc/pure- ftpd/pureftpd.passwd ... command.

Keep user database in a volume

You may want to keep your user database through the successive image builds. It is possible with Docker volumes.

Create a named volume:

docker volume create --name my-db-volume

Specify it when running the container:

docker run -d --name ftpd_server -p 21:21 -p 30000-30099:30000-30099 -e "PUBLICHOST=localhost" -v my-db-volume:/etc/pure-ftpd cashstory/pureftpd-api:hardened

Automatic TLS certificate generation

If ADDED_FLAGS contains --tls and file /etc/ssl/private/pure-ftpd.pem does not exists it is possible to generate self-signed certificate if TLS_CN, TLS_ORG and TLS_C are set.

Keep in mind that if no volume is set for /etc/ssl/private/ directory generated certificates won't be persisted and new ones will be generated on each start.

docker-pure-ftpd's People

Contributors

bobcashstory avatar fossabot avatar furikuri avatar gdyuldin avatar goochjj avatar guoyaohui avatar italomaia avatar jmdilly avatar kluthen avatar l-vo avatar lafriks avatar nakedsushi avatar nicolasguenther avatar nuschk avatar riderx avatar stilliard avatar vitorarantes avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.