]> git.siccegge.de Git - tooling/letool.git/blobdiff - sicceggetools/acme/settings.py
Change everything
[tooling/letool.git] / sicceggetools / acme / settings.py
diff --git a/sicceggetools/acme/settings.py b/sicceggetools/acme/settings.py
new file mode 100644 (file)
index 0000000..5c0f246
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import logging
+import yaml
+
+
+
+class Settings:
+    def __init__(self, path='config/settings.yaml'):
+        with open(path) as invfd:
+            self._settings = yaml.load(invfd.read())
+
+
+    def use_method(self, method, san, settings):
+        authmethods = self._settings['authorization']
+        
+        for thismethod, data in authmethods.items():
+            for host in data['hosts']:
+                if not san.endswith(host):
+                    continue
+        
+                return thismethod == method
+        
+        if '*' in authmethods[method]['hosts']:
+            return True
+        
+        return False
+
+