OPNsense Forum

Archive => 20.7 Legacy Series => Topic started by: qdrop on October 19, 2020, 10:52:07 am

Title: Deprecated Documentation
Post by: qdrop on October 19, 2020, 10:52:07 am
Hi everyone.

I just tried to implement the following: https://docs.opnsense.org/manual/git-backup.html

-> Unfortunately, there is no such plugin.

Further more, the documentation of a linked page is deprecated too: https://docs.opnsense.org/development/backend/autorun.html

-> Unfortunately, there is no folder "config" to embed scripts which are run upon configuration changes.

Maybe it makes sense to update these HowTos or delete them altogether.

Then only one question remains: How can I trigger a script upon configuration changes? Any help is appreciated.
Title: Re: Deprecated Documentation
Post by: Gauss23 on October 19, 2020, 10:58:51 am
Interesting note.

Thanks for bringing it up.

I found this:
https://github.com/opnsense/plugins/tree/master/sysutils/git-backup

So it seems that this is a plugin where currently work is going on. My hope is, that it will return soon.

Maybe some dev has something to say about an ETA.
Title: Re: Deprecated Documentation
Post by: mimugmail on October 19, 2020, 01:27:51 pm
It's not released to stable .. found it's way some weeks ago, but it's working pretty cool.
https://github.com/opnsense/plugins/issues/2049
Title: Re: Deprecated Documentation
Post by: mimugmail on October 19, 2020, 01:28:23 pm
That means documentation is more bleeding edge instead of deprecated :P
Title: Re: Deprecated Documentation
Post by: qdrop on October 19, 2020, 03:34:53 pm
haha, yeah we just invested about 2 hours together to reverse-engineer this syshook mechanic. We failed.

First, we did the following: https://github.com/opnsense/plugins/issues/2049#issuecomment-705397846

Secondly, we tried to simply put a bash script inside /usr/local/etc/rc.syshook.d/config:

/usr/local/etc/rc.syshook.d/config/10-bash-git-backup

Code: [Select]
#!/usr/local/bin/bash
set -ux
git clone git@ssh.dev.com/v3/opnsense-config /conf/backup/git
cd /conf/backup/git/
mkdir -p $HOST
cp  $1 $HOST/config.xml
git add $HOST/config.xml
git commit -m "Config-Change of $HOST"
git push
cd .. && rm -rf /conf/backup/git

Third, we triggered rc.syshook manually and supplied two variables: config /conf/backup/file.xml

This triggered the script - but we never managed to trigger it from the actual event.

Basically: What is necessary so this syshook triggers properly? https://docs.opnsense.org/development/backend/autorun.html

Best