New config.xml via scp gets overwritten by current config

Started by Martienskie, April 06, 2022, 07:16:21 PM

Previous topic - Next topic
Hello all,

I try to implement some automation to easily change the config of a running opnsense instance (in my case a vm).

Currently, I change the /conf/config.xml by using scp from another device. When I go check in a shell whether the file has changed, it did. But when I exit and get back in the shell or restart, the newly uploaded config is reverted to the previous/current config.

Deleting /conf/config.xml and everything in /conf/backup triggers opnsense to use /usr/local/etc/config.xml but changing that config gives me exceptions or unexpected results.

How can I consistently upload a new config via cli which is used after reboot or a reload? 


Thanks for your reply!

I figured out the problem after a lot of unnecessary troubleshooting. The template I used was putting a newline in the beginning and end of the config. That's why opnsense didn't accept and replaced it each time.

Just uploading the new config to /conf/config.xml and then rebooting did the trick.