Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
General Discussion
»
New config.xml via scp gets overwritten by current config
« previous
next »
Print
Pages: [
1
]
Author
Topic: New config.xml via scp gets overwritten by current config (Read 1272 times)
Martienskie
Newbie
Posts: 2
Karma: 0
New config.xml via scp gets overwritten by current config
«
on:
April 06, 2022, 07:16:21 pm »
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?
Logged
zerwes
Full Member
Posts: 125
Karma: 8
Re: New config.xml via scp gets overwritten by current config
«
Reply #1 on:
April 06, 2022, 08:49:57 pm »
I use the same scenario via ansible (
https://github.com/Rosa-Luxemburgstiftung-Berlin/ansible-opnsense
)
After the cfg is changed under the hood (
https://github.com/Rosa-Luxemburgstiftung-Berlin/ansible-opnsense/blob/main/tasks/main.yml#L248:L254
) the playbook calls
configctl filter sync
(and optional
configctl service reload all
+
configctl webgui restart
) (
https://github.com/Rosa-Luxemburgstiftung-Berlin/ansible-opnsense/blob/main/tasks/main.yml#L262:L283
)
Logged
Martienskie
Newbie
Posts: 2
Karma: 0
Re: New config.xml via scp gets overwritten by current config
«
Reply #2 on:
April 07, 2022, 03:32:53 pm »
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.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
General Discussion
»
New config.xml via scp gets overwritten by current config