Major update to stretch and many improvements

Improvements:
* Update to debian stretch
* Fix Dockerfile style
* Add FTP UID/GID Docker build args
* Add run-ssl to Makefile for testing SSL config
* Fix scripts style
* Fix scripts issues reported by shellcheck
* Add FTP_CHOWN_ROOT function to chown /srv in the container
* Add allow_writeable_chroot=YES to vsftpd_ssl.conf to match vsftpd.conf
* Update README.md
This commit is contained in:
Tim Robinson
2018-05-01 22:01:08 +10:00
parent 8140d6f5af
commit 07b4a555ff
7 changed files with 97 additions and 62 deletions

View File

@@ -1,25 +1,28 @@
docker_tag = panubo/vsftpd
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
APP_HOST := localhost
endif
ifeq ($(UNAME_S),Darwin)
APP_HOST := $(shell docker-machine ip default)
endif
NAME := panubo/vsftpd
TAG := latest
build:
docker build -t $(docker_tag) .
docker build --build-arg FTP_UID=$(shell id -u) --build-arg FTP_GID=$(shell id -g) -t $(NAME):$(TAG) .
bash:
docker run --rm -it $(docker_tag) bash
docker run --rm -it $(NAME):$(TAG) bash
env:
@echo "FTP_USER=ftp" >> env
@echo "FTP_PASSWORD=ftp" >> env
vsftpd.pem:
openssl req -new -newkey rsa:2048 -days 365 -nodes -sha256 -x509 -keyout vsftpd.pem -out vsftpd.pem -subj '/CN=self_signed'
run: env
$(eval ID := $(shell docker run -d --env-file env -v $(shell pwd)/srv:/srv ${docker_tag}))
$(eval ID := $(shell docker run -d --env-file env -v $(shell pwd)/srv:/srv ${NAME}:${TAG}))
$(eval IP := $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${ID}))
@echo "Running ${ID} @ ftp://${IP}"
@docker attach ${ID}
@docker kill ${ID}
run-ssl: env vsftpd.pem
$(eval ID := $(shell docker run -d --env-file env -v $(shell pwd)/srv:/srv -v $(PWD)/vsftpd.pem:/etc/ssl/certs/vsftpd.crt -v $(PWD)/vsftpd.pem:/etc/ssl/private/vsftpd.key ${NAME}:${TAG} vsftpd /etc/vsftpd_ssl.conf))
$(eval IP := $(shell docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${ID}))
@echo "Running ${ID} @ ftp://${IP}"
@docker attach ${ID}