Skip to content

Commit

Permalink
vpopmail, haraka, & elastic updates (#605)
Browse files Browse the repository at this point in the history
- vpopmail: update SQL in vmysql.h to be more consistent with source build
- elastic: build config fixes
- haraka: config updates
  • Loading branch information
msimerson authored Dec 10, 2024
1 parent 5c0e526 commit 6f37f51
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 38 deletions.
25 changes: 24 additions & 1 deletion include/vpopmail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ install_vpopmail_source()
stage_exec sh -c 'cd /data/src/vpopmail; make install' || exit 1
}

vpopmail_port_fixups() {
sed -i '' \
-e '/pw_name char(32)/ s/char(32)/VARCHAR (64)/' \
-e '/pw_domain char(96)/ s/char(96)/VARCHAR (96)/' \
-e '/user char(32)/ s/char(32)/VARCHAR (64)/' \
-e '/remote_ip char(18)/ s/char(18)/VARCHAR (39)/' \
-e '/pw_passwd char(40)/ s/char(40)/VARCHAR (128)/' \
-e '/pw_clear_passwd char(16)/ s/char(16)/VARCHAR (128)/' \
-e '/pw_gecos char(48)/ s/char(48)/VARCHAR (64)/' \
-e '/pw_dir char(160)/ s/char(160)/VARCHAR (160)/' \
-e '/pw_shell char(20)/ s/char(20)/VARCHAR (20)/' \
-e '/domain CHAR(96)/ s/CHAR(96)/VARCHAR (96)/' \
-e '/ip_addr char(18)/ s/char(18)/VARCHAR (39)/' \
$STAGE_MNT/tmp/portbuild/usr/ports/mail/vpopmail/work/vpopmail-5.4.33/vmysql.h
}

install_vpopmail_port()
{
install_vpopmail_deps
Expand Down Expand Up @@ -91,7 +107,14 @@ mail_vpopmail_UNSET=$VPOPMAIL_OPTIONS_UNSET
fi

tell_status "installing vpopmail port with custom options"
stage_port_install mail/vpopmail

stage_pkg_install pkgconf portconfig

stage_exec make -C "/usr/ports/mail/vpopmail" extract
vpopmail_port_fixups
stage_exec make -C "/usr/ports/mail/vpopmail" build deinstall install clean || return 1

tell_status "port mail/vpopmail installed"
}

install_qmail()
Expand Down
6 changes: 2 additions & 4 deletions mail-toaster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -888,11 +888,9 @@ stage_port_install()
{
# $1 is the port directory (eg: mail/dovecot)

jexec "$SAFE_NAME" pkg install -y pkgconf portconfig
# portconfig replaces dialog4ports (as of Oct 2023)
stage_pkg_install pkgconf portconfig

echo "jexec $SAFE_NAME make -C /usr/ports/$1 build deinstall install clean"
jexec "$SAFE_NAME" make -C "/usr/ports/$1" build deinstall install clean || return 1
stage_exec make -C "/usr/ports/$1" build deinstall install clean || return 1

tell_status "port $1 installed"
}
Expand Down
6 changes: 3 additions & 3 deletions provision/elasticsearch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ configure_elasticsearch()
chown 965 "$_data_conf"

sed -i.bak \
-e "/^#network.host:/ s/#//; s/192.168.0.1/$(get_jail_ip elasticsearch)/" \
-e "/^network.host:/ s/$(get_jail_ip stage)/$(get_jail_ip elasticsearch)/" \
-e '/^path.data: / s/var/data/' \
-e '/^path.logs: / s/var/data/' \
-e '/^path\./ s/\/elasticsearch//' \
-e '/^#cluster_name/ s/^#//; s/my-application/mail-toaster/' \
-e '/^#node.name/ s/^#//; s/node-1/mt1/' \
-e '/^#cluster.initial/ s/^#//; s/node-1/mt1/; s/, "node-2"//' \
-e '/^node.name/ s/stage/mt1/' \
-e '/^cluster.initial/ s/stage/mt1/' \
"$_data_conf"

if ! grep -qs xpack.security.enabled "$_data_conf"; then
Expand Down
47 changes: 21 additions & 26 deletions provision/haraka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ configure_haraka_vpopmail()

# shellcheck disable=1004
sed -i.bak \
-e '/^# auth\/auth_ldap$/a\
-e '/^# auth\/auth_proxy$/a\
auth\/auth_vpopmaild
' "$HARAKA_CONF/plugins"
fi
Expand All @@ -180,7 +180,7 @@ queue=smtp_forward" | \
if ! grep -qs ^qmail-deliverable "$HARAKA_CONF/plugins"; then
tell_status "enabling qmail-deliverable plugin"
sed -i.bak \
-e '/^#qmail-deliverable/ s/#//' \
-e '/^# qmail-deliverable/ s/# //' \
-e '/^#rcpt_to.qmail_deliverable/ s/#.*/qmail-deliverable/' \
-e 's/^rcpt_to.in_host_list/# rcpt_to.in_host_list/' \
"$HARAKA_CONF/plugins"
Expand Down Expand Up @@ -215,7 +215,7 @@ configure_haraka_spamassassin()

if ! grep -qs ^spamassasssin "$HARAKA_CONF/plugins"; then
tell_status "enabling Haraka spamassassin plugin"
sed -i '' -e '/^#spamassassin/ s/#//' "$HARAKA_CONF/plugins"
sed -i '' -e '/^# spamassassin/ s/# //' "$HARAKA_CONF/plugins"
fi

if [ ! -f "$HARAKA_CONF/spamassassin.ini" ]; then
Expand Down Expand Up @@ -279,7 +279,7 @@ configure_haraka_clamav()

if ! grep -qs ^clamd "$HARAKA_CONF/plugins"; then
tell_status "enabling Haraka clamav plugin"
sed -i '' -e '/^#clamd/ s/#//' "$HARAKA_CONF/plugins"
sed -i '' -e '/^# clamd/ s/# //' "$HARAKA_CONF/plugins"
fi

if ! grep -qs ^clamd_socket "$HARAKA_CONF/clamd.ini"; then
Expand Down Expand Up @@ -362,18 +362,15 @@ add_headers = always

if ! grep -qs ^rspamd "$HARAKA_CONF/plugins"; then
tell_status "enabling rspamd plugin"
# shellcheck disable=1004
sed -i '' -e '/spamassassin$/a\
rspamd
' "$HARAKA_CONF/plugins"
sed -i '' -e '/^# rspamd/ s/# //' "$HARAKA_CONF/plugins"
fi
}

configure_haraka_watch()
{
if ! grep -qs ^watch "$HARAKA_CONF/plugins"; then
tell_status "enabling watch plugin"
echo 'watch' >> "$HARAKA_CONF/plugins"
sed -i '' -e '/^# watch/ s/# //' "$HARAKA_CONF/plugins"
fi

if [ ! -f "$HARAKA_CONF/watch.ini" ]; then
Expand Down Expand Up @@ -420,15 +417,14 @@ configure_haraka_plugins()

# enable a bunch of plugins
sed -i.bak \
-e '/^#process_title/ s/#//' \
-e '/^#spf$/ s/#//' \
-e '/^#bounce/ s/#//' \
-e '/^#data.uribl/ s/#data\.//' \
-e '/^#uribl/ s/#//' \
-e '/^#attachment/ s/#//' \
-e '/^#dkim_sign/ s/#//' \
-e '/^#karma$/ s/#//' \
-e '/^# fcrdns/ s/# //' \
-e '/^# process_title/ s/# //' \
-e '/^# spf$/ s/# //' \
-e '/^# bounce/ s/# //' \
-e '/^# uribl/ s/# //' \
-e '/^# attachment/ s/# //' \
-e '/^# dkim/ s/# //' \
-e '/^# karma/ s/# //' \
-e '/^# fcrdns/ s/# //' \
"$HARAKA_CONF/plugins"
}

Expand Down Expand Up @@ -457,7 +453,7 @@ configure_haraka_limit()
{
if ! grep -qs ^limit "$HARAKA_CONF/plugins"; then
tell_status "adding limit plugin"
echo 'limit' | tee -a "$HARAKA_CONF/plugins"
sed -i '' -e '/^# limit/ s/# //' "$HARAKA_CONF/plugins"
fi

if [ ! -f "$HARAKA_CONF/limit.ini" ]; then
Expand Down Expand Up @@ -510,7 +506,7 @@ dbid=1
server_ip=$(get_jail_ip redis)
[deny_excludes]
plugins=send_email, access, helo.checks, data.headers, mail_from.is_resolvable, avg, limit, attachment, tls
plugins=send_email, access, helo.checks, headers, mail_from.is_resolvable, avg, limit, attachment, tls
" | tee -a "$HARAKA_CONF/karma.ini"

}
Expand Down Expand Up @@ -587,15 +583,18 @@ configure_haraka_results()
[fcrdns]
hide=ptr_names,ptr_name_to_ip,ptr_name_has_ips,ptr_multidomain,has_rdns
[data.headers]
[headers]
order=fail,pass,msg
[data.uribl]
[uribl]
hide=skip
[dnsbl]
hide=pass
[dns-list]
hide=pass
[qmail-deliverable]
order=fail,pass,msg
Expand Down Expand Up @@ -708,10 +707,6 @@ configure_haraka()
configure_haraka_qmail_deliverable
configure_haraka_dnsbl

if [ ! -f "$HARAKA_CONF/data.headers.ini" ]; then
echo "reject=no" | tee -a "$HARAKA_CONF/data.headers.ini"
fi

configure_haraka_http
configure_haraka_tls
configure_haraka_dkim
Expand Down
10 changes: 6 additions & 4 deletions provision/vpopmail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ install_vpopmail()
tell_status "installing vpopmail package"
stage_pkg_install vpopmail gmake autoconf
#stage_port_install devel/gmake
install_vpopmail_port
Expand All @@ -279,7 +278,6 @@ install_vpopmail()
if [ "$TOASTER_MYSQL" = "1" ]; then
install_vpopmail_mysql_grants
install_vpopmail_mysql_aliastable
alter_vpopmail_tables
fi
install_qmailadmin
Expand Down Expand Up @@ -309,6 +307,10 @@ configure_vpopmail()
tell_status "ATTN: Your postmaster password is: $_ppass"
stage_exec /usr/local/vpopmail/bin/vadddomain "$TOASTER_MAIL_DOMAIN" "$_ppass"
fi
if [ "$TOASTER_MYSQL" = "1" ]; then
alter_vpopmail_tables
fi
}
start_vpopmail()
Expand Down Expand Up @@ -364,15 +366,15 @@ migrate_vpopmail_home()
+ mount += "/data/vpopmail $path/data nullfs rw 0 0";
+ mount += "/data/vpopmail/home $path/usr/local/vpopmail nullfs rw 0 0";
}
dovecot {
ip4.addr = 172.16.15.15;
ip6.addr = lo1|fd7a:e5cd:1fc1:bc2c:dead:beef:cafe:000f;
mount += "/data/dovecot $path/data nullfs rw 0 0";
- mount += "/data/vpopmail $path/usr/local/vpopmail nullfs rw 0 0";
+ mount += "/data/vpopmail/home $path/usr/local/vpopmail nullfs rw 0 0";
}
4. start the dovecot and vpopmail jails
service jail start vpopmail dovecot
Expand Down

0 comments on commit 6f37f51

Please sign in to comment.