Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
fc0abd5b
Commit
fc0abd5b
authored
Aug 22, 2016
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confirm that fail2ban is protecting pop3s, closes #629
parent
27b4edfc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
fail2ban.py
tests/fail2ban.py
+25
-0
No files found.
tests/fail2ban.py
View file @
fc0abd5b
...
...
@@ -68,6 +68,28 @@ def imap_test():
finally
:
M
.
logout
()
# shuts down connection, has nothing to do with login()
def
pop_test
():
import
poplib
try
:
M
=
poplib
.
POP3_SSL
(
hostname
)
except
ConnectionRefusedError
:
# looks like fail2ban worked
raise
IsBlocked
()
try
:
M
.
user
(
'fakeuser'
)
try
:
M
.
pass_
(
'fakepassword'
)
except
poplib
.
error_proto
as
e
:
# Authentication should fail.
M
=
None
# don't .quit()
return
M
.
list
()
raise
Exception
(
"authentication didn't fail"
)
finally
:
if
M
:
M
.
quit
()
def
http_test
(
url
,
expected_status
,
postdata
=
None
,
qsargs
=
None
,
auth
=
None
):
import
urllib.parse
import
requests
...
...
@@ -183,6 +205,9 @@ if __name__ == "__main__":
# IMAP
run_test
(
imap_test
,
[],
20
,
30
,
4
)
# POP
run_test
(
pop_test
,
[],
20
,
30
,
4
)
# Mail-in-a-Box control panel
run_test
(
http_test
,
[
"/admin/me"
,
200
],
20
,
30
,
1
)
...
...
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