Skip to content
Snippets Groups Projects
Commit bd647b2e authored by Martin van Es's avatar Martin van Es
Browse files

Make proxy domains configurable

parent d963b10c
Branches
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -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')
......
---
test:
signer: 'http://localhost:5001'
foobar:
signer: 'http://localhost:5001'
......@@ -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)
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment