File to modify to keep custom settings after reboot

Started by brbjr1, January 17, 2019, 01:47:37 AM

Previous topic - Next topic
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

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

Thanks, franco

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

Where is the code for the ui inputs?

Bruce

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

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:
#!/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.

Quote from: huwylphi on September 01, 2023, 04:08:19 PMNow 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.


Hey! happy to report it sure helped me this morning... thanks mate!!!