linux-system-roles / postfix

An ansible role which configures postfix
https://linux-system-roles.github.io/postfix/
GNU General Public License v3.0
13 stars 20 forks source link

Add postfix_reset functionality that resets configuration to Red Hat defaults #40

Closed spetrosi closed 2 years ago

spetrosi commented 2 years ago

The implementation is pretty ugly because postfix default settings in the upstream are different from Red Hat (in Fedora, RHEL and CentOS) default settings. i.e. while upstream default value of inte_interfaces is all:

# postconf -d inet_interfaces
inet_interfaces = all

RHEL default value after the clear provisioning of the machine and dnf install postfix is different:

# postconf inet_interfaces
inet_interfaces = localhost

I guess this happens in the spec file here: https://src.fedoraproject.org/rpms/postfix/blob/rawhide/f/postfix.spec#_359

I have opened a PR about this for postfix: https://bugzilla.redhat.com/show_bug.cgi?id=2055024

For the time being, we must work with it as is. So I've written a bash script that gets the default settings and then substitute values for the settings that are different in Red Hat postfix in this default settings list.

Another way is to remove /etc/postfix/main.cf and do dnf reinstall postfix, not idempotent. My solution is idempotent but dirty.

This PR fixes the following BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2055024

pcahyna commented 2 years ago

because postfix default settings in the upstream are different from Red Hat (in Fedora, RHEL and CentOS) default settings.

Why do you expect them to be the same? Defaults in a program (i.e. settings that apply when they are not specified in a config file) are a different thing from a distribution-provided configuration file and I would not expect them to be the same.

Another way is to remove /etc/postfix/main.cf and do dnf reinstall postfix, not idempotent.

Could you do rpm -V and reinstall the package only when something has changed?

spetrosi commented 2 years ago

To avoid maintaining distribution defaults, I am closing this PR and will open a new one doing rpm -V and reinstalling the RPM.