Remove all emojis from email diagnostics for professional appearance

This commit is contained in:
cschantz
2025-12-31 19:04:44 -05:00
parent c780c8ab2e
commit 1127888a66
+57 -57
View File
@@ -102,7 +102,7 @@ grep -v "imap-login\|pop3-login\|dovecot.*Login\|Logged in\|Disconnected" "$TEMP
mv "$TEMP_MATCHES.delivery" "$TEMP_MATCHES" mv "$TEMP_MATCHES.delivery" "$TEMP_MATCHES"
if [ ! -s "$TEMP_MATCHES" ]; then if [ ! -s "$TEMP_MATCHES" ]; then
print_error "NO EMAIL ACTIVITY FOUND for $check_label" print_error "NO EMAIL ACTIVITY FOUND for $check_label"
echo "" echo ""
echo "This means:" echo "This means:"
echo " • No emails sent TO this $check_label" echo " • No emails sent TO this $check_label"
@@ -118,9 +118,9 @@ if [ ! -s "$TEMP_MATCHES" ]; then
# Check if domain exists # Check if domain exists
if [ "$check_type" = "2" ]; then if [ "$check_type" = "2" ]; then
if grep -q "$target" /etc/localdomains 2>/dev/null || grep -q "$target" /etc/userdomains 2>/dev/null; then if grep -q "$target" /etc/localdomains 2>/dev/null || grep -q "$target" /etc/userdomains 2>/dev/null; then
print_info "Domain $target IS configured on this server" print_info "Domain $target IS configured on this server"
else else
print_warning "Domain $target NOT found in local domains" print_warning "Domain $target NOT found in local domains"
fi fi
fi fi
@@ -129,7 +129,7 @@ if [ ! -s "$TEMP_MATCHES" ]; then
fi fi
total_lines=$(wc -l < "$TEMP_MATCHES") total_lines=$(wc -l < "$TEMP_MATCHES")
print_success "Found $total_lines log entries for $check_label" print_success "Found $total_lines log entries for $check_label"
echo "" echo ""
################################################################################ ################################################################################
@@ -168,7 +168,7 @@ auth_success=$(echo "$auth_success" | head -1 | tr -d '\n\r')
# Quick Summary # Quick Summary
################################################################################ ################################################################################
print_header "⚡ Quick Summary" print_header "QUICK SUMMARY"
echo "" echo ""
# Determine quick status # Determine quick status
@@ -176,17 +176,17 @@ total_problems=$((bounced + rejected + spam_rejected))
total_email_activity=$((sent + received + delivered)) total_email_activity=$((sent + received + delivered))
if [ "$total_email_activity" -gt 0 ] && [ "$total_problems" -eq 0 ]; then if [ "$total_email_activity" -gt 0 ] && [ "$total_problems" -eq 0 ]; then
print_success "Email appears to be working (${total_email_activity} email events, no problems)" print_success "Email appears to be working (${total_email_activity} email events, no problems)"
elif [ "$total_email_activity" -gt 0 ] && [ "$total_problems" -gt 0 ]; then elif [ "$total_email_activity" -gt 0 ] && [ "$total_problems" -gt 0 ]; then
print_warning "⚠️ Partial email issues (${total_email_activity} delivered, ${total_problems} failed)" print_warning "Partial email issues (${total_email_activity} delivered, ${total_problems} failed)"
elif [ "$total_problems" -gt 0 ]; then elif [ "$total_problems" -gt 0 ]; then
print_error "Email delivery problems detected (${total_problems} failures)" print_error "Email delivery problems detected (${total_problems} failures)"
elif [ "$auth_success" -gt 0 ] && [ "$total_email_activity" -eq 0 ]; then elif [ "$auth_success" -gt 0 ] && [ "$total_email_activity" -eq 0 ]; then
print_info "📱 Account active (${auth_success} logins) but no email traffic in last ${hours}h" print_info "Account active (${auth_success} logins) but no email traffic in last ${hours}h"
elif [ "$auth_failed" -gt 0 ]; then elif [ "$auth_failed" -gt 0 ]; then
print_warning "⚠️ Failed login attempts detected (${auth_failed} attempts) - possible attack" print_warning "Failed login attempts detected (${auth_failed} attempts) - possible attack"
else else
print_info "No activity detected in last ${hours} hours" print_info "No activity detected in last ${hours} hours"
fi fi
echo "" echo ""
@@ -195,26 +195,26 @@ echo ""
# Detailed Activity Breakdown # Detailed Activity Breakdown
################################################################################ ################################################################################
print_header "📊 Email Delivery Activity (last $hours hours)" print_header "EMAIL DELIVERY ACTIVITY (last $hours hours)"
echo "" echo ""
# Always show main metrics for clarity # Always show main metrics for clarity
if [ "$received" -gt 0 ]; then if [ "$received" -gt 0 ]; then
print_success "📥 Received: $received emails (incoming TO this $check_label)" print_success "Received: $received emails (incoming TO this $check_label)"
else else
echo "📥 Received: 0 emails (no incoming mail)" echo "Received: 0 emails (no incoming mail)"
fi fi
if [ "$sent" -gt 0 ]; then if [ "$sent" -gt 0 ]; then
print_success "📤 Sent: $sent emails (outgoing FROM this $check_label)" print_success "Sent: $sent emails (outgoing FROM this $check_label)"
else else
echo "📤 Sent: 0 emails (no outgoing mail)" echo "Sent: 0 emails (no outgoing mail)"
fi fi
if [ "$delivered" -gt 0 ]; then if [ "$delivered" -gt 0 ]; then
print_success "Delivered: $delivered successful deliveries" print_success "Delivered: $delivered successful deliveries"
else else
echo "Delivered: 0 (no completed deliveries logged)" echo "Delivered: 0 (no completed deliveries logged)"
fi fi
echo "" echo ""
@@ -223,47 +223,47 @@ echo ""
has_problems=0 has_problems=0
if [ "$bounced" -gt 0 ]; then if [ "$bounced" -gt 0 ]; then
print_error "Bounced: $bounced emails bounced/failed" print_error "Bounced: $bounced emails bounced/failed"
has_problems=1 has_problems=1
fi fi
if [ "$deferred" -gt 0 ]; then if [ "$deferred" -gt 0 ]; then
print_warning "Deferred: $deferred emails temporarily delayed" print_warning "Deferred: $deferred emails temporarily delayed"
has_problems=1 has_problems=1
fi fi
if [ "$rejected" -gt 0 ]; then if [ "$rejected" -gt 0 ]; then
print_error "🚫 Rejected: $rejected emails blocked/rejected" print_error "Rejected: $rejected emails blocked/rejected"
has_problems=1 has_problems=1
fi fi
if [ "$spam_rejected" -gt 0 ]; then if [ "$spam_rejected" -gt 0 ]; then
print_error "🚫 Spam Rejected: $spam_rejected emails marked as spam" print_error "Spam Rejected: $spam_rejected emails marked as spam"
has_problems=1 has_problems=1
fi fi
if [ "$spf_fail" -gt 0 ]; then if [ "$spf_fail" -gt 0 ]; then
print_warning "SPF Failures: $spf_fail authentication failures" print_warning "SPF Failures: $spf_fail authentication failures"
has_problems=1 has_problems=1
fi fi
if [ "$dkim_fail" -gt 0 ]; then if [ "$dkim_fail" -gt 0 ]; then
print_warning "DKIM Failures: $dkim_fail signature failures" print_warning "DKIM Failures: $dkim_fail signature failures"
has_problems=1 has_problems=1
fi fi
if [ "$greylist" -gt 0 ]; then if [ "$greylist" -gt 0 ]; then
print_info "Greylisted: $greylist emails temporarily delayed (normal anti-spam)" print_info "Greylisted: $greylist emails temporarily delayed (normal anti-spam)"
fi fi
if [ $has_problems -eq 0 ]; then if [ $has_problems -eq 0 ]; then
print_success "No delivery problems detected" print_success "No delivery problems detected"
fi fi
# Show email traffic patterns # Show email traffic patterns
if [ "$sent" -gt 0 ] || [ "$received" -gt 0 ]; then if [ "$sent" -gt 0 ] || [ "$received" -gt 0 ]; then
echo "" echo ""
print_header "📊 Email Traffic Patterns" print_header "EMAIL TRAFFIC PATTERNS"
echo "" echo ""
# Top recipients (who this email is sending to) # Top recipients (who this email is sending to)
@@ -288,17 +288,17 @@ fi
# Show authentication summary # Show authentication summary
if [ -s "$TEMP_AUTH" ]; then if [ -s "$TEMP_AUTH" ]; then
echo "" echo ""
print_header "🔐 Mailbox Access Activity (IMAP/POP3 Logins)" print_header "MAILBOX ACCESS ACTIVITY (IMAP/POP3 Logins)"
echo "" echo ""
print_info "This shows if customer can access their mailbox (not email delivery)" print_info "This shows if customer can access their mailbox (not email delivery)"
echo "" echo ""
if [ "$auth_success" -gt 0 ]; then if [ "$auth_success" -gt 0 ]; then
print_success "Successful Logins: $auth_success (password is correct, mailbox accessible)" print_success "Successful Logins: $auth_success (password is correct, mailbox accessible)"
fi fi
if [ "$auth_failed" -gt 0 ]; then if [ "$auth_failed" -gt 0 ]; then
print_error "Failed Logins: $auth_failed (WRONG PASSWORD or brute-force attack)" print_error "Failed Logins: $auth_failed (WRONG PASSWORD or brute-force attack)"
# Extract IPs attempting failed logins # Extract IPs attempting failed logins
failed_ips=$(grep -i "auth failed\|Login aborted" "$TEMP_AUTH" | grep -oE "rip=[0-9.]+|from [0-9.]+" | sed 's/rip=//; s/from //' | sort | uniq -c | sort -rn) failed_ips=$(grep -i "auth failed\|Login aborted" "$TEMP_AUTH" | grep -oE "rip=[0-9.]+|from [0-9.]+" | sed 's/rip=//; s/from //' | sort | uniq -c | sort -rn)
@@ -319,7 +319,7 @@ echo ""
################################################################################ ################################################################################
if [ "$check_type" != "2" ]; then if [ "$check_type" != "2" ]; then
print_header "📧 Email Account Status" print_header "EMAIL ACCOUNT STATUS"
echo "" echo ""
# Extract username and domain from email # Extract username and domain from email
@@ -353,33 +353,33 @@ if [ "$check_type" != "2" ]; then
# If successful logins exist, account must exist (even if we can't find the directory) # If successful logins exist, account must exist (even if we can't find the directory)
if [ $account_found -eq 0 ] && [ "$auth_success" -gt 0 ]; then if [ $account_found -eq 0 ] && [ "$auth_success" -gt 0 ]; then
account_found=1 account_found=1
print_success "Email account EXISTS (confirmed by successful logins)" print_success "Email account EXISTS (confirmed by successful logins)"
print_warning " Note: Mailbox directory not found in standard locations" print_warning "Note: Mailbox directory not found in standard locations"
elif [ $account_found -eq 1 ]; then elif [ $account_found -eq 1 ]; then
print_success "Email account EXISTS on this server" print_success "Email account EXISTS on this server"
# Show mailbox details if we found the directory # Show mailbox details if we found the directory
if [ -n "$maildir" ] && [ -d "$maildir" ]; then if [ -n "$maildir" ] && [ -d "$maildir" ]; then
disk_usage=$(du -sh "$maildir" 2>/dev/null | awk '{print $1}') disk_usage=$(du -sh "$maildir" 2>/dev/null | awk '{print $1}')
if [ -n "$disk_usage" ]; then if [ -n "$disk_usage" ]; then
print_info "📊 Mailbox size: $disk_usage" print_info "Mailbox size: $disk_usage"
fi fi
# Count messages # Count messages
msg_count=$(find "$maildir" -type f -name "*:2,*" 2>/dev/null | wc -l) msg_count=$(find "$maildir" -type f -name "*:2,*" 2>/dev/null | wc -l)
if [ "$msg_count" -gt 0 ]; then if [ "$msg_count" -gt 0 ]; then
print_info "📬 Messages stored: $msg_count" print_info "Messages stored: $msg_count"
fi fi
# Check for quota file # Check for quota file
quota_file=$(find "$maildir" -name "maildirsize" 2>/dev/null | head -1) quota_file=$(find "$maildir" -name "maildirsize" 2>/dev/null | head -1)
if [ -f "$quota_file" ]; then if [ -f "$quota_file" ]; then
quota_info=$(head -1 "$quota_file" 2>/dev/null) quota_info=$(head -1 "$quota_file" 2>/dev/null)
print_info "💾 Quota: $quota_info" print_info "Quota: $quota_info"
fi fi
fi fi
else else
print_warning "Email account NOT FOUND on this server" print_warning "Email account NOT FOUND on this server"
echo "" echo ""
echo "This could mean:" echo "This could mean:"
echo " • Account doesn't exist (typo in email address?)" echo " • Account doesn't exist (typo in email address?)"
@@ -392,7 +392,7 @@ if [ "$check_type" != "2" ]; then
forwarder=$(grep "^$local_part:" "/etc/valiases/$domain_part" 2>/dev/null) forwarder=$(grep "^$local_part:" "/etc/valiases/$domain_part" 2>/dev/null)
if [ -n "$forwarder" ]; then if [ -n "$forwarder" ]; then
echo "" echo ""
print_info "📧 Forwarder configured:" print_info "Forwarder configured:"
echo " $forwarder" echo " $forwarder"
fi fi
fi fi
@@ -404,61 +404,61 @@ fi
# Show verdict # Show verdict
################################################################################ ################################################################################
print_header "🔍 Diagnostic Result" print_header "DIAGNOSTIC RESULT"
echo "" echo ""
# Determine overall status # Determine overall status
if [ "$delivered" -gt 0 ] && [ "$bounced" -eq 0 ] && [ "$rejected" -eq 0 ] && [ "$spam_rejected" -eq 0 ]; then if [ "$delivered" -gt 0 ] && [ "$bounced" -eq 0 ] && [ "$rejected" -eq 0 ] && [ "$spam_rejected" -eq 0 ]; then
print_success "EMAIL IS WORKING PROPERLY" print_success "EMAIL IS WORKING PROPERLY"
echo "" echo ""
echo "Evidence: $delivered successful deliveries in the last $hours hours" echo "Evidence: $delivered successful deliveries in the last $hours hours"
echo "No bounces, rejections, or spam filtering detected" echo "No bounces, rejections, or spam filtering detected"
echo "" echo ""
elif [ "$delivered" -gt 0 ] && [ "$bounced" -gt 0 ]; then elif [ "$delivered" -gt 0 ] && [ "$bounced" -gt 0 ]; then
print_warning "EMAIL PARTIALLY WORKING" print_warning "EMAIL PARTIALLY WORKING"
echo "" echo ""
echo "Some emails delivered ($delivered) but some failed ($bounced)" echo "Some emails delivered ($delivered) but some failed ($bounced)"
echo "Check bounce reasons below for details" echo "Check bounce reasons below for details"
echo "" echo ""
elif [ "$bounced" -gt 0 ] || [ "$rejected" -gt 0 ] || [ "$spam_rejected" -gt 0 ]; then elif [ "$bounced" -gt 0 ] || [ "$rejected" -gt 0 ] || [ "$spam_rejected" -gt 0 ]; then
print_error "EMAIL HAS DELIVERY PROBLEMS" print_error "EMAIL HAS DELIVERY PROBLEMS"
echo "" echo ""
echo "Emails are being rejected, bouncing, or filtered as spam" echo "Emails are being rejected, bouncing, or filtered as spam"
echo "See details below for why" echo "See details below for why"
echo "" echo ""
elif [ "$deferred" -gt 0 ]; then elif [ "$deferred" -gt 0 ]; then
print_warning "EMAIL DELAYED" print_warning "EMAIL DELAYED"
echo "" echo ""
echo "Emails are being deferred (temporary failures)" echo "Emails are being deferred (temporary failures)"
echo "This usually resolves itself within minutes" echo "This usually resolves itself within minutes"
echo "" echo ""
elif [ "$sent" -gt 0 ] || [ "$received" -gt 0 ]; then elif [ "$sent" -gt 0 ] || [ "$received" -gt 0 ]; then
print_info "📬 EMAIL ACTIVITY DETECTED" print_info "EMAIL ACTIVITY DETECTED"
echo "" echo ""
echo "Email traffic logged but no delivery confirmations in last $hours hours" echo "Email traffic logged but no delivery confirmations in last $hours hours"
echo "This may be normal depending on email volume" echo "This may be normal depending on email volume"
echo "" echo ""
elif [ "$auth_success" -gt 0 ] || [ "$auth_failed" -gt 0 ]; then elif [ "$auth_success" -gt 0 ] || [ "$auth_failed" -gt 0 ]; then
print_info "📱 MAILBOX ACCESS ONLY" print_info "MAILBOX ACCESS ONLY"
echo "" echo ""
echo "No email delivery activity, only mailbox access (IMAP/POP3) detected" echo "No email delivery activity, only mailbox access (IMAP/POP3) detected"
echo "This means the account exists and is being checked, but no emails sent/received" echo "This means the account exists and is being checked, but no emails sent/received"
echo "" echo ""
if [ "$auth_success" -gt 0 ]; then if [ "$auth_success" -gt 0 ]; then
echo "Authentication is working (customer can access mailbox)" echo "Authentication is working (customer can access mailbox)"
fi fi
if [ "$auth_failed" -gt 0 ]; then if [ "$auth_failed" -gt 0 ]; then
echo "Failed login attempts detected (see details below)" echo "Failed login attempts detected (see details below)"
fi fi
echo "" echo ""
else else
print_warning "NO EMAIL ACTIVITY FOUND" print_warning "NO EMAIL ACTIVITY FOUND"
echo "" echo ""
echo "No email sending, receiving, or mailbox access in the last $hours hours" echo "No email sending, receiving, or mailbox access in the last $hours hours"
echo "Account may be inactive or not used during this time period" echo "Account may be inactive or not used during this time period"
@@ -470,7 +470,7 @@ fi
################################################################################ ################################################################################
if [ "$delivered" -gt 0 ]; then if [ "$delivered" -gt 0 ]; then
print_header "✅ Recent Successful Deliveries (last 5 from past $hours hours)" print_header "RECENT SUCCESSFUL DELIVERIES (last 5 from past $hours hours)"
echo "" echo ""
print_info "PROOF - These emails were delivered recently:" print_info "PROOF - These emails were delivered recently:"
echo "" echo ""
@@ -487,7 +487,7 @@ if [ "$delivered" -gt 0 ]; then
fi fi
if [ "$bounced" -gt 0 ]; then if [ "$bounced" -gt 0 ]; then
print_header "❌ Recent Bounces/Failures (last 5 from past $hours hours)" print_header "RECENT BOUNCES/FAILURES (last 5 from past $hours hours)"
echo "" echo ""
print_warning "PROOF - These emails failed recently:" print_warning "PROOF - These emails failed recently:"
echo "" echo ""
@@ -502,14 +502,14 @@ if [ "$bounced" -gt 0 ]; then
echo "" echo ""
# Extract bounce reasons # Extract bounce reasons
print_header "Common Bounce Reasons" print_header "COMMON BOUNCE REASONS"
echo "" echo ""
grep -i "bounce\|550\|fail" "$TEMP_MATCHES" | grep -oE "550 .*|User unknown|Mailbox.*full|Relay.*denied|blocked" | sort | uniq -c | sort -rn | head -5 grep -i "bounce\|550\|fail" "$TEMP_MATCHES" | grep -oE "550 .*|User unknown|Mailbox.*full|Relay.*denied|blocked" | sort | uniq -c | sort -rn | head -5
echo "" echo ""
fi fi
if [ "$rejected" -gt 0 ]; then if [ "$rejected" -gt 0 ]; then
print_header "🚫 Recent Rejections (last 5)" print_header "RECENT REJECTIONS (last 5)"
echo "" echo ""
grep -i "rejected.*$search_pattern\|denied.*$search_pattern\|blocked.*$search_pattern" "$TEMP_MATCHES" | tail -5 | while read line; do grep -i "rejected.*$search_pattern\|denied.*$search_pattern\|blocked.*$search_pattern" "$TEMP_MATCHES" | tail -5 | while read line; do
echo " $line" echo " $line"
@@ -518,7 +518,7 @@ if [ "$rejected" -gt 0 ]; then
fi fi
if [ "$spam_rejected" -gt 0 ]; then if [ "$spam_rejected" -gt 0 ]; then
print_header "🚫 Recent Spam Rejections (last 5)" print_header "RECENT SPAM REJECTIONS (last 5)"
echo "" echo ""
grep -i "spam.*$search_pattern\|SpamAssassin.*rejected" "$TEMP_MATCHES" | tail -5 | while read line; do grep -i "spam.*$search_pattern\|SpamAssassin.*rejected" "$TEMP_MATCHES" | tail -5 | while read line; do
timestamp=$(echo "$line" | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}|[A-Z][a-z]{2} [0-9]+ [0-9]{2}:[0-9]{2}:[0-9]{2}' | head -1) timestamp=$(echo "$line" | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}|[A-Z][a-z]{2} [0-9]+ [0-9]{2}:[0-9]{2}:[0-9]{2}' | head -1)
@@ -532,7 +532,7 @@ if [ "$spam_rejected" -gt 0 ]; then
fi fi
if [ "$greylist" -gt 0 ]; then if [ "$greylist" -gt 0 ]; then
print_header "⏱ Recent Greylisting Events (last 5)" print_header "RECENT GREYLISTING EVENTS (last 5)"
echo "" echo ""
print_info "Note: Greylisting is temporary - emails usually deliver after retry" print_info "Note: Greylisting is temporary - emails usually deliver after retry"
echo "" echo ""
@@ -543,7 +543,7 @@ if [ "$greylist" -gt 0 ]; then
fi fi
if [ "$spf_fail" -gt 0 ] || [ "$dkim_fail" -gt 0 ]; then if [ "$spf_fail" -gt 0 ] || [ "$dkim_fail" -gt 0 ]; then
print_header "⚠ Authentication Issues" print_header "AUTHENTICATION ISSUES"
echo "" echo ""
if [ "$spf_fail" -gt 0 ]; then if [ "$spf_fail" -gt 0 ]; then
echo "SPF failures detected:" echo "SPF failures detected:"
@@ -561,7 +561,7 @@ fi
# Recommendations # Recommendations
################################################################################ ################################################################################
print_header "💡 Recommendations" print_header "RECOMMENDATIONS"
echo "" echo ""
if [ "$bounced" -gt 0 ]; then if [ "$bounced" -gt 0 ]; then