Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
acf5b4e0
Commit
acf5b4e0
authored
6 years ago
by
Nicolas KAROLAK
Browse files
Options
Downloads
Patches
Plain Diff
spf check
Try import spf otherwise install it, and use it to validate against spf records.
parent
89ac6016
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_email.py
+10
-4
10 additions, 4 deletions
tests/test_email.py
with
10 additions
and
4 deletions
tests/test_email.py
+
10
−
4
View file @
acf5b4e0
...
...
@@ -11,6 +11,12 @@ import random
import
time
import
imp
try
:
import
spf
except
ImportError
:
status
,
output
=
subprocess
.
getstatusoutput
(
'
apt-get -qq -y install python3-spf
'
)
import
spf
YELLOW
=
'
\033
[93m
'
GREEN
=
'
\033
[92m
'
RED
=
'
\033
[91m
'
...
...
@@ -74,10 +80,10 @@ def check_relay():
print_yellow
(
'
/etc/mailname does not contain ubicast.eu or ubicast.tv, mails will probably not be received on ubicast mailing lists
'
)
return
3
# check spf
status
,
output
=
subprocess
.
getstatusoutput
(
'
host -t TXT
ubicast.eu
'
)
if
ip
not
in
output
:
print_red
(
'
ip %s is not in ubicast.eu SPF and emails sent from support@ubicast.eu
will
be treated as spam
'
%
ip
)
return
1
result
,
explain
=
spf
.
check2
(
i
=
ip
,
s
=
'
support@
ubicast.eu
'
,
h
=
''
)
if
result
!=
'
pass
'
:
print_red
(
'
ip %s is not in ubicast.eu SPF and emails sent from support@ubicast.eu
may
be treated as spam
'
%
ip
)
return
3
conf_relay
=
conf
.
get
(
'
EMAIL_SMTP_SERVER
'
,
''
).
strip
(
'
[]
'
)
if
conf_relay
!=
configured_relay
:
print_red
(
'
Configured STMP relay (%s) does not match the expected value (%s).
'
%
(
configured_relay
,
conf_relay
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment