diff --git a/SSHct/Dockerfile b/SSHct/Dockerfile deleted file mode 100644 index f71255f..0000000 --- a/SSHct/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM debian:9 - -VOLUME /home -EXPOSE 22 -ENTRYPOINT ["/bin/entrypoint"] - -ENV CTUSER me -ENV CTUSERID 1000 -ENV CTUSERPWD 123qweASD -ENV CTTIMEZONE Asia/Novosibirsk -ENV CTLOCALE ru_RU.UTF-8 -ENV PUBKEY none - -RUN apt-get update -y && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - openssh-server bash tmux curl sudo less vim gnupg ca-certificates \ - dialog locales man bash-completion wget apt-file telnet \ - dnsutils git pwgen python bc unzip graphviz whois mysql-client golang-1.8 - -ADD sshd_config /etc/ssh/sshd_config -ADD entrypoint.sh /bin/entrypoint -RUN chmod +x /bin/entrypoint -ADD init.sh /bin/init.sh -RUN chmod +x /bin/init.sh - -RUN mkdir /var/run/sshd -RUN echo '%sudo ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers - diff --git a/SSHct/entrypoint.sh b/SSHct/entrypoint.sh deleted file mode 100644 index c144fc4..0000000 --- a/SSHct/entrypoint.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -echo $CTTIMEZONE > /etc/timezone -ln -sf /usr/share/zoneinfo/$CTTIMEZONE /etc/localtime -dpkg-reconfigure -f noninteractive tzdata - -sed -i -e "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen -sed -i -e "s/# $CTLOCALE UTF-8/$CTLOCALE UTF-8/" /etc/locale.gen -dpkg-reconfigure --frontend=noninteractive locales -update-locale LANG=$CTLOCALE - -echo "AllowUsers $CTUSER" >> /etc/ssh/sshd_config -useradd --uid $CTUSERID --user-group --shell /bin/bash $CTUSER -if [ -f /home/.$CTUSER.shadow -a \ - "$(stat --dereference --printf='%u %g %a' /home/.$CTUSER.shadow)" == "0 0 640" ]; then - echo $CTUSER:"$(cat /home/.$CTUSER.shadow)" | chpasswd -e -else - echo $CTUSER:"$CTUSERPWD" | chpasswd -fi -passwd -u $CTUSER -usermod -a -G sudo $CTUSER - -# Add pubkey -if [ "$PUBKEY" != "none" ]; then - echo "$PUBKEY" >> /home/$CTUSER/.ssh/authorized_keys - chmod 600 /home/$CTUSER/.ssh/authorized_keys -fi - -# Run init script in background -tmux new-session -d -s init '/bin/init.sh' - -# start ssh daemon -exec /usr/sbin/sshd -Def /etc/ssh/sshd_config diff --git a/SSHct/init.sh b/SSHct/init.sh deleted file mode 100644 index 4bbd176..0000000 --- a/SSHct/init.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -exec >>/home/.init.log 2>&1 - -echo ====================== INIT START -date - -# Install additional packages -echo ====== Installing additional packages -if [ -f /home/.packages ]; then - cat /home/.packages | xargs --max-args=1 apt-get install -y -fi - -# Run custom scripts /home/.scripts/*.sh -if [ -d /home/.scripts ]; then - find /home/.scripts -name '*.sh' | while read s; do - if [ -x "$s" ]; then # if script is executable - echo ====== $(date) - echo Running $s - $s <&- # run it with closed stdin, so it does not consume `find` output - else - echo ====== $(date) - echo Skipping non-executable $s - fi - done -fi - -echo ====================== INIT END diff --git a/SSHct/sshd_config b/SSHct/sshd_config deleted file mode 100644 index 937ecbd..0000000 --- a/SSHct/sshd_config +++ /dev/null @@ -1,10 +0,0 @@ -Protocol 2 -Port 22 -PubkeyAuthentication yes -PasswordAuthentication no -AllowTcpForwarding yes -X11Forwarding yes -PrintMotd no -IgnoreUserKnownHosts yes -PermitRootLogin no -PermitEmptyPasswords no diff --git a/sshct.yaml b/sshct.yaml index 45b0767..fb9b70f 100644 --- a/sshct.yaml +++ b/sshct.yaml @@ -27,7 +27,7 @@ spec: # type: containers: - name: sshct - image: gorilych/sshct + image: gorilych/sshct:v1.0.1 imagePullPolicy: IfNotPresent env: - name: CTUSERPWD