#!/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 echo "support@matthu.net osticket-pipe:" > /etc/postfix/transport # 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@matthu.net/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