Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Video AG Infrastruktur
website
Commits
507588e5
Commit
507588e5
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Plain Diff
Merge branch '245-authentifikation-bei-rwth-intern-uber-ips-erlauben' into 'master'
Resolve "Authentifikation bei RWTH-Intern über IPs erlauben" Closes
#245
See merge request
!9
parents
afe041c2
00bc63c7
No related branches found
No related tags found
1 merge request
!9
Resolve "Authentifikation bei RWTH-Intern über IPs erlauben"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
config.py.example
+1
-0
1 addition, 0 deletions
config.py.example
server.py
+7
-1
7 additions, 1 deletion
server.py
with
8 additions
and
1 deletion
config.py.example
+
1
−
0
View file @
507588e5
...
...
@@ -26,3 +26,4 @@ SQLITE_INIT_DATA = True
#LDAP_HOST = 'ldaps://rumo.fsmpi.rwth-aachen.de'
#ICAL_URL = 'https://user:password@mail.fsmpi.rwth-aachen.de/SOGo/....ics'
ERROR_PAGE = 'static/500.html'
RWTH_IP_RANGES = ['134.130.0.0/16', '137.226.0.0/16', '134.61.0.0/16', '192.35.229.0/24', '2a00:8a60::/32']
This diff is collapsed.
Click to expand it.
server.py
+
7
−
1
View file @
507588e5
...
...
@@ -11,6 +11,7 @@ import sched
import
traceback
import
string
from
socket
import
gethostname
from
ipaddress
import
ip_address
,
ip_network
app
=
Flask
(
__name__
)
...
...
@@ -142,6 +143,12 @@ def checkperm(perms, username=None, password=None):
elif
perm
[
'
type
'
]
==
'
rwth
'
:
if
session
.
get
(
'
rwthintern
'
,
False
):
return
True
if
'
X-Real-IP
'
not
in
request
.
headers
:
continue
ip
=
ip_address
(
request
.
headers
[
'
X-Real-IP
'
])
for
net
in
config
[
'
RWTH_IP_RANGES
'
]:
if
ip
in
ip_network
(
net
):
return
True
return
False
@app.template_filter
()
...
...
@@ -574,7 +581,6 @@ def auth(): # For use with nginx auth_request
if
'
X-Original-Uri
'
not
in
request
.
headers
:
return
'
Internal Server Error
'
,
500
url
=
request
.
headers
[
'
X-Original-Uri
'
].
lstrip
(
config
[
'
VIDEOPREFIX
'
])
ip
=
request
.
headers
.
get
(
'
X-Real-IP
'
,
''
)
if
request
.
cookies
.
get
(
'
tracking
'
,
''
)
and
request
.
cookies
[
'
tracking
'
].
isdigit
():
cookie
=
int
(
request
.
cookies
[
'
tracking
'
])
else
:
...
...
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