Add bash/dovecot/validate.cpanel.MD
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Ensure we're using Bash
|
||||
if [ -z "$BASH_VERSION" ]; then
|
||||
echo "This script must be run with Bash."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
tail -F /var/log/dovecot.log | while read -r line; do
|
||||
if echo "$line" | grep -q "Login: user=<[^@]\+@[^>]\+>"; then
|
||||
domain=$(echo "$line" | sed -n 's/.*Login: user=<[^@]\+@\([^>]\+\)>.*/\1/p')
|
||||
|
||||
if [ -n "$domain" ]; then
|
||||
owner=$( /scripts/whoowns "$domain" )
|
||||
|
||||
if [ -z "$owner" ]; then
|
||||
echo "Domain $domain does not exist."
|
||||
else
|
||||
echo "Domain $domain exists and is owned by $owner."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
```
|
||||
Reference in New Issue
Block a user