Skip to content

Commit

Permalink
Pin UISP cert to silence SSL errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Dickinson committed Oct 14, 2024
1 parent 85cbbd4 commit 70565b5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/meshapi/util/uisp_import/fetch_uisp.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def get_uisp_devices() -> List[UISPDevice]:
return json.loads(
session.get(
os.path.join(UISP_URL, "api/v2.1/devices"),
verify=False,
).content.decode("UTF8")
)

Expand All @@ -39,7 +38,6 @@ def get_uisp_links() -> List[UISPDataLink]:
return json.loads(
session.get(
os.path.join(UISP_URL, "api/v2.1/data-links"),
verify=False,
).content.decode("UTF8")
)

Expand All @@ -54,7 +52,6 @@ def get_uisp_device_detail(device_id: str, session: Optional[requests.Session] =
return json.loads(
session.get(
os.path.join(UISP_URL, f"api/v2.1/devices/{device_id}"),
verify=False,
).content.decode("UTF8")
)

Expand All @@ -69,12 +66,12 @@ def get_uisp_token(session: requests.Session) -> str:
"username": UISP_USER,
"password": UISP_PASS,
},
verify=False,
).headers["x-auth-token"]


def get_uisp_session() -> requests.Session:
session = requests.Session()
session.verify = os.path.join(os.path.dirname(__file__), "uisp.mesh.nycmesh.net.crt")

Check warning on line 74 in src/meshapi/util/uisp_import/fetch_uisp.py

View check run for this annotation

Codecov / codecov/patch

src/meshapi/util/uisp_import/fetch_uisp.py#L74

Added line #L74 was not covered by tests
session.headers = {"x-auth-token": get_uisp_token(session)}

return session
22 changes: 22 additions & 0 deletions src/meshapi/util/uisp_import/uisp.mesh.nycmesh.net.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtDCCApygAwIBAgIUEG5y4t3otCXpwDVINupyHhvQLEgwDQYJKoZIhvcNAQEL
BQAwYDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5ZMREwDwYDVQQHDAhOZXcgWW9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