mrok 0.1.9__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mrok/controller/app.py +3 -1
- mrok/controller/routes/__init__.py +0 -0
- mrok/controller/routes/instances.py +71 -0
- mrok/ziti/pki.py +10 -5
- {mrok-0.1.9.dist-info → mrok-0.2.1.dist-info}/METADATA +2 -1
- {mrok-0.1.9.dist-info → mrok-0.2.1.dist-info}/RECORD +10 -8
- /mrok/controller/{routes.py → routes/extensions.py} +0 -0
- {mrok-0.1.9.dist-info → mrok-0.2.1.dist-info}/WHEEL +0 -0
- {mrok-0.1.9.dist-info → mrok-0.2.1.dist-info}/entry_points.txt +0 -0
- {mrok-0.1.9.dist-info → mrok-0.2.1.dist-info}/licenses/LICENSE.txt +0 -0
mrok/controller/app.py
CHANGED
|
@@ -8,7 +8,8 @@ from fastapi.routing import APIRoute, APIRouter
|
|
|
8
8
|
from mrok.conf import get_settings
|
|
9
9
|
from mrok.controller.auth import authenticate
|
|
10
10
|
from mrok.controller.openapi import generate_openapi_spec
|
|
11
|
-
from mrok.controller.routes import router as extensions_router
|
|
11
|
+
from mrok.controller.routes.extensions import router as extensions_router
|
|
12
|
+
from mrok.controller.routes.instances import router as instances_router
|
|
12
13
|
|
|
13
14
|
logger = logging.getLogger(__name__)
|
|
14
15
|
|
|
@@ -52,6 +53,7 @@ def setup_app():
|
|
|
52
53
|
app.include_router(
|
|
53
54
|
extensions_router, prefix="/extensions", dependencies=[Depends(authenticate)]
|
|
54
55
|
)
|
|
56
|
+
app.include_router(instances_router, prefix="/instances", dependencies=[Depends(authenticate)])
|
|
55
57
|
|
|
56
58
|
settings = get_settings()
|
|
57
59
|
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from fastapi import APIRouter, HTTPException, status
|
|
4
|
+
|
|
5
|
+
from mrok.controller.dependencies import ZitiManagementAPI
|
|
6
|
+
from mrok.controller.openapi import examples
|
|
7
|
+
from mrok.controller.pagination import LimitOffsetPage, paginate
|
|
8
|
+
from mrok.controller.schemas import InstanceRead
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger("mrok.controller")
|
|
11
|
+
|
|
12
|
+
router = APIRouter()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async def fetch_instance_or_404(mgmt_api: ZitiManagementAPI, id_or_instance_id: str):
|
|
16
|
+
identity = await mgmt_api.search_identity(id_or_instance_id)
|
|
17
|
+
if not identity:
|
|
18
|
+
raise HTTPException(
|
|
19
|
+
status_code=status.HTTP_404_NOT_FOUND,
|
|
20
|
+
)
|
|
21
|
+
return identity
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@router.get(
|
|
25
|
+
"/{id_or_instance_id}",
|
|
26
|
+
response_model=InstanceRead,
|
|
27
|
+
responses={
|
|
28
|
+
200: {
|
|
29
|
+
"description": "Instance",
|
|
30
|
+
"content": {"application/json": {"example": examples.INSTANCE_RESPONSE}},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
dependencies=[],
|
|
34
|
+
tags=["Instances"],
|
|
35
|
+
)
|
|
36
|
+
async def get_instance_by_id_or_instance_id(
|
|
37
|
+
mgmt_api: ZitiManagementAPI,
|
|
38
|
+
id_or_instance_id: str,
|
|
39
|
+
):
|
|
40
|
+
identity = await fetch_instance_or_404(mgmt_api, id_or_instance_id)
|
|
41
|
+
return InstanceRead(**identity)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@router.get(
|
|
45
|
+
"",
|
|
46
|
+
response_model=LimitOffsetPage[InstanceRead],
|
|
47
|
+
responses={
|
|
48
|
+
200: {
|
|
49
|
+
"description": "List of Instances",
|
|
50
|
+
"content": {
|
|
51
|
+
"application/json": {
|
|
52
|
+
"example": {
|
|
53
|
+
"data": [examples.INSTANCE_RESPONSE],
|
|
54
|
+
"$meta": {
|
|
55
|
+
"pagination": {
|
|
56
|
+
"total": 1,
|
|
57
|
+
"limit": 10,
|
|
58
|
+
"offset": 0,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
tags=["Instances"],
|
|
67
|
+
)
|
|
68
|
+
async def get_instances(
|
|
69
|
+
mgmt_api: ZitiManagementAPI,
|
|
70
|
+
):
|
|
71
|
+
return await paginate(mgmt_api, "/identities", InstanceRead)
|
mrok/ziti/pki.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
|
|
3
|
+
from asn1crypto import cms
|
|
3
4
|
from cryptography import x509
|
|
4
5
|
from cryptography.hazmat.primitives import hashes, serialization
|
|
5
6
|
from cryptography.hazmat.primitives.asymmetric import rsa
|
|
6
|
-
from cryptography.hazmat.primitives.serialization.pkcs7 import load_der_pkcs7_certificates
|
|
7
7
|
from cryptography.x509.oid import NameOID
|
|
8
8
|
|
|
9
9
|
from mrok.ziti.api import ZitiManagementAPI
|
|
@@ -16,11 +16,16 @@ async def get_ca_certificates(mgmt_api: ZitiManagementAPI) -> str:
|
|
|
16
16
|
if not _ca_certificates:
|
|
17
17
|
cas_pkcs7 = await mgmt_api.fetch_ca_certificates()
|
|
18
18
|
pkcs7_bytes = base64.b64decode(cas_pkcs7)
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
content_info = cms.ContentInfo.load(pkcs7_bytes)
|
|
21
|
+
certs = content_info["content"]["certificates"]
|
|
22
|
+
|
|
20
23
|
ca_certificates = []
|
|
21
|
-
for cert in
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
for cert in certs:
|
|
25
|
+
crypt_cert = x509.load_der_x509_certificate(cert.dump())
|
|
26
|
+
pem = crypt_cert.public_bytes(serialization.Encoding.PEM).decode("utf-8")
|
|
27
|
+
ca_certificates.append(pem)
|
|
28
|
+
|
|
24
29
|
_ca_certificates = "\n".join(ca_certificates)
|
|
25
30
|
return _ca_certificates
|
|
26
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mrok
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: MPT Extensions OpenZiti Orchestrator
|
|
5
5
|
Author: SoftwareOne AG
|
|
6
6
|
License: Apache License
|
|
@@ -206,6 +206,7 @@ License: Apache License
|
|
|
206
206
|
limitations under the License.
|
|
207
207
|
License-File: LICENSE.txt
|
|
208
208
|
Requires-Python: <4,>=3.12
|
|
209
|
+
Requires-Dist: asn1crypto<2.0.0,>=1.5.1
|
|
209
210
|
Requires-Dist: cryptography<46.0.0,>=45.0.7
|
|
210
211
|
Requires-Dist: dynaconf<4.0.0,>=3.2.11
|
|
211
212
|
Requires-Dist: fastapi-pagination<0.15.0,>=0.14.1
|
|
@@ -31,10 +31,9 @@ mrok/cli/commands/controller/__init__.py,sha256=2xw-YVN0akiLiuGUU3XbYyZZ0ugOjQ6X
|
|
|
31
31
|
mrok/cli/commands/controller/openapi.py,sha256=QLjVao9UkB2vBaGkFi_q_jrlg4Np4ldMRwDIJsrJ7A8,1175
|
|
32
32
|
mrok/cli/commands/controller/run.py,sha256=osyjssb81xNMYZLPb6dfPR4W_BQlCxKDfvl-BIhG_1A,2460
|
|
33
33
|
mrok/controller/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
mrok/controller/app.py,sha256
|
|
34
|
+
mrok/controller/app.py,sha256=_MzTu_wFRbD4kGbw4PdP5OYpl3KDlOCJFeNWxt-WM-c,1818
|
|
35
35
|
mrok/controller/auth.py,sha256=Kg94W8yNMs6TvUmLRYv1QeUjDy4qlGZ-_6OHa4KH1zg,2648
|
|
36
36
|
mrok/controller/pagination.py,sha256=raYpYa34q8Ckl4BXBOEdpWlKkFj6z7e6QLWr2HT7dzI,2187
|
|
37
|
-
mrok/controller/routes.py,sha256=j-dLO4yLkUj-rdjnGhO2suvmR690-UdaNvokDZ7ZpF0,8670
|
|
38
37
|
mrok/controller/schemas.py,sha256=zk91PIJ0zncpBgs4bhU-n-76EWlRKo87r3VVx15JxPc,1320
|
|
39
38
|
mrok/controller/dependencies/__init__.py,sha256=voewk6gjkA0OarL6HFmfT_RLqBns0Fpl-VIqK5xVAEI,202
|
|
40
39
|
mrok/controller/dependencies/conf.py,sha256=2Pa8fxJHkZ29q6UL-w6hUP_wr7WnNELfw5LlzWg1Tec,162
|
|
@@ -42,6 +41,9 @@ mrok/controller/dependencies/ziti.py,sha256=fYoxeJb4s6p2_3gxbExbFSRabjpvp_gZMBb3
|
|
|
42
41
|
mrok/controller/openapi/__init__.py,sha256=U1dw45w76CcoQagyqg_FXdMuJF3qJZZM6wG8TeTe3Zo,101
|
|
43
42
|
mrok/controller/openapi/examples.py,sha256=ZI0BP7L6sI0z7Mq1I3uc2UrweGpzpPeGSIuf1bUKkgg,1419
|
|
44
43
|
mrok/controller/openapi/utils.py,sha256=Kn55ISAWlMJNwrJTum7iFrBvJvr81To76pCK8W-s79Q,1114
|
|
44
|
+
mrok/controller/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
+
mrok/controller/routes/extensions.py,sha256=j-dLO4yLkUj-rdjnGhO2suvmR690-UdaNvokDZ7ZpF0,8670
|
|
46
|
+
mrok/controller/routes/instances.py,sha256=rcpbKfLsYsokOo7aZamzQks-c9AYoU-8KKK9pDYpoOY,1963
|
|
45
47
|
mrok/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
48
|
mrok/http/config.py,sha256=k8mjvD3ninJn-v1t-co-GSa3upm4b70bWyk3fwdcOh8,2161
|
|
47
49
|
mrok/http/forwarder.py,sha256=mo-Z8B8Zg6kdDX-lWEiptRv-9kJU9cEdmg6gt6eF0cc,11374
|
|
@@ -55,10 +57,10 @@ mrok/ziti/bootstrap.py,sha256=QIDhlkIxPW2QRuumFq2D1WDbD003P5f3z24pAUsyeBI,2696
|
|
|
55
57
|
mrok/ziti/constants.py,sha256=Urq1X3bCBQZfw8NbnEa1pqmY4oq1wmzkwPfzam3kbTw,339
|
|
56
58
|
mrok/ziti/errors.py,sha256=yYCbVDwktnR0AYduqtynIjo73K3HOhIrwA_vQimvEd4,368
|
|
57
59
|
mrok/ziti/identities.py,sha256=oE_3j6Y4xCr6uKNdprW55bxGsyKnmJt-MrxrylB2Ey4,5388
|
|
58
|
-
mrok/ziti/pki.py,sha256
|
|
60
|
+
mrok/ziti/pki.py,sha256=o2tySqHC8-7bvFuI2Tqxg9vX6H6ZSxWxfP_9x29e19M,1954
|
|
59
61
|
mrok/ziti/services.py,sha256=JnznLTHNZjgbFwnBtv7y2XIp4NiQxLVawwP9EfWdVuM,3208
|
|
60
|
-
mrok-0.1.
|
|
61
|
-
mrok-0.1.
|
|
62
|
-
mrok-0.1.
|
|
63
|
-
mrok-0.1.
|
|
64
|
-
mrok-0.1.
|
|
62
|
+
mrok-0.2.1.dist-info/METADATA,sha256=6pEGhIuJ0KJNyG3QXfLouC71PaFpywYGg2AEWrrQFLg,15546
|
|
63
|
+
mrok-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
64
|
+
mrok-0.2.1.dist-info/entry_points.txt,sha256=tloXwvU1uJicBJR2h-8HoVclPgwJWDwuREMHN8Zq-nU,38
|
|
65
|
+
mrok-0.2.1.dist-info/licenses/LICENSE.txt,sha256=6PaICaoA3yNsZKLv5G6OKqSfLSoX7MakYqTDgJoTCBs,11346
|
|
66
|
+
mrok-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|