Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
a4e56278
Commit
a4e56278
authored
Sep 14, 2013
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse_mail_log: add --list support, add email to access
parent
de364f1a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
check_web_letters.sh
mail/check_web_letters.sh
+2
-0
parse_mail_log.py
mail/parse_mail_log.py
+12
-2
No files found.
mail/check_web_letters.sh
View file @
a4e56278
...
...
@@ -4,5 +4,7 @@ grep "Connection refused" /var/log/mail/all | grep "reject: RCPT" | grep "Sender
>
$0
.out
# sed "s!.*RCPT from \(.*\)\[.*from=<\(.*\)> to=<\(.*\)>.*!host=\1 from=\2 to=\3!g"
echo
echo
"==============="
date
$(
dirname
$0
)
/parse_mail_log.py
mail/parse_mail_log.py
View file @
a4e56278
...
...
@@ -22,7 +22,7 @@ def check_http(url):
def
append_ip
(
host
,
ip
,
email
):
today
=
datetime
.
datetime
.
now
()
f
=
open
(
'/etc/postfix/access-our'
,
'a'
)
f
.
write
(
"
\n
# "
+
str
(
today
)
+
": "
+
host
+
"
\n
"
+
ip
+
" OK
\n
#
"
+
email
+
" OK
\n
"
);
f
.
write
(
"
\n
# "
+
str
(
today
)
+
": "
+
host
+
"
\n
"
+
ip
+
" OK
\n
"
+
email
+
" OK
\n
"
);
f
.
close
()
print
ip
...
...
@@ -64,6 +64,12 @@ if __name__== "__main__":
#r1 = parse_row (test_string)
#print r1
list_only
=
0
if
len
(
sys
.
argv
)
>
1
:
if
sys
.
argv
[
1
]
==
"--list"
:
list_only
=
1
if
not
list_only
:
read_exists_ip
()
f
=
open
(
'check_web_letters.sh.out'
,
'r'
)
...
...
@@ -75,7 +81,11 @@ if __name__== "__main__":
continue
if
line
not
in
result
:
result
.
append
(
line
)
#print line
if
list_only
:
print
line
continue
sp
=
string
.
split
(
line
[
'from'
],
'@'
)
# если домен почты совпадает с хостом отправителя
if
sp
[
1
]
==
line
[
'host'
]:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment