feature: Easy SSH
This commit is contained in:
parent
6622a6ded4
commit
c18b91f684
|
|
@ -98,6 +98,7 @@ dockers:
|
|||
- webui
|
||||
- var/entities/
|
||||
- config.yaml
|
||||
- var/helper-actions/olivetin-setup-easy-ssh
|
||||
|
||||
- image_templates:
|
||||
- "docker.io/jamesread/olivetin:{{ .Tag }}-arm64"
|
||||
|
|
@ -114,6 +115,7 @@ dockers:
|
|||
- webui
|
||||
- var/entities/
|
||||
- config.yaml
|
||||
- var/helper-actions/olivetin-setup-easy-ssh
|
||||
|
||||
docker_manifests:
|
||||
- name_template: docker.io/jamesread/olivetin:{{ .Version }}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ VOLUME /config
|
|||
|
||||
COPY OliveTin /usr/bin/OliveTin
|
||||
COPY webui /var/www/olivetin/
|
||||
COPY var/helper-actions/olivetin-setup-easy-ssh /usr/bin/olivetin-setup-easy-ssh
|
||||
|
||||
USER olivetin
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ VOLUME /config
|
|||
|
||||
COPY OliveTin /usr/bin/OliveTin
|
||||
COPY webui /var/www/olivetin/
|
||||
COPY var/helper-actions/olivetin-setup-easy-ssh /usr/bin/olivetin-setup-easy-ssh
|
||||
|
||||
USER olivetin
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ VOLUME /config
|
|||
|
||||
COPY OliveTin /usr/bin/OliveTin
|
||||
COPY webui /var/www/olivetin/
|
||||
COPY var/helper-actions/olivetin-setup-easy-ssh /usr/bin/olivetin-setup-easy-ssh
|
||||
|
||||
USER olivetin
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,27 @@ var Runtime = &runtimeInfo{
|
|||
SshFoundConfig: searchForSshConfig(),
|
||||
}
|
||||
|
||||
func fileExists(path string) bool {
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func searchForSshKey() string {
|
||||
if fileExists("/config/ssh/id_rsa") {
|
||||
return "/config/ssh/id_rsa"
|
||||
}
|
||||
|
||||
return searchForHomeFile(".ssh/id_rsa")
|
||||
}
|
||||
|
||||
func searchForSshConfig() string {
|
||||
if fileExists("/config/ssh/config") {
|
||||
return "/config/ssh/config"
|
||||
}
|
||||
|
||||
return searchForHomeFile(".ssh/config")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p /config/ssh/
|
||||
|
||||
SSH_KEY=/config/ssh/id_rsa
|
||||
|
||||
echo "Documentation for this script: https://docs.olivetin.app/setup-ssh"
|
||||
echo ""
|
||||
|
||||
if test -f "$SSH_KEY"; then
|
||||
echo "Using existing SSH key at $SSH_KEY, not generating a new one"
|
||||
else
|
||||
ssh-keygen -f $SSH_KEY -N ''
|
||||
echo "Your new SSH key has been generated and saved to $SSH_KEY"
|
||||
fi
|
||||
|
||||
echo "To use this SSH key with OliveTin, format your action line like this:"
|
||||
echo ""
|
||||
echo "actions:"
|
||||
echo " - name: My SSH Action"
|
||||
echo " shell: ssh -F /config/ssh/config user@host \"echo 'Hello, world!'\""
|
||||
echo ""
|
||||
echo "Note: This config has ssh key checking turned off for convenience."
|
||||
echo "If validating SSH keys is important to you, you should not use this config."
|
||||
echo ""
|
||||
|
||||
cat <<EOF > /config/ssh/config
|
||||
Host *
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
IdentityFile /config/ssh/id_rsa
|
||||
EOF
|
||||
|
||||
echo "Copy this line into your ~/.ssh/authorized_keys file to allow OliveTin to connect to your server:"
|
||||
cat /config/ssh/id_rsa.pub
|
||||
Loading…
Reference in New Issue