OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • File to modify to keep custom settings after reboot
« previous next »
  • Print
Pages: [1]

Author Topic: File to modify to keep custom settings after reboot  (Read 3244 times)

brbjr1

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
File to modify to keep custom settings after reboot
« 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
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17705
  • Karma: 1618
    • View Profile
Re: File to modify to keep custom settings after reboot
« Reply #1 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
Logged

brbjr1

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: File to modify to keep custom settings after reboot
« Reply #2 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
Logged

franco

  • Administrator
  • Hero Member
  • *****
  • Posts: 17705
  • Karma: 1618
    • View Profile
Re: File to modify to keep custom settings after reboot
« Reply #3 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
Logged

huwylphi

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Re: File to modify to keep custom settings after reboot
« Reply #4 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.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • File to modify to keep custom settings after reboot
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2