Updated SSHD to use public key
This commit is contained in:
parent
caf5d8e909
commit
e83c1c3579
|
|
@ -1,50 +1,51 @@
|
||||||
captainVersion: 4
|
captainVersion: 4
|
||||||
services:
|
services:
|
||||||
$$cap_appname:
|
$$cap_appname:
|
||||||
ports:
|
image: lscr.io/linuxserver/openssh-server:version-8.6_p1-r3
|
||||||
- $$cap_sshd_port:22
|
environment:
|
||||||
|
PUID: 1001
|
||||||
|
PGID: 1001
|
||||||
|
TZ: Europe/London
|
||||||
|
PUBLIC_KEY: $$cap_sshd_public_key
|
||||||
|
# USER_PASSWORD: $$cap_sshd_public_key
|
||||||
|
# - PUBLIC_KEY_FILE=/path/to/file #optional
|
||||||
|
# - PUBLIC_KEY_DIR=/path/to/directory/containing/_only_/pubkeys #optional
|
||||||
|
# - PUBLIC_KEY_URL=https://github.com/username.keys #optional
|
||||||
|
# - SUDO_ACCESS=false #optional
|
||||||
|
# - PASSWORD_ACCESS=false #optional
|
||||||
|
# - USER_PASSWORD=password #optional
|
||||||
|
# - USER_PASSWORD_FILE=/path/to/file #optional
|
||||||
|
USER_NAME: $$cap_sshd_username
|
||||||
volumes:
|
volumes:
|
||||||
- $$cap_appname-data:/data
|
- $$cap_appname-config:/config
|
||||||
restart: always
|
ports:
|
||||||
environment: {}
|
- $$cap_sshd_port:2222
|
||||||
caproverExtra:
|
|
||||||
dockerfileLines:
|
|
||||||
- FROM ubuntu:16.04
|
|
||||||
- RUN apt-get update && apt-get install -y openssh-server
|
|
||||||
- RUN mkdir /var/run/sshd
|
|
||||||
- RUN echo 'root:$$cap_sshd_password' | chpasswd
|
|
||||||
- RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
|
||||||
- '# SSH login fix. Otherwise user is kicked off after login'
|
|
||||||
- RUN sed 's@sessions*requireds*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
|
|
||||||
- ENV NOTVISIBLE "in users profile"
|
|
||||||
- RUN echo "export VISIBLE=now" >> /etc/profile
|
|
||||||
- EXPOSE 22
|
|
||||||
- CMD ["/usr/sbin/sshd", "-D"]
|
|
||||||
caproverOneClickApp:
|
caproverOneClickApp:
|
||||||
variables:
|
variables:
|
||||||
- id: $$cap_sshd_password
|
- id: $$cap_sshd_public_key
|
||||||
label: Your SSH root password
|
label: Your SSH public key
|
||||||
description: Enter a secure password
|
description: Enter your public key
|
||||||
defaultValue: pAsSwOrD
|
- id: $$cap_sshd_username
|
||||||
validRegex: /.{8,}/
|
label: Your SSH Username
|
||||||
|
defaultValue: 'caprover'
|
||||||
- id: $$cap_sshd_port
|
- id: $$cap_sshd_port
|
||||||
label: Your SSH exposed port
|
label: Your SSH exposed port (your host mapped port)
|
||||||
description: Enter a port number
|
description: Enter a port number
|
||||||
defaultValue: '4646'
|
defaultValue: '4646'
|
||||||
validRegex: /^\d+$/
|
validRegex: /^\d+$/
|
||||||
instructions:
|
instructions:
|
||||||
start: >-
|
start: >-
|
||||||
The following app sets up an SSHd service in a container that you can use to connect to and inspect other container’s volumes, or to get quick access to a test container.
|
The following app sets up an SSHd service in a container that you can use to connect to and inspect other container's volumes, or to get quick access to a test container.
|
||||||
|
|
||||||
|
|
||||||
IMPORTANT:
|
IMPORTANT:
|
||||||
|
|
||||||
This setup uses password login. You can optionally mount your keys and use public/private key to log in.
|
This setup uses **public key** login.
|
||||||
end: >-
|
end: >-
|
||||||
The container is built and deployed. You can now connect to this container from your local machine by running the following command:
|
The container is built and deployed. You can now connect to this container from your local machine by running the following command:
|
||||||
|
|
||||||
ssh root@IpAddressOfServer -p $$cap_sshd_port
|
ssh -i /path/to/private.key $$cap_sshd_username@$$cap_appname.$$cap_root_domain -p $$cap_sshd_port
|
||||||
displayName: SSH Container
|
displayName: SSH Container
|
||||||
isOfficial: true
|
isOfficial: true
|
||||||
description: Just a simple container that has sshd installed so you can SSH directly into this container.
|
description: Just a simple container that has sshd installed so you can SSH directly into this container.
|
||||||
documentation: 'Taken from https://docs.docker.com/engine/examples/running_ssh_service/#build-an-eg_sshd-image '
|
documentation: 'Taken from https://github.com/linuxserver/docker-openssh-server'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue