adridoesthings / Opnsense config backup script

0 Lajky
0 Forky
1 Soubory
Naposledy aktivní 1747499118
An opnsense config backup script which gzip's the config file and encrypts it with gpg. Just change the first variables to your configuration specific. Then you can run this script with cronjob for example.
1 #!/bin/bash
2 set -eeuo pipefail
3
4 # your configuration constants
5 # generate key and secret on /ui/auth/user
6 OPNSENSE_URL="https://opnsense.yournetwork.lan"
7 OPNSENSE_KEY=""
8 OPNSENSE_SECRET=""
9 GPG_RECIPIENT=""
10 BACKUP_DESTINATION="./backups"
Naposledy aktivní 1742733642
Toggle your unifi access point led with homeassistant. Create a homeassistant helper (toggle) named input_boolean.unifi_ap_led for example and create an automation that runs this shell script when the state of the helper toggle changes. Place your id_ed25519 key in config/.ssh/id_ed25519.
1 shell_command:
2 unifi_ap_led_update: ssh -o StrictHostKeyChecking=no USERNAME@UNIFI_AP_IP -i ./.ssh/id_ed25519 "sed -i 's/^mgmt\.led_enabled=.*/mgmt\.led_enabled={% if is_state("input_boolean.unifi_ap_led", "on") %}true{% else %}false{% endif %}/' /var/etc/persistent/cfg/mgmt && echo {% if is_state("input_boolean.unifi_ap_led", "on") %}1{% else %}0{% endif %} > /proc/gpio/led_pattern"
Novější Starší