This repository was archived by the owner on Jul 7, 2023. It is now read-only.
File tree 3 files changed +42
-14
lines changed
3 files changed +42
-14
lines changed Original file line number Diff line number Diff line change 1
1
FROM alpine:latest
2
- LABEL maintainer
"[email protected] "
2
+ LABEL maintainer
"[email protected] "
3
+ ARG VERSION_S3FS=v1.83
3
4
4
- # s3fs tag to checkout
5
- ARG S3FS_VERSION=v1.83
6
-
7
- # Install s3fs binary
8
- RUN apk add --no-cache --virtual .fuse-builddeps \
5
+ # Install s3fs-fuse and sftpserver
6
+ RUN apk upgrade --no-cache \
7
+ && apk add --no-cache --virtual build-deps \
9
8
alpine-sdk \
10
9
automake \
11
10
autoconf \
12
11
curl-dev \
13
12
fuse-dev \
13
+ gnutls-dev \
14
14
libxml2-dev \
15
- && git clone https://github.com/s3fs-fuse/s3fs-fuse.git \
15
+ libgcrypt-dev \
16
+ && git clone https://github.com/s3fs-fuse/s3fs-fuse \
16
17
&& cd s3fs-fuse \
17
- && git checkout tags/${S3FS_VERSION } -b ${S3FS_VERSION } \
18
+ && git checkout tags/${VERSION_S3FS } -b ${VERSION_S3FS } \
18
19
&& ./autogen.sh \
19
- && ./configure --prefix=/usr \
20
- && make \
20
+ && ./configure --prefix=/usr --with-gnutls \
21
21
&& make install \
22
22
&& cd .. \
23
23
&& rm -rf s3fs-fuse \
24
- && apk del .fuse-builddeps
24
+ && apk del build-deps
25
25
26
26
# Install vsftpd and s3fs libraries
27
27
RUN apk add --no-cache \
28
28
fuse \
29
+ gnutls \
29
30
lftp \
30
31
libcurl \
32
+ libgcrypt \
31
33
libstdc++ \
32
34
libxml2 \
33
35
logrotate \
36
+ openssh \
34
37
openssl \
35
38
vsftpd
36
39
37
40
RUN sed -i 's|/var/log/messages|/var/log/*.log|' /etc/logrotate.conf
38
41
42
+ RUN ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N '' \
43
+ && ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ''
44
+
39
45
COPY lftp-sync.sh /usr/local/bin/
40
46
RUN chmod 755 /usr/local/bin/lftp-sync.sh
41
47
42
48
COPY docker-entrypoint.sh /
43
49
ENTRYPOINT ["/docker-entrypoint.sh" ]
50
+ EXPOSE 21/tcp
51
+ EXPOSE 22/tcp
52
+ EXPOSE 65000/tcp
44
53
VOLUME ["/var/log" ]
Original file line number Diff line number Diff line change 1
1
# docker-vsftpd-s3
2
2
3
- Alpine based Dockerfile running a vsftpd server providing FTP access to an Amazon S3 bucket.
3
+ Alpine based Dockerfile running a vsftpd server providing secure FTP access to an Amazon S3 bucket.
4
4
This docker image can run in Amazon ECS.
5
5
6
6
## Usage
@@ -78,3 +78,9 @@ Start a docker from this image.
78
78
$ docker run -it --device /dev/fuse --cap-add sys_admin --security-opt apparmor:unconfined -p 21:21 -p 65000:65000 -e AWS_ACCESS_KEY_ID=ABCDEFGHIJKLMNOPQRST -e AWS_SECRET_ACCESS_KEY=0123456789ABCDEF0123456789ABCDEF01234567 -e S3_BUCKET=" my-s3-bucket" -e FTPD_USER=" my_ftp_user" -e FTPD_PASS=" my_ftp_password" vsftpd-s3
79
79
```
80
80
81
+ ## Security notes
82
+
83
+ Current docker image is shipped with FTPS and SFTP support, although SFTP support should be (and will be !) shipped in a separate docker image.
84
+ SFTP is served by openssh listening on port 22. SFTP is not properly configured to chroot users in their homedir.
85
+ This allows an authenticated user to leak the list of your ftp users.
86
+
Original file line number Diff line number Diff line change @@ -98,6 +98,19 @@ echo "${FTPD_USERS}" |sed 's/ /\n/g' |while read line; do
98
98
done
99
99
done
100
100
101
+ # Enable SFTP
102
+ echo " Protocol 2
103
+ HostKey /etc/ssh/ssh_host_ed25519_key
104
+ HostKey /etc/ssh/ssh_host_rsa_key
105
+ UseDNS no
106
+ PermitRootLogin no
107
+ X11Forwarding no
108
+ AllowTcpForwarding no
109
+ Subsystem sftp internal-sftp
110
+ ForceCommand internal-sftp -d %u
111
+ ChrootDirectory /home
112
+ " > /etc/ssh/sshd_config
113
+
101
114
# FTP sync client
102
115
FTP_SYNC=${FTP_SYNC:- 0}
103
116
FTP_HOST=${FTP_HOST:- localhost}
@@ -116,6 +129,6 @@ DIR_LOCAL=${DIR_LOCAL:-/home/$FTPD_USER}
116
129
# Launch crond
117
130
crond -L /var/log/crond.log
118
131
119
- # Launch vsftpd
120
- [ $# -eq 0 ] && /usr/sbin/vsftpd || exec " $@ " &
132
+ # Launch sshd && vsftpd
133
+ [ $# -eq 0 ] && /usr/sbin/sshd -e && /usr/sbin/ vsftpd || exec " $@ " &
121
134
PID=$! && wait
You can’t perform that action at this time.
0 commit comments