File tree 5 files changed +58
-1
lines changed
5 files changed +58
-1
lines changed Original file line number Diff line number Diff line change
1
+ * text eol =lf
Original file line number Diff line number Diff line change
1
+ FROM alpine
2
+
3
+ RUN apk --no-cache add openssh
4
+
5
+ VOLUME /ssh
6
+
7
+ EXPOSE 22
8
+
9
+ ADD start.sh /start.sh
10
+ RUN chmod u+x /start.sh
11
+ CMD /start.sh
Original file line number Diff line number Diff line change 1
1
# docker-ssh-tunneling
2
- tunnel remote ports to local ports
2
+
3
+
4
+ ## Environment Variables
5
+
6
+
7
+ #### ` SSH_PERMITOPEN= `
8
+
9
+ hosts and ports you can connect from this container
10
+ example: SSH_PERMITOPEN=database:80 mysql:* redmine:80 redmine:443
11
+
12
+
13
+ #### ` SSH_USER= `
14
+
15
+ name of the user to connect via ssh
16
+
17
+
18
+ #### ` SSH_PASSWORD= `
19
+
20
+ password of the user to connect via ssh
Original file line number Diff line number Diff line change
1
+ ssh :
2
+ image : adito/ssh-tunneling
3
+
4
+ ports :
5
+ - " 2222:22" # ssh
6
+ environment :
7
+ - SSH_USER= # SSH-User
8
+ - SSH_PASSWORD= # SSH-Password
9
+ - SSH_PERMITOPEN= # Hosts/Ports to connect (example: redmine:80 redmine:443 mysql:*)
10
+ volumes :
11
+ - /volume/ssh:/ssh
Original file line number Diff line number Diff line change
1
+ if [ ! -f /ssh/ssh_host_rsa_key ]
2
+ then
3
+ ssh-keygen -t rsa -b 4096 -f /ssh/ssh_host_rsa_key -N ' '
4
+ fi
5
+
6
+ echo " ForceCommand echo this account can only be used for tunneling" > /etc/ssh/sshd_config
7
+ echo " PermitOpen ${SSH_PERMITOPEN} " >> /etc/ssh/sshd_config
8
+ echo " AllowUsers ${SSH_USER} " >> /etc/ssh/sshd_config
9
+
10
+ ln -s -f /ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key
11
+ ln -s -f /ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_rsa_key.pub
12
+
13
+ adduser -D -H ${SSH_USER}
14
+ echo " ${SSH_USER} :${SSH_PASSWORD} " | chpasswd
15
+
16
+ /usr/sbin/sshd -D
You can’t perform that action at this time.
0 commit comments