OPNsense Forum

English Forums => General Discussion => Topic started by: brbjr1 on January 17, 2019, 01:47:37 am

Title: File to modify to keep custom settings after reboot
Post by: brbjr1 on January 17, 2019, 01:47:37 am
I need to add a few custom settings for postfix to support gmail relay and need them to survive a reboot. Which file do I need to add the settings to?


Thanks.

Bruce
Title: Re: File to modify to keep custom settings after reboot
Post by: franco on January 17, 2019, 06:11:48 pm
Postfix templates are here, but you will lose even the template changes on postfix updates:

https://github.com/opnsense/plugins/tree/master/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix

It's best to make a feature request on GitHub. Everybody could benefit from your use case. Usually it doesn't take long for config options to be added by the maintainer. :)


Cheers,
Franco
Title: Re: File to modify to keep custom settings after reboot
Post by: brbjr1 on January 17, 2019, 07:05:44 pm
Thanks, franco

Maybe I can make changes to the code and submit a pull request.

Where is the code for the ui inputs?

Bruce
Title: Re: File to modify to keep custom settings after reboot
Post by: franco on January 18, 2019, 09:26:55 am
Hi Bruce,

You can find all the source code in https://github.com/opnsense/plugins/tree/master/mail/postfix/

You can install it on your OPNsense and modify it:

# opnsense-code plugins && cd /usr/plugins/mail/postfix

... modify files inside src ... install your modifications:

# make upgrade

... best case add a PR on GitHub then ... :)

Starting doc to explain the MVC framework:

https://docs.opnsense.org/development/examples/helloworld.html


Cheers,
Franco
Title: Re: File to modify to keep custom settings after reboot
Post by: huwylphi on September 01, 2023, 04:08:19 pm
Hi,

this topic is quite old, but since I didn't found any "integrated" solution and got the same issue between gmail and postfix, I decided to share my solution.
My postfix setting I needed to add in its main.cf file is always_add_missing_headers = yes
In order to make that setting persist a reboot I created a new file named 90-postfix in /usr/local/etc/rc.syshook.d/start with the following content:
Code: [Select]
#!/bin/sh

echo -n "Adding postifx custom configuration 'always_add_missing_headers = yes'..."
echo 'always_add_missing_headers = yes' >> /usr/local/etc/postfix/main.cf
echo -n "Postifx custom configuration changed."

Now each time opnsense will reboot, it will add that specific line to the postfix main.cf file.

Hope that solution will help somebody one day.