32 lines
1.0 KiB
Bash
Executable File
32 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This script runs during container startup
|
|
|
|
echo "=== Configuring osTicket email pipe ===" >> /var/log/mail/user-patches.log
|
|
|
|
# Create log file with proper permissions
|
|
touch /tmp/osticket-pipe.log
|
|
chmod 666 /tmp/osticket-pipe.log
|
|
|
|
# Add pipe service to master.cf (single line format)
|
|
grep -q "osticket-pipe" /etc/postfix/master.cf || \
|
|
echo "osticket-pipe unix - n n - - pipe flags=DRhu user=docker:docker argv=/tmp/docker-mailserver/scripts/pipe-to-osticket.sh" >> /etc/postfix/master.cf
|
|
|
|
# Create transport map
|
|
SUPPORT_EMAIL="${SUPPORT_EMAIL:-support@matthu.net}"
|
|
|
|
# Configure Postfix to use transport map
|
|
postconf -e "transport_maps = hash:/etc/postfix/transport"
|
|
|
|
# Build the transport database
|
|
postmap /etc/postfix/transport
|
|
|
|
# Remove from virtual alias if present
|
|
sed -i '/${SUPPORT_EMAIL}/d' /etc/postfix/virtual 2>/dev/null || true
|
|
postmap /etc/postfix/virtual 2>/dev/null || true
|
|
|
|
# Reload postfix
|
|
postfix reload
|
|
|
|
echo "=== osTicket pipe configuration complete ===" >> /var/log/mail/user-patches.log
|