Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Trust and Identity Incubator
alternate-mdx
Commits
bd647b2e
Commit
bd647b2e
authored
Jan 27, 2022
by
Martin van Es
Browse files
Make proxy domains configurable
parent
d963b10c
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
bd647b2e
...
...
@@ -22,13 +22,14 @@ Reloads metadata on inotify CLOSE_WRITE of metadata file.
Serves and caches signed by domain signer from memory, on request
## ```mdproxy.py```
Reads config from mdproxy.yaml configuration, see example.
Caches signed and cached
```mdserver.py```
metadata requests
## Queries
MDQ Queries can then be pointed at
-
```http://mdserver:5001/
sign
/<entityid>```
-
```http://mdproxy:5002/
cache
/<entityid>```
-
```http://mdserver:5001/
<domain>/entities
/<entityid>```
-
```http://mdproxy:5002/
<domain>/entities
/<entityid>```
## Bootstrap softHSM2
This is a very brief summary of the successive commands to initialize softHSM2 for testing. Tested on Ubuntu 21.10.
...
...
mdproxy.py
View file @
bd647b2e
...
...
@@ -6,14 +6,14 @@ from urllib.parse import unquote
from
dateutil
import
parser
,
tz
from
datetime
import
datetime
from
utils
import
hasher
,
Entity
from
utils
import
read_config
,
hasher
,
Entity
config
=
read_config
(
'mdproxy.yaml'
)
app
=
Flask
(
__name__
)
# Find all IdP's in edugain metadata
cached
=
{}
signer_url
=
'http://localhost:5001'
@
app
.
route
(
'/<domain>/entities/<path:eid>'
,
methods
=
[
'GET'
])
...
...
@@ -35,7 +35,7 @@ def serve(domain, eid):
return
cached
[
domain
][
entityID
].
md
else
:
print
(
f
"request
{
entityID
}
"
)
data
=
requests
.
get
(
f
"
{
signer
_url
}
/
{
domain
}
/entities/{{sha1}}
{
entityID
}
"
).
text
data
=
requests
.
get
(
f
"
{
config
[
domain
][
'
signer
'
]
}
/
{
domain
}
/entities/{{sha1}}
{
entityID
}
"
).
text
try
:
parsed
=
ET
.
fromstring
(
data
)
validUntil
=
parsed
.
get
(
'validUntil'
)
...
...
mdproxy.yaml.example
0 → 100644
View file @
bd647b2e
---
test:
signer: 'http://localhost:5001'
foobar:
signer: 'http://localhost:5001'
mdserver.py
View file @
bd647b2e
...
...
@@ -2,7 +2,7 @@
from
utils
import
read_config
,
Resource
,
Server
from
flask
import
Flask
,
Response
config
=
read_config
()
config
=
read_config
(
'mdserver.yaml'
)
app
=
Flask
(
__name__
)
server
=
Server
()
...
...
@@ -31,4 +31,4 @@ for domain, values in config.items():
if
__name__
==
"__main__"
:
app
.
run
(
host
=
'
127
.0.0.
1
'
,
port
=
5001
,
debug
=
False
)
app
.
run
(
host
=
'
0
.0.0.
0
'
,
port
=
5001
,
debug
=
False
)
utils.py
View file @
bd647b2e
...
...
@@ -13,8 +13,8 @@ from signers import Signers
# watch_manager = pyinotify.WatchManager()
def
read_config
():
with
open
(
'mdserver.yaml'
)
as
f
:
def
read_config
(
config
):
with
open
(
config
)
as
f
:
config
=
yaml
.
safe_load
(
f
)
return
config
...
...
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