Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLOYSTER-96] Implement Postfix #26

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

lbgracioso
Copy link
Collaborator

Hey!

This PR finishes the implementation of Postfix with answerfile.

  • 3 new keys added in the answerfile (postfix, postfix.relay, postfix.sasl)
  • Postfix is configured to use TLS
  • Support to SMTP servers with Relay and SASL

@lbgracioso lbgracioso changed the title Implement postfix Implement Postfix Sep 21, 2023
@lbgracioso lbgracioso added the enhancement New feature or request label Feb 22, 2024
Copy link

sonarcloud bot commented Feb 24, 2024

Quality Gate Passed Quality Gate passed

Issues
12 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@arthurmco
Copy link
Collaborator

LGTM

@lbgracioso lbgracioso changed the title Implement Postfix [CLOYSTER-96] Implement Postfix Aug 26, 2024
@lbgracioso lbgracioso self-assigned this Aug 26, 2024
Copy link
Owner

@viniciusferrao viniciusferrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is good, however there's some details that should be addressed. I've made code suggestions where it makes sense.

However there's still open points on the templated use of main.cf and master.cf.

I don't see any tests also. It would be good if we have some. Mailsystem is not easily testable when implemented due to external connections and factors, so if we can do some tests in the code would easy future debugging.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this PR moving.

Regarding the master file. I think it would be better to leave the master file as is. We can disable local delivery with this instead: https://serverfault.com/questions/582988/postfix-disabling-local-delivery-correctly

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an easy list to see what is modified here?

It may be a wiser solution to just use postconf instead.

smtp_tls_security_level = may
# meta_directory = /etc/postfix
# shlib_directory = /usr/lib64/postfix

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think from here we should use addStringToFile instead of templating the file. Why? Because it will avoid mixing changes from the distribution instead when Postfix is installed by dnf.

example.answerfile.ini Outdated Show resolved Hide resolved
example.answerfile.ini Outdated Show resolved Hide resolved
example.answerfile.ini Outdated Show resolved Hide resolved
example.answerfile.ini Outdated Show resolved Hide resolved
example.answerfile.ini Outdated Show resolved Hide resolved
example.answerfile.ini Outdated Show resolved Hide resolved
Comment on lines +141 to +143
ini.setValue("", "relayhost",
fmt::format("{}:{}", m_domain.value(), m_port.value()));
break;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accordingly to Postfix documentation we have:

In the case of SMTP, specify a domain, host, host:port, [host]:port,
[address] or [address]:port; the form [host] turns off MX lookups.

I think is should also use the [] notation.

Suggested change
ini.setValue("", "relayhost",
fmt::format("{}:{}", m_domain.value(), m_port.value()));
break;

Copy link

sonarcloud bot commented Sep 4, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants