mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
Support to use SSH as webterminal only (#1117)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
- Support to use only web terminal without SSH server
|
||||||
|
|
||||||
## 8.3
|
## 8.3
|
||||||
|
|
||||||
- Update Home Assistant CLI to 4.0.1
|
- Update Home Assistant CLI to 4.0.1
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Home Assistant Add-on: SSH server
|
# Home Assistant Add-on: SSH server
|
||||||
|
|
||||||
Allow logging in remotely to Home Assistant using SSH.
|
Allow logging in remotely to Home Assistant using SSH or just the web terminal with Ingress.
|
||||||
|
|
||||||
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]
|
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ client. It also includes a command-line tool to access the Home Assistant API.
|
|||||||
Try it out using:
|
Try it out using:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
hassio help
|
ha help
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
@@ -25,6 +25,9 @@ Follow these steps to get the add-on installed on your system:
|
|||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
|
You need enable the port for external access. You can just enter 22 as value or any other
|
||||||
|
value like you want. This recommend to add login credentials.
|
||||||
|
|
||||||
To use this add-on, you must have a private/public key to log in.
|
To use this add-on, you must have a private/public key to log in.
|
||||||
To generate them, follow the [instructions for Windows][keygen-windows]
|
To generate them, follow the [instructions for Windows][keygen-windows]
|
||||||
and [these for other platforms][keygen]. It is possible to set a password for
|
and [these for other platforms][keygen]. It is possible to set a password for
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "SSH server",
|
"name": "Terminal & SSH",
|
||||||
"version": "8.3",
|
"version": "8.4",
|
||||||
"slug": "ssh",
|
"slug": "ssh",
|
||||||
"description": "Allow logging in remotely to Home Assistant using SSH",
|
"description": "Allow logging in remotely to Home Assistant using SSH",
|
||||||
"url": "https://github.com/home-assistant/hassio-addons/tree/master/ssh",
|
"url": "https://github.com/home-assistant/hassio-addons/tree/master/ssh",
|
||||||
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
|
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
|
||||||
|
"advanced": true,
|
||||||
"startup": "services",
|
"startup": "services",
|
||||||
"ingress": true,
|
"ingress": true,
|
||||||
"panel_icon": "mdi:console",
|
"panel_icon": "mdi:console",
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
"hassio_role": "manager",
|
"hassio_role": "manager",
|
||||||
"auto_uart": true,
|
"auto_uart": true,
|
||||||
"ports": {
|
"ports": {
|
||||||
"22/tcp": 22
|
"22/tcp": null
|
||||||
},
|
},
|
||||||
"map": ["config:rw", "ssl:rw", "addons:rw", "share:rw", "backup:rw"],
|
"map": ["config:rw", "ssl:rw", "addons:rw", "share:rw", "backup:rw"],
|
||||||
"options": {
|
"options": {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ KEYS_PATH=/data/host_keys
|
|||||||
WAIT_PIDS=()
|
WAIT_PIDS=()
|
||||||
|
|
||||||
bashio::log.info "Initializing add-on for use..."
|
bashio::log.info "Initializing add-on for use..."
|
||||||
|
USE_SSHD=true
|
||||||
if bashio::config.has_value 'authorized_keys'; then
|
if bashio::config.has_value 'authorized_keys'; then
|
||||||
bashio::log.info "Setup authorized_keys"
|
bashio::log.info "Setup authorized_keys"
|
||||||
|
|
||||||
@@ -30,8 +31,11 @@ elif bashio::config.has_value 'password'; then
|
|||||||
|
|
||||||
sed -i s/#PasswordAuthentication.*/PasswordAuthentication\ yes/ /etc/ssh/sshd_config
|
sed -i s/#PasswordAuthentication.*/PasswordAuthentication\ yes/ /etc/ssh/sshd_config
|
||||||
sed -i s/#PermitEmptyPasswords.*/PermitEmptyPasswords\ no/ /etc/ssh/sshd_config
|
sed -i s/#PermitEmptyPasswords.*/PermitEmptyPasswords\ no/ /etc/ssh/sshd_config
|
||||||
else
|
elif bashio::var.has_value "$(bashio::addon.port 22)"; then
|
||||||
bashio::exit.nok "You need to setup a login!"
|
bashio::exit.nok "You need to setup a login!"
|
||||||
|
else
|
||||||
|
USE_SSHD=false
|
||||||
|
bashio::log.info "Disable SSH remote access because of missing login credential!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate host keys
|
# Generate host keys
|
||||||
@@ -93,9 +97,11 @@ function stop_addon() {
|
|||||||
trap "stop_addon" SIGTERM SIGHUP
|
trap "stop_addon" SIGTERM SIGHUP
|
||||||
|
|
||||||
# Start SSH server
|
# Start SSH server
|
||||||
bashio::log.info "Starting SSH daemon..."
|
if bashio::var.true "${USE_SSHD}"; then
|
||||||
/usr/sbin/sshd -D -e < /dev/null &
|
bashio::log.info "Starting SSH daemon..."
|
||||||
WAIT_PIDS+=($!)
|
/usr/sbin/sshd -D -e < /dev/null &
|
||||||
|
WAIT_PIDS+=($!)
|
||||||
|
fi
|
||||||
|
|
||||||
# Start ttyd server
|
# Start ttyd server
|
||||||
bashio::log.info "Starting Web Terminal..."
|
bashio::log.info "Starting Web Terminal..."
|
||||||
|
|||||||
Reference in New Issue
Block a user