Merge pull request #11 from southseact-3d/cto-task-ok-so-for-the-opensmtpd-i-get-this-error-please-fix-and-star-e01

Fix OpenSMTPD binary path detection with fallback to system installation
This commit is contained in:
Liam Hetherington
2026-02-09 13:33:52 +00:00
committed by GitHub
2 changed files with 36 additions and 7 deletions

View File

@@ -171,9 +171,26 @@ log "Setting up OpenSMTPD service..."
# Start OpenSMTPD if configuration exists
OPENSMTPD_CONFIG="/workspace/src/backend/app/opensmtpd/install/etc/smtpd.conf"
OPENSMTPD_PID_FILE="/workspace/src/backend/app/opensmtpd/install/var/run/smtpd.pid"
OPENSMTPD_BINARY="/workspace/src/backend/app/opensmtpd/install/sbin/smtpd"
OPENSMTPD_CUSTOM_BINARY="/workspace/src/backend/app/opensmtpd/install/sbin/smtpd"
OPENSMTPD_SYSTEM_BINARY="/usr/sbin/smtpd"
if [ -f "$OPENSMTPD_CONFIG" ] && [ -x "$OPENSMTPD_BINARY" ]; then
# Determine which binary to use (prefer custom, fallback to system)
OPENSMTPD_BINARY=""
if [ -x "$OPENSMTPD_CUSTOM_BINARY" ]; then
OPENSMTPD_BINARY="$OPENSMTPD_CUSTOM_BINARY"
log "Using custom OpenSMTPD binary: $OPENSMTPD_BINARY"
elif [ -x "$OPENSMTPD_SYSTEM_BINARY" ]; then
OPENSMTPD_BINARY="$OPENSMTPD_SYSTEM_BINARY"
log "Using system OpenSMTPD binary: $OPENSMTPD_BINARY"
else
# Try to find in PATH
if command -v smtpd &>/dev/null; then
OPENSMTPD_BINARY="$(command -v smtpd)"
log "Using OpenSMTPD from PATH: $OPENSMTPD_BINARY"
fi
fi
if [ -n "$OPENSMTPD_BINARY" ] && [ -f "$OPENSMTPD_CONFIG" ]; then
log "OpenSMTPD configuration found at $OPENSMTPD_CONFIG"
# Ensure required directories exist with proper permissions
@@ -204,8 +221,8 @@ else
if [ ! -f "$OPENSMTPD_CONFIG" ]; then
log " Config file missing: $OPENSMTPD_CONFIG"
fi
if [ ! -x "$OPENSMTPD_BINARY" ]; then
log " Binary not executable: $OPENSMTPD_BINARY"
if [ -z "$OPENSMTPD_BINARY" ]; then
log " Binary not found at: $OPENSMTPD_CUSTOM_BINARY or $OPENSMTPD_SYSTEM_BINARY"
fi
fi

View File

@@ -174,8 +174,20 @@ main() {
# Check OpenSMTPD service (ports 25, 587, 465)
health_log "INFO" "=== OpenSMTPD Service ==="
OPENSMTPD_BINARY="/workspace/src/backend/app/opensmtpd/install/sbin/smtpd"
if [ -x "$OPENSMTPD_BINARY" ]; then
OPENSMTPD_CUSTOM_BINARY="/workspace/src/backend/app/opensmtpd/install/sbin/smtpd"
OPENSMTPD_SYSTEM_BINARY="/usr/sbin/smtpd"
# Determine which binary to use (prefer custom, fallback to system)
OPENSMTPD_BINARY=""
if [ -x "$OPENSMTPD_CUSTOM_BINARY" ]; then
OPENSMTPD_BINARY="$OPENSMTPD_CUSTOM_BINARY"
elif [ -x "$OPENSMTPD_SYSTEM_BINARY" ]; then
OPENSMTPD_BINARY="$OPENSMTPD_SYSTEM_BINARY"
elif command -v smtpd &>/dev/null; then
OPENSMTPD_BINARY="$(command -v smtpd)"
fi
if [ -n "$OPENSMTPD_BINARY" ]; then
# Check SMTP port 25
if check_port 25 "SMTP"; then
health_log "INFO" "✓ SMTP port 25 is listening"
@@ -205,7 +217,7 @@ main() {
health_log "WARN" "⚠ OpenSMTPD process not found (may be disabled)"
fi
else
health_log "INFO" "OpenSMTPD not installed at expected location, skipping SMTP checks"
health_log "INFO" "OpenSMTPD not installed (checked: $OPENSMTPD_CUSTOM_BINARY, $OPENSMTPD_SYSTEM_BINARY, PATH), skipping SMTP checks"
fi
# ttyd service has been removed, no longer checking port 4501