mirror of
https://github.com/YunoHost-Apps/homeassistant_ynh.git
synced 2024-09-03 19:26:16 +02:00
Fix
This commit is contained in:
parent
8dfc0aabe1
commit
e0a7f57396
3 changed files with 39 additions and 5 deletions
|
@ -4,9 +4,41 @@ After=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=homeassistant
|
User=__APP__
|
||||||
WorkingDirectory=__PATH__
|
WorkingDirectory=__PATH__
|
||||||
ExecStart=/opt/yunohost/homeassistant/bin/hass --config "__PATH__" --verbose
|
ExecStart=/opt/yunohost/__APP__/bin/hass --config "__PATH__" --verbose
|
||||||
|
StandardOutput=append:/var/log/__APP__.log
|
||||||
|
StandardError=inherit
|
||||||
|
|
||||||
|
# Sandboxing options to harden security
|
||||||
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
# .. but this should be a good baseline
|
||||||
|
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||||
|
NoNewPrivileges=yes
|
||||||
|
PrivateTmp=yes
|
||||||
|
#CANT BE ACTIVATED FOR __APP__ #PrivateDevices=yes
|
||||||
|
#CANT BE ACTIVATED FOR __APP__ #RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
||||||
|
RestrictNamespaces=yes
|
||||||
|
RestrictRealtime=yes
|
||||||
|
DevicePolicy=closed
|
||||||
|
ProtectSystem=full
|
||||||
|
ProtectControlGroups=yes
|
||||||
|
ProtectKernelModules=yes
|
||||||
|
ProtectKernelTunables=yes
|
||||||
|
LockPersonality=yes
|
||||||
|
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
||||||
|
|
||||||
|
# Denying access to capabilities that should not be relevant for webapps
|
||||||
|
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||||
|
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
||||||
|
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
||||||
|
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
||||||
|
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
||||||
|
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
||||||
|
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
||||||
|
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||||
|
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||||
|
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# to test the functionnality :
|
# to test the functionnality :
|
||||||
# yunohost app remove homeassistant
|
# yunohost app remove homeassistant --purge
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -36,7 +36,7 @@ ynh_remove_app_dependencies
|
||||||
ynh_script_progression --message="Removing app main directory..."
|
ynh_script_progression --message="Removing app main directory..."
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
# remove a directory securelyif --purge option is used
|
# remove a directory securely if --purge option is used
|
||||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ] ; then
|
if [ "${YNH_APP_PURGE:-0}" -eq 1 ] ; then
|
||||||
ynh_script_progression --message="Removing app data directory..."
|
ynh_script_progression --message="Removing app data directory..."
|
||||||
ynh_secure_remove --file="$data_path"
|
ynh_secure_remove --file="$data_path"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# to test the functionnality :
|
# to test the functionnality :
|
||||||
# yunohost backup create -n "homeassistant-test" --apps homeassistant
|
# yunohost backup create -n "homeassistant-test" --apps homeassistant
|
||||||
# yunohost app remove homeassistant
|
# yunohost app remove homeassistant --purge
|
||||||
# yunohost backup restore "homeassistant-test"
|
# yunohost backup restore "homeassistant-test"
|
||||||
|
# yunohost backup delete "homeassistant-test"
|
||||||
|
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -69,6 +70,7 @@ ynh_replace_string --match_string=" --verbose" --replace_string="" --target_file
|
||||||
ynh_store_file_checksum --file="/etc/systemd/system/$app@$app.service"
|
ynh_store_file_checksum --file="/etc/systemd/system/$app@$app.service"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
ynh_systemd_action --service_name="$app@$app" --action=restart
|
ynh_systemd_action --service_name="$app@$app" --action=restart
|
||||||
|
sleep 60s
|
||||||
|
|
||||||
# restore logrotate
|
# restore logrotate
|
||||||
ynh_script_progression --message="Restoring logrotate..."
|
ynh_script_progression --message="Restoring logrotate..."
|
||||||
|
|
Loading…
Add table
Reference in a new issue