One Hat Cyber Team
Your IP :
216.73.216.115
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
etc
/
postfix
/
View File Name :
filter.sh
#!/bin/bash # Simple shell-based filter. It is meant to be invoked as follows: # /path/to/script -f sender recipients... # Localize these. The -G option does nothing before Postfix 2.3. INSPECT_DIR=/var/spool/filter SENDMAIL="/usr/sbin/sendmail -G -i" # NEVER NEVER NEVER use "-t" here. # Exit codes from <sysexits.h> EX_TEMPFAIL=75 EX_UNAVAILABLE=69 # Clean up when done or when aborting. trap "rm -f in.$$" 0 1 2 3 15 filter() { tzone=`date +%z` while read line; do # Nothing interesting more if [[ "$line" =~ 'Content-Type' ]]; then break; fi # Is this nosc mail? if [[ "$line" =~ 'Return-Path: <nosc@imath.kiev.ua>' ]]; then nosc=1 fi # Markers to check: wrong timezone, missing 'for <blah-blah@some>', hostname webmail.imath.kiev.ua or imath.kiev.ua, presence of X-Sender # Timezone if [[ "$line" =~ ^Date: ]]; then messagetz=`echo $line |cut -d' ' -f 7|tr -d "\r"` fi # Check hostname if [[ "$line" =~ 'Received: from' ]] && [[ "$line" =~ '(localhost [127.0.0.1])' ]]; then mailhost=`echo $line |cut -d' ' -f 3` read read line if [[ "$line" =~ ^for ]]; then withdest=1 fi fi if [[ "$line" =~ ^X-Sender ]]; then xsender=1 fi done if [[ $tzone != $messagetz ]]; then wrongtz=1; #echo "Wrong timezome" fi #echo "Current tz .$tzone." #echo "Message tz .$messagetz." #echo "nosc $nosc" #echo "Mailhost .$mailhost." #echo "With destination $withdest" #echo "X-Sender $xsender" # We inspect only one user if [[ ! $nosc ]]; then return 0; fi # We discard unconditionally wrong timezone if [[ $wrongtz ]]; then return 1; fi # We accept imath.kiev.ua without X-sender (mail from NO site) if [[ "$mailhost" == "imath.kiev.ua" ]] && [[ !$xsender ]]; then return 0 ; fi # We accept webmail with destination address in Received: if [[ "$mailhost" == "webmail.imath.kiev.ua" ]] && [[ $withdest ]]; then return 0 ; fi return 1 } # Start processing. cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; } cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; } # Specify your content filter here. filter <in.$$ || { echo Message content rejected; exit $EX_UNAVAILABLE; } $SENDMAIL "$@" <in.$$ exit $?