-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsftpplus-docker-setup.sh
More file actions
executable file
·78 lines (67 loc) · 2.19 KB
/
sftpplus-docker-setup.sh
File metadata and controls
executable file
·78 lines (67 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# To be used with the SFTPPlus Dockerfile.
# Get relevant deps per distribution installed.
. /etc/os-release
case ${ID} in
rhel|centos)
# Get the OpenSSL library, as this is the only dependency.
yum check-update
yum update openssl
yum info openssl
yum clean all -y
;;
ubuntu|debian)
# Get the OpenSSL and libffi libraries, the only dependencies.
apt-get update
apt-get install -y openssl libffi7
apt-get clean
;;
alpine)
# Update the already-included OpenSSL libs.
apk update
apk upgrade
# Get the libffi library, as this is the only dependency missing.
apk add libffi
# Force cleaning the cache.
rm -f /var/cache/apk/*
;;
esac
# yum check-update has exit code 100 when packages need to be updated.
set -xe
# Link the unpacked sub-dir as /opt/sftpplus.
cd /opt
mv sftpplus-${SFTPPLUS_PLATFORM}-* sftpplus
# A basic SFTPPlus configuration is picked up from configuration/, which
# requires SSL certificates and SSH keys generated through the next step.
mv /opt/configuration/* /opt/sftpplus/configuration/
rm -rf /opt/configuration
# Add default group and user.
case ${ID} in
alpine)
addgroup sftpplus
adduser -G sftpplus -g "SFTPPlus" -s /bin/false -h /opt/sftpplus/run -H -D sftpplus
;;
*)
groupadd sftpplus
useradd -g sftpplus -c "SFTPPlus" -s /bin/false -d /opt/sftpplus/run -M sftpplus
;;
esac
# Create the basic storage directory for the default-enabled test_user account.
mkdir -p /srv/storage/test_user
chmod +x /opt/sftpplus-docker-entrypoint.sh
# Adjust ownership of the configuration files and logs.
chown -R sftpplus \
/opt/sftpplus/configuration \
/opt/sftpplus/log \
/srv/storage
# Add extra permissions for OpenShift Container Platform-specific guidelines.
chgrp -R 0 /opt/sftpplus/configuration \
/opt/sftpplus/log \
/srv/storage
chmod -R g=u /opt/sftpplus/configuration \
/opt/sftpplus/log \
/srv/storage
# Just to troubleshoot and check the permisisons are set ok at the
# end of the run.
ls -al /opt/sftpplus/
# Also show the ID of the sftpplus user.
id sftpplus