mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-21 00:25:50 +00:00
Add mail/postsrsd.
PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based lookup tables for Postfix. SRS is needed if your mail server acts as forwarder. WWW: https://github.com/roehling/postsrsd PR: ports/191292 Submitted by: Krzysztof Stryjek <ports@bsdserwis.com>
This commit is contained in:
parent
7728c0f45a
commit
60fe37eec7
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=360856
@ -511,6 +511,7 @@
|
||||
SUBDIR += postfixadmin
|
||||
SUBDIR += postgrey
|
||||
SUBDIR += postpals
|
||||
SUBDIR += postsrsd
|
||||
SUBDIR += prayer
|
||||
SUBDIR += premail
|
||||
SUBDIR += prepflog
|
||||
|
34
mail/postsrsd/Makefile
Normal file
34
mail/postsrsd/Makefile
Normal file
@ -0,0 +1,34 @@
|
||||
# Created by: Krzysztof Stryjek <ports@bsdserwis.com>
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= postsrsd
|
||||
PORTVERSION= 1.1
|
||||
CATEGORIES= mail
|
||||
|
||||
MAINTAINER= ports@bsdserwis.com
|
||||
COMMENT= Postfix Sender Rewriting Scheme daemon
|
||||
|
||||
LICENSE= GPLv2
|
||||
|
||||
BUILD_DEPENDS+= help2man:${PORTSDIR}/misc/help2man \
|
||||
base64:${PORTSDIR}/converters/base64
|
||||
RUN_DEPENDS+= base64:${PORTSDIR}/converters/base64
|
||||
|
||||
USE_GITHUB= yes
|
||||
GH_ACCOUNT= roehling
|
||||
GH_COMMIT= 4a3349d
|
||||
|
||||
USES= cmake pkgconfig
|
||||
CMAKE_ARGS+= --no-warn-unused-cli \
|
||||
-DCMAKE_INCLUDE_PATH="${LOCALBASE}/include" \
|
||||
-DCMAKE_LIBRARY_PATH="${LOCALBASE}/lib"
|
||||
USE_LDCONFIG= ${PREFIX}/lib/${PORTNAME}
|
||||
USE_RC_SUBR= ${PORTNAME}
|
||||
|
||||
PORTDOCS= README.md main.cf.ex
|
||||
|
||||
OPTIONS_DEFINE= DOCS
|
||||
|
||||
DOCS_CMAKE_ON= -DENABLE_DOCS:STRING="ON"
|
||||
|
||||
.include <bsd.port.mk>
|
2
mail/postsrsd/distinfo
Normal file
2
mail/postsrsd/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
SHA256 (postsrsd-1.1.tar.gz) = 5565cf1ee49540686abcc272eef0dbdfbae2e899bd7b8cc49eb0b5dacf802acf
|
||||
SIZE (postsrsd-1.1.tar.gz) = 24219
|
71
mail/postsrsd/files/patch-CMakeLists.txt
Normal file
71
mail/postsrsd/files/patch-CMakeLists.txt
Normal file
@ -0,0 +1,71 @@
|
||||
--- CMakeLists.txt 2014-01-03 01:01:47.000000000 +0100
|
||||
+++ CMakeLists.txt.new 2014-06-18 02:01:27.734952000 +0200
|
||||
@@ -3,45 +3,22 @@
|
||||
|
||||
option(GENERATE_SRS_SECRET "Generate a random SRS secret if none exists during install" ON)
|
||||
option(USE_APPARMOR "Enable AppArmor profile" OFF)
|
||||
+option(MK_CHROOT_DIR "Chroot jail for daemon" OFF)
|
||||
|
||||
+if(MK_CHROOT_DIR)
|
||||
set(CHROOT_DIR "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}" CACHE PATH "Chroot jail for daemon")
|
||||
-set(CONFIG_DIR "/etc/default" CACHE PATH "Location of configuration file")
|
||||
+endif()
|
||||
+set(CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/etc" CACHE PATH "Location of configuration file")
|
||||
|
||||
find_program(HELP2MAN help2man DOC "path to help2man executable")
|
||||
find_program(DD dd DOC "path to dd executable")
|
||||
find_program(BASE64 base64 DOC "path to base64 executable")
|
||||
-find_program(INSSERV insserv DOC "path to insserv executable")
|
||||
-find_program(CHKCONFIG chkconfig DOC "path to chkconfig executable")
|
||||
-
|
||||
-if(NOT DEFINED INIT_FLAVOR)
|
||||
- if(IS_DIRECTORY "/etc/init" AND EXISTS "/lib/init/upstart-job")
|
||||
- message(STATUS "Detected init flavor: upstart")
|
||||
- set(INIT_FLAVOR "upstart" CACHE STRING "Init daemon of this system")
|
||||
- elseif(IS_DIRECTORY "/etc/init.d" AND EXISTS "/lib/lsb/init-functions")
|
||||
- message(STATUS "Detected init flavor: sysv-lsb")
|
||||
- set(INIT_FLAVOR "sysv-lsb" CACHE STRING "Init daemon of this system")
|
||||
- elseif(IS_DIRECTORY "/etc/init.d" AND EXISTS "/etc/init.d/functions")
|
||||
- message(STATUS "Detected init flavor: sysv-redhat")
|
||||
- set(INIT_FLAVOR "sysv-redhat" CACHE STRING "Init daemon of this system")
|
||||
- else()
|
||||
- message(STATUS "Detected init flavor: none")
|
||||
- message(STATUS "System startup files will not be installed")
|
||||
- set(INIT_FLAVOR "" CACHE STRING "Init daemon of this system")
|
||||
- endif()
|
||||
-endif()
|
||||
|
||||
add_executable(${PROJECT_NAME} postsrsd.c sha1.c srs2.c)
|
||||
|
||||
get_target_property(POSTSRSD ${PROJECT_NAME} LOCATION)
|
||||
get_filename_component(POSTSRSD ${POSTSRSD} NAME_WE)
|
||||
-set(APPARMOR_PROFILE "${CMAKE_INSTALL_PREFIX}/sbin/${POSTSRSD}")
|
||||
-string(REGEX REPLACE "^/+" "" APPARMOR_PROFILE "${APPARMOR_PROFILE}")
|
||||
-string(REPLACE "/" "." APPARMOR_PROFILE "${APPARMOR_PROFILE}")
|
||||
-
|
||||
-configure_file(${PROJECT_NAME}.lsb_init.in ${PROJECT_NAME}.lsb_init @ONLY)
|
||||
-configure_file(${PROJECT_NAME}.rh_init.in ${PROJECT_NAME}.rh_init @ONLY)
|
||||
-configure_file(${PROJECT_NAME}.upstart.in ${PROJECT_NAME}.upstart @ONLY)
|
||||
-configure_file(${PROJECT_NAME}.apparmor.in ${PROJECT_NAME}.apparmor @ONLY)
|
||||
+
|
||||
configure_file(postinstall.cmake.in postinstall.cmake @ONLY)
|
||||
|
||||
if(HELP2MAN)
|
||||
@@ -49,7 +26,7 @@
|
||||
COMMAND ${HELP2MAN} ARGS -s8 -o${PROJECT_NAME}.8 -n "Postfix Sender Rewriting Scheme daemon" -N -h-h -v-v ${CMAKE_CURRENT_BINARY_DIR}/${POSTSRSD}
|
||||
VERBATIM
|
||||
)
|
||||
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.8 DESTINATION "share/man/man8")
|
||||
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.8 DESTINATION "man/man8")
|
||||
endif()
|
||||
|
||||
if(USE_APPARMOR)
|
||||
@@ -57,6 +34,8 @@
|
||||
endif()
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION "sbin")
|
||||
+if(ENABLE_DOCS)
|
||||
install(FILES README.md main.cf.ex DESTINATION "share/doc/${PROJECT_NAME}")
|
||||
+endif()
|
||||
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/postinstall.cmake")
|
||||
|
49
mail/postsrsd/files/patch-postinstall.cmake.in
Normal file
49
mail/postsrsd/files/patch-postinstall.cmake.in
Normal file
@ -0,0 +1,49 @@
|
||||
--- postinstall.cmake.in 2014-01-03 01:01:47.000000000 +0100
|
||||
+++ postinstall.cmake.in.new 2014-06-18 01:47:16.240011867 +0200
|
||||
@@ -5,37 +5,13 @@
|
||||
set(SECRET_FILE "@PROJECT_NAME@.secret")
|
||||
set(DD "@DD@")
|
||||
set(BASE64 "@BASE64@")
|
||||
-set(INSSERV "@INSSERV@")
|
||||
-set(CHKCONFIG "@CHKCONFIG@")
|
||||
|
||||
if(CHROOT_DIR AND NOT EXISTS "$ENV{DESTDIR}${CHROOT_DIR}")
|
||||
message(STATUS "Chroot jail: $ENV{DESTDIR}${CHROOT_DIR}")
|
||||
file(MAKE_DIRECTORY "$ENV{DESTDIR}${CHROOT_DIR}")
|
||||
endif()
|
||||
|
||||
-if(INIT_FLAVOR AND NOT EXISTS "$ENV{DESTDIR}${CONFIG_DIR}/@PROJECT_NAME@")
|
||||
- file(INSTALL FILES "@CMAKE_CURRENT_SOURCE_DIR@/@PROJECT_NAME@.default" DESTINATION "${CONFIG_DIR}" RENAME "@PROJECT_NAME@")
|
||||
-endif()
|
||||
-
|
||||
-if(INIT_FLAVOR STREQUAL "sysv-lsb")
|
||||
- file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.lsb_init" TYPE PROGRAM DESTINATION "/etc/init.d" RENAME "@PROJECT_NAME@")
|
||||
- if(INSSERV)
|
||||
- execute_process(
|
||||
- COMMAND ${INSSERV} -p "$ENV{DESTDIR}/etc/init.d" @PROJECT_NAME@
|
||||
- )
|
||||
- endif()
|
||||
-elseif(INIT_FLAVOR STREQUAL "sysv-redhat")
|
||||
- file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.rh_init" TYPE PROGRAM DESTINATION "/etc/init.d" RENAME "@PROJECT_NAME@")
|
||||
- if(CHKCONFIG AND NOT "$ENV{DESTDIR}")
|
||||
- execute_process(
|
||||
- COMMAND ${CHKCONFIG} --add @PROJECT_NAME@
|
||||
- )
|
||||
- endif()
|
||||
-elseif(INIT_FLAVOR STREQUAL "upstart")
|
||||
- file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.upstart" DESTINATION "/etc/init" RENAME "@PROJECT_NAME@.conf")
|
||||
-endif()
|
||||
-
|
||||
-if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom" AND NOT EXISTS "$ENV{DESTDIR}/etc/${SECRET_FILE}")
|
||||
+if(GENERATE_SRS_SECRET AND DD AND BASE64 AND EXISTS "/dev/urandom")
|
||||
message(STATUS "Generating secret key")
|
||||
execute_process(
|
||||
COMMAND ${DD} if=/dev/urandom bs=18 count=1
|
||||
@@ -44,6 +20,6 @@
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
-file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}" DESTINATION "/etc" RENAME "${SECRET_FILE}" FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
|
||||
+file(INSTALL FILES "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}" DESTINATION "${CONFIG_DIR}" RENAME "${SECRET_FILE}" FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
|
||||
file(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/${SECRET_FILE}")
|
||||
endif()
|
20
mail/postsrsd/files/patch-postsrsd.c
Normal file
20
mail/postsrsd/files/patch-postsrsd.c
Normal file
@ -0,0 +1,20 @@
|
||||
--- postsrsd.c 2014-01-03 01:01:47.000000000 +0100
|
||||
+++ postsrsd.c.new 2014-06-18 23:31:33.290651741 +0200
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <pwd.h>
|
||||
#include <string.h>
|
||||
#include <poll.h>
|
||||
-#include <wait.h>
|
||||
+#include <sys/wait.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#ifndef VERSION
|
||||
@@ -47,7 +47,7 @@
|
||||
memset (&hints, 0, sizeof(hints));
|
||||
hints.ai_family = family;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
- hints.ai_flags = AI_ADDRCONFIG | AI_V4MAPPED;
|
||||
+ hints.ai_flags = AI_ADDRCONFIG;
|
||||
err = getaddrinfo(NULL, service, &hints, &addr);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "%s: bind_service(%s): %s\n", self, service, gai_strerror(err));
|
11
mail/postsrsd/files/patch-srs2.c
Normal file
11
mail/postsrsd/files/patch-srs2.c
Normal file
@ -0,0 +1,11 @@
|
||||
--- srs2.c 2014-01-03 01:01:47.000000000 +0100
|
||||
+++ srs2.c.new 2014-06-17 16:13:45.773381667 +0200
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <sys/types.h> /* tyepdefs */
|
||||
#include <sys/time.h> /* timeval / timezone struct */
|
||||
#include <string.h> /* memcpy, strcpy, memset */
|
||||
-#include <alloca.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
#include <openssl/hmac.h>
|
10
mail/postsrsd/files/patch-srs2.h
Normal file
10
mail/postsrsd/files/patch-srs2.h
Normal file
@ -0,0 +1,10 @@
|
||||
--- srs2.h 2014-01-03 01:01:47.000000000 +0100
|
||||
+++ srs2.h.new 2014-06-17 16:16:22.880373371 +0200
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
+#include <time.h>
|
||||
|
||||
#ifndef __BEGIN_DECLS
|
||||
#define __BEGIN_DECLS
|
91
mail/postsrsd/files/postsrsd.in
Normal file
91
mail/postsrsd/files/postsrsd.in
Normal file
@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# PROVIDE: postsrsd
|
||||
# REQUIRE: DAEMON
|
||||
# BEFORE: mail
|
||||
# KEYWORD: shutdown
|
||||
|
||||
# Define these postsrsd_* variables in one of these files:
|
||||
# /etc/rc.conf
|
||||
# /etc/rc.conf.local
|
||||
# /etc/rc.conf.d/postsrsd
|
||||
#
|
||||
# postsrsd_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable dkim-milter
|
||||
# postsrsd_uid (str): Set username to run postsrsd.
|
||||
# postsrsd_secret (str): Secret file file. See postsrsd(8)
|
||||
# postsrsd_domain (str): Local domain name: rewrite to originate from this domain
|
||||
# postsrsd_flags (str): Flags passed to start command.
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="postsrsd"
|
||||
rcvar=postsrsd_enable
|
||||
|
||||
start_precmd="postsrsd_prepcmd"
|
||||
stop_postcmd="postsrsd_postcmd"
|
||||
command="%%PREFIX%%/sbin/postsrsd"
|
||||
_piddir="/var/run/postsrsd"
|
||||
pidfile="${_piddir}/${name}.pid"
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
#
|
||||
# DO NOT CHANGE THESE DEFAULT VALUES HERE
|
||||
#
|
||||
: ${postsrsd_enable="NO"}
|
||||
: ${postsrsd_domain=`/bin/hostname`}
|
||||
: ${postsrsd_uid="mailnull"}
|
||||
: ${postsrsd_secret="%%PREFIX%%/etc/postsrsd.secret"}
|
||||
: ${postsrsd_forward_port="10001"}
|
||||
: ${postsrsd_reverse_port="10002"}
|
||||
: ${postsrsd_idle_timeout="1800"}
|
||||
: ${postsrsd_exclude_domains=""}
|
||||
|
||||
# Options other than above can be set with $postsrsd_flags.
|
||||
# see postsrsd documentation for detail.
|
||||
|
||||
if [ "x${postsrsd_uid}" != "x" ];then
|
||||
_uid_prefix="-u"
|
||||
fi
|
||||
if [ "x${postsrsd_domain}" != "x" ];then
|
||||
postsrsd_domain="-d ${postsrsd_domain}"
|
||||
fi
|
||||
if [ "x${postsrsd_secret}" != "x" ];then
|
||||
postsrsd_secret="-s ${postsrsd_secret}"
|
||||
fi
|
||||
if [ "x${postsrsd_forward_port}" != "x" ];then
|
||||
postsrsd_forward_port="-f ${postsrsd_forward_port}"
|
||||
fi
|
||||
if [ "x${postsrsd_reverse_port}" != "x" ];then
|
||||
postsrsd_reverse_port="-r ${postsrsd_reverse_port}"
|
||||
fi
|
||||
if [ "x${postsrsd_idle_timeout}" != "x" ];then
|
||||
postsrsd_idle_timeout="-t ${postsrsd_idle_timeout}"
|
||||
fi
|
||||
if [ "x${postsrsd_exclude_domains}" != "x" ];then
|
||||
postsrsd_exclude_domains="-X ${postsrsd_exclude_domains}"
|
||||
fi
|
||||
|
||||
command_args=" -D ${_uid_prefix} ${postsrsd_uid} -p ${pidfile} ${postsrsd_domain} ${postsrsd_secret} ${postsrsd_forward_port} ${postsrsd_reverse_port} ${postsrsd_idle_timeout} ${postsrsd_exclude_domains} ${postsrsd_flags}"
|
||||
|
||||
postsrsd_prepcmd ()
|
||||
{
|
||||
if [ ! -d ${_piddir} ] ; then
|
||||
mkdir -p ${_piddir}
|
||||
fi
|
||||
if [ -n "${postsrsd_uid}" ] ; then
|
||||
chown ${postsrsd_uid} ${_piddir}
|
||||
fi
|
||||
}
|
||||
|
||||
postsrsd_postcmd()
|
||||
{
|
||||
# just if the directory is empty
|
||||
rmdir ${_piddir} > /dev/null 2>&1
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
4
mail/postsrsd/pkg-descr
Normal file
4
mail/postsrsd/pkg-descr
Normal file
@ -0,0 +1,4 @@
|
||||
PostSRSd provides the Sender Rewriting Scheme (SRS) via TCP-based lookup
|
||||
tables for Postfix. SRS is needed if your mail server acts as forwarder.
|
||||
|
||||
WWW: https://github.com/roehling/postsrsd
|
3
mail/postsrsd/pkg-plist
Normal file
3
mail/postsrsd/pkg-plist
Normal file
@ -0,0 +1,3 @@
|
||||
sbin/postsrsd
|
||||
man/man8/postsrsd.8.gz
|
||||
etc/postsrsd.secret
|
Loading…
Reference in New Issue
Block a user