Skip to content

Commit

Permalink
fix: fixed dockerfile of sshd
Browse files Browse the repository at this point in the history
  • Loading branch information
shoriwe committed Jun 12, 2023
1 parent 3538cbc commit 5b6f18c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
15 changes: 4 additions & 11 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@ services:
- "127.0.0.1:8000:80"
command: ["-listen", ":80", "-text", "ECHO"]
sshd:
image: panubo/sshd:latest
build:
context: sshd
dockerfile: Dockerfile
container_name: fullproxy-sshd
restart: unless-stopped
networks:
- fullproxy
ports:
- "127.0.0.1:22222:22"
#- "[::1]:22222:22"
volumes:
- ./sshd/entrypoint.sh:/etc/entrypoint.d/entrypoint.sh:ro
environment:
- SSH_ENABLE_PASSWORD_AUTH=true
- GATEWAY_PORTS=true
- TCP_FORWARDING=true
- SSH_ENABLE_ROOT=true
- SSH_ENABLE_ROOT_PASSWORD_AUTH=true
- "127.0.0.1:22222:22"
24 changes: 24 additions & 0 deletions sshd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM alpine:latest

RUN apk --update add --no-cache openssh bash
# Comment old configs
RUN sed -i 's/^PermitRootLogin.*/#PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/^AllowTcpForwarding.*/#AllowTcpForwarding yes/' /etc/ssh/sshd_config
RUN sed -i 's/^PermitOpen.*/#PermitOpen any/' /etc/ssh/sshd_config
RUN sed -i 's/^PermitTunnel.*/#PermitTunnel yes/' /etc/ssh/sshd_config
RUN sed -i 's/^Port.*/#Port 22/g' /etc/ssh/sshd_config
# New Config
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
RUN echo "PermitOpen any" >> /etc/ssh/sshd_config
RUN echo "PermitTunnel yes" >> /etc/ssh/sshd_config
RUN echo "Port 22" >> /etc/ssh/sshd_config
#
RUN echo "root:password" | chpasswd
RUN rm -rf /var/cache/apk/*
RUN /usr/bin/ssh-keygen -A
RUN ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_key
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
2 changes: 1 addition & 1 deletion sshd/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

const (
SSHDefaultUser = "low"
SSHDefaultUser = "root"
SSHDefaultPassword = "password"
DefaultAddr = "localhost:22222"
)
Expand Down
7 changes: 0 additions & 7 deletions sshd/entrypoint.sh

This file was deleted.

0 comments on commit 5b6f18c

Please sign in to comment.