Name: postfix-tlspol Version: 1.9.1 Release: 0%{?dist} Summary: A lightweight and highly performant MTA-STS + DANE/TLSA resolver and TLS policy socketmap server for Postfix that complies to the standards and prioritizes DANE where possible. License: MIT and GPLv3+ %global common_description %{expand: Lightweight MTA-STS + DANE/TLSA resolver and TLS policy server for Postfix, prioritizing DANE.} %global debug_package %{nil} %define _unpackaged_files_terminate_build 0 %global goipath github.com/Zuplu/postfix-tlspol %if 0%{?rhel} == 8 %gometa %else %gometa -L -f %endif URL: %{gourl} # Comment to build directly from git source along with lines in %prep section Source0: %{archivename}.tar.gz BuildRequires: git golang go-srpm-macros systemd-rpm-macros glibc-devel %if 0%{?rhel} >= 9 BuildRequires: go-rpm-macros %endif %description %{common_description} %prep # Uncomment the following to build directly from git source #cd %{_builddir} #git clone %{URL} #mv %{_builddir}/postfix-tlspol %{_builddir}/%{archivename} # # Comment out the line below and Source0 above to build directly from git source %setup %build # To include CPU detection and optimization and other features, paste script from the ./scripts/build.sh example here. # Allow golang upgrade to match toolchain version specified in ./go.mod (set GOTOOLCHAIN=local to disable, or auto to enable). export GOTOOLCHAIN=auto ####### As of 1.91. Now must use also gcc libraries instead of pure golang. This fixes problem with package lookups defaulting to MTA-STS export CGO_ENABLED=1 cd %{_builddir}/%{archivename} mkdir -p build ###### As of 1.9.1 removed netgo and static flags to match CGO_ENABLED=1 above if go build -buildmode=exe -trimpath -ldflags="-s -X 'main.Version=%version'" -o build/postfix-tlspol .; then printf "Build succeeded!\n" else printf "Build failed!\n" exit 1 fi %install install -m 0755 -vd %{buildroot}%{_bindir} %__install -Dm 755 "%{_builddir}/%{archivename}/build/postfix-tlspol" "%{buildroot}%{_bindir}/" %__install -Dm 644 "%{_builddir}/%{archivename}/configs/config.default.yaml" "%{buildroot}%{_sysconfdir}/postfix-tlspol/config.yaml" %__install -Dm 644 "%{_builddir}/%{archivename}/README.md" "%{buildroot}%{_pkgdocdir}/README.md" %__install -Dm 644 "%{_builddir}/%{archivename}/SECURITY.md" "%{buildroot}%{_pkgdocdir}/SECURITY.md" %__install -Dm 644 "%{_builddir}/%{archivename}/CHANGELOG.md" "%{buildroot}%{_pkgdocdir}/CHANGELOG.md" %__install -Dm 644 "%{_builddir}/%{archivename}/.github/FUNDING.yaml" "%{buildroot}%{_pkgdocdir}/FUNDING.yaml" %__install -Dm 644 "%{_builddir}/%{archivename}/init/postfix-tlspol.service" "%{buildroot}%{_unitdir}/postfix-tlspol.service" %__install -Dm 644 "%{_builddir}/%{archivename}/LICENSE" "%{buildroot}/usr/share/licenses/postfix-tlspol/LICENSE" ##### As of v1.9.1 optional socket unit file added %__install -Dm 644 "%{_builddir}/%{archivename}/init/postfix-tlspol.socket" "%{buildroot}%{_unitdir}/postfix-tlspol.socket" ##### As of v1.9.1 new OOMPolicy=continue added to service unit file, but it only works for EL >= 9 %if 0%{?rhel} < 9 sed -i '/OOMPolicy=continue/s/^/#/' %{buildroot}%{_unitdir}/postfix-tlspol.service %endif ######################################################################################################################################## # This fixes an error in upstream 1.9.1 source. It is to be reviewed on each subsequent revision and deleted when it is fixed upstream. # ##### As of v1.9.1 "Requires=postfix-tlspol.socket" added upstream to service unit file in error and must not be included sed -i '/Requires=postfix-tlspol.socket/a After=postfix-tlspol.socket' %{buildroot}%{_unitdir}/postfix-tlspol.service sed -i '/Requires=postfix-tlspol.socket/s/^/#/' %{buildroot}%{_unitdir}/postfix-tlspol.service ######################################################################################################################################## ##### As of v1.9.1 new Prometheus metrics & Grafana dashboard example config %__install -Dm 644 "%{_builddir}/%{archivename}/assets/README.md" "%{buildroot}%{_sysconfdir}/postfix-tlspol/metrics/README.md" %__install -Dm 644 "%{_builddir}/%{archivename}/assets/grafana-postfix-tlspol-dashboard.json" "%{buildroot}%{_sysconfdir}/postfix-tlspol/metrics/grafana-postfix-tlspol-dashboard.json" ##### As of v1.9.1 drop "test.sh" since it does not work in an rpm context, comment out below #%__install -Dm 755 "%{_builddir}/%{archivename}/scripts/test.sh" "%{buildroot}/usr/local/bin/postfix-tlspol/test.sh" ##### As of v1.9.1 "query.sh" was removed from the package, now commented out below #%__install -Dm 755 "%{_builddir}/%{archivename}/scripts/query.sh" "%{buildroot}/usr/local/bin/postfix-tlspol/query.sh" ##### As of v1.9.1 no longer change default DNS Server IP Address to 127.0.0.1:53 # sed -i 's/53\:53/1\:53/g' %{buildroot}%{_sysconfdir}/postfix-tlspol/config.yaml ##### ##### As of v1.9.1 optional systemd socket unit file added, so for upgrades. To be enabled manually by user on first update and fresh install, ##### enabled/started automatically only if already enabled/running on subsequent upgrades ##### %post %systemd_post postfix-tlspol.socket postfix-tlspol.service %preun %systemd_preun postfix-tlspol.service postfix-tlspol.socket %postun %systemd_postun_with_restart postfix-tlspol.socket postfix-tlspol.service %posttrans ##### As of v1.9.1 /usr/local/bin/postfix-tlspol can be removed if empty if [ -d /usr/local/bin/postfix-tlspol ]; then rmdir /usr/local/bin/postfix-tlspol 2>/dev/null || : fi %files %{_bindir}/postfix-tlspol %{_defaultlicensedir}/postfix-tlspol/LICENSE %config(noreplace) %{_sysconfdir}/postfix-tlspol/config.yaml %{_pkgdocdir}/* %{_unitdir}/postfix-tlspol.service %{_unitdir}/postfix-tlspol.socket ###### As of v1.9.1 copy Grafana metrics example %{_sysconfdir}/postfix-tlspol/metrics/* ###### As of v1.9.1 deprecated #/usr/local/bin/postfix-tlspol/*.sh %changelog * Sun Apr 26 2026 Michael Webb 1.9.1-0 - Upstream release update. Added optional systemd socket. - Leave upstream DNS server default unchanged - Incorporate new OOMPolicy for EL>8 - Incorporate new Prometheus metrics & Grafana dashboard example configs - Clean up deprecated script files and folders. - Fix error in upstream unit file settings. - Bugfix. Change build parameters to include gcc * Fri Mar 13 2026 Michael Webb 1.8.27-0 - Upstream release update * Mon Aug 25 2025 Michael Webb 1.8.14-1 - Upstream release update * Wed Aug 20 2025 Michael Webb - 1.8.13-1 - Upstream release update * Wed Jul 30 2025 Peter Ajamian - 1.8.12-3 - Remove version from the spec file name. - Force local go toochain. - Don't use the -L or -f flags for EL8 * Tue Jul 29 2025 Michael Webb - 1.8.12-2 - Preference to reuse same source tarball for rebuild consistency instead of git refresh - Preference to match toolchain specified in go.mod * Mon Jul 28 2025 Michael Webb - 1.8.12-1 - Initial build For EL 9