-
-
Notifications
You must be signed in to change notification settings - Fork 184
/
readme-vars.yml
139 lines (128 loc) · 8.6 KB
/
readme-vars.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
---
# project information
project_name: openssh-server
project_url: "https://www.openssh.com/"
project_logo: "https://upload.wikimedia.org/wikipedia/en/6/65/OpenSSH_logo.png"
project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is a sandboxed environment that allows ssh access without giving keys to the entire server.\nGiving ssh access via private key often means giving full access to the server. This container creates a limited and sandboxed environment that others can ssh into.\nThe users only have access to the folders mapped and the processes running inside this container."
project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}"
# supported architectures
available_architectures:
- {arch: "{{ arch_x86_64 }}", tag: "amd64-latest"}
- {arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"}
# container parameters
common_param_env_vars_enabled: true
param_container_name: "{{ project_name }}"
param_usage_include_hostname: 'optional' #you can set it to 'optional'
param_hostname: "{{ project_name }}"
param_hostname_desc: "Optionally the hostname can be defined."
param_usage_include_vols: true
param_volumes:
- {vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/config", desc: "Contains all relevant configuration files."}
param_usage_include_ports: true
param_ports:
- {external_port: "2222", internal_port: "2222", port_desc: "ssh port"}
# optional container parameters
opt_param_usage_include_env: true
opt_param_env_vars:
- {env_var: "PUBLIC_KEY", env_value: "yourpublickey", desc: "Optional ssh public key, which will automatically be added to authorized_keys."}
- {env_var: "PUBLIC_KEY_FILE", env_value: "/path/to/file", desc: "Optionally specify a file containing the public key (works with docker secrets)."}
- {env_var: "PUBLIC_KEY_DIR", env_value: "/path/to/directory/containing/_only_/pubkeys", desc: "Optionally specify a directory containing the public keys (works with docker secrets)."}
- {env_var: "PUBLIC_KEY_URL", env_value: "https://github.com/username.keys", desc: "Optionally specify a URL containing the public key."}
- {env_var: "SUDO_ACCESS", env_value: "false", desc: "Set to `true` to allow `linuxserver.io`, the ssh user, sudo access. Without `USER_PASSWORD` set, this will allow passwordless sudo access."}
- {env_var: "PASSWORD_ACCESS", env_value: "false", desc: "Set to `true` to allow user/password ssh access. You will want to set `USER_PASSWORD` or `USER_PASSWORD_FILE` as well."}
- {env_var: "USER_PASSWORD", env_value: "password", desc: "Optionally set a sudo password for `linuxserver.io`, the ssh user. If this or `USER_PASSWORD_FILE` are not set but `SUDO_ACCESS` is set to true, the user will have passwordless sudo access."}
- {env_var: "USER_PASSWORD_FILE", env_value: "/path/to/file", desc: "Optionally specify a file that contains the password. This setting supersedes the `USER_PASSWORD` option (works with docker secrets)."}
- {env_var: "USER_NAME", env_value: "linuxserver.io", desc: "Optionally specify a user name (Default:`linuxserver.io`)"}
- {env_var: "LOG_STDOUT", env_value: "", desc: "Set to `true` to log to stdout instead of file."}
# application setup block
app_setup_block_enabled: true
app_setup_block: |
If `PUBLIC_KEY` or `PUBLIC_KEY_FILE`, or `PUBLIC_KEY_DIR` variables are set, the specified keys will automatically be added to `authorized_keys`. If not, the keys can manually be added to `/config/.ssh/authorized_keys` and the container should be restarted.
Removing `PUBLIC_KEY` or `PUBLIC_KEY_FILE` variables from docker run environment variables will not remove the keys from `authorized_keys`. `PUBLIC_KEY_FILE` and `PUBLIC_KEY_DIR` can be used with docker secrets.
We provide the ability to set and allow password based access via the `PASSWORD_ACCESS` and `USER_PASSWORD` variables, though we as an organization discourage using password auth for public facing ssh endpoints.
Connect to server via `ssh -i /path/to/private/key -p PORT USER_NAME@SERVERIP`
Setting `SUDO_ACCESS` to `true` by itself will allow passwordless sudo. `USER_PASSWORD` and `USER_PASSWORD_FILE` allow setting an optional sudo password.
The users only have access to the folders mapped and the processes running inside this container.
Add any volume mappings you like for the users to have access to.
To install packages or services for users to access, use the LinuxServer container customization methods described [in this blog article](https://blog.linuxserver.io/2019/09/14/customizing-our-containers/).
Sample use case is when a server admin would like to have automated incoming backups from a remote server to the local server, but they might not want all the other admins of the remote server to have full access to the local server.
This container can be set up with a mounted folder for incoming backups, and rsync installed via LinuxServer container customization described above, so that the incoming backups can proceed, but remote server and its admins' access would be limited to the backup folder.
It is also possible to run multiple copies of this container with different ports mapped, different folders mounted and access to different private keys for compartmentalized access.
#### TIPS
You can volume map your own text file to `/etc/motd` to override the message displayed upon connection.
You can optionally set the docker argument `hostname`
## Key Generation
This container has a helper script to generate an ssh private/public key. In order to generate a key please run:
```
docker run --rm -it --entrypoint /keygen.sh linuxserver/openssh-server
```
Then simply follow the prompts.
The keys generated by this script are only displayed on your console output, so make sure to save them somewhere after generation.
# init diagram
init_diagram: |
"openssh-server:latest": {
docker-mods
base {
fix-attr +\nlegacy cont-init
}
docker-mods -> base
legacy-services
custom services
init-services -> legacy-services
init-services -> custom services
custom services -> legacy-services
legacy-services -> ci-service-check
init-migrations -> init-adduser
init-os-end -> init-config
init-config -> init-config-end
init-openssh-server-config -> init-config-end
init-os-end -> init-crontab-config
init-mods-end -> init-custom-files
base -> init-envfile
base -> init-migrations
base -> init-mods
init-config-end -> init-mods
init-mods -> init-mods-end
init-mods-package-install -> init-mods-end
init-mods -> init-mods-package-install
init-config -> init-openssh-server-config
base -> init-os-end
init-adduser -> init-os-end
init-envfile -> init-os-end
init-migrations -> init-os-end
init-custom-files -> init-services
init-mods-end -> init-services
init-openssh-server-config -> log-openssh-server
init-services -> log-openssh-server
init-services -> svc-cron
svc-cron -> legacy-services
init-services -> svc-openssh-server
svc-openssh-server -> legacy-services
}
Base Images: {
"baseimage-alpine:3.20"
}
"openssh-server:latest" <- Base Images
# changelog
changelogs:
- {date: "24.11.24:", desc: "Move sshd_config to /config/sshd/sshd_config."}
- {date: "31.05.24:", desc: "Rebase to Alpine 3.20."}
- {date: "04.05.24:", desc: "Display the SSH host public keys every time the container starts."}
- {date: "09.03.24:", desc: "Rebase to Alpine 3.19."}
- {date: "12.06.23:", desc: "Rebase to Alpine 3.18, deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"}
- {date: "05.03.23:", desc: "Rebase to Alpine 3.17."}
- {date: "18.10.22:", desc: "Fix wrong behavior of password/passwordless sudo"}
- {date: "11.10.22:", desc: "Rebase to Alpine 3.16, migrate to s6v3."}
- {date: "15.09.22:", desc: "add netcat-openbsd with support for proxies."}
- {date: "18.07.22:", desc: "Fix service perms to comply with upgrade to s6 v3."}
- {date: "16.04.22:", desc: "Rebase to alpine 3.15."}
- {date: "16.11.21:", desc: "Add PUBLIC_KEY_URL option"}
- {date: "28.06.21:", desc: "Rebasing to alpine 3.14. Add support for PAM."}
- {date: "10.02.21:", desc: "Rebasing to alpine 3.13. Add openssh-client for scp."}
- {date: "21.10.20:", desc: "Implement s6-log for openssh, which adds local timestamps to logs and can be used with a log parser like fail2ban."}
- {date: "20.10.20:", desc: "Set umask for sftp."}
- {date: "01.06.20:", desc: "Rebasing to alpine 3.12."}
- {date: "18.01.20:", desc: "Add key generation script."}
- {date: "13.01.20:", desc: "Add openssh-sftp-server."}
- {date: "19.12.19:", desc: "Rebasing to alpine 3.11."}
- {date: "17.10.19:", desc: "Initial Release."}