You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,64 @@ async def main():
40
40
asyncio.run(main())
41
41
```
42
42
43
+
### TLS and self-signed certificates
44
+
45
+
Find My Device always requires HTTPS; plain HTTP is not allowed by this client. If you need to connect to a server with a self-signed certificate, you have two options:
46
+
47
+
- Preferred (secure): provide a custom SSLContext that trusts your CA or certificate
48
+
- Last resort (not for production): disable certificate validation explicitly
- HTTP (http://) is rejected. Use only HTTPS URLs.
72
+
- Prefer a custom SSLContext over disabling verification.
73
+
- For higher security, consider pinning the server cert in your context.
74
+
75
+
> Warning
76
+
>
77
+
> Passing `ssl=False` disables TLS certificate validation and should only be used in development. For production, use a custom `ssl.SSLContext` that trusts your CA/certificate or pin the server certificate. The client enforces HTTPS and rejects `http://` URLs.
78
+
79
+
#### Pinning the exact server certificate (recommended for self-signed)
80
+
81
+
If you're using a self-signed certificate and want to pin to that exact cert, load the server's PEM (or DER) directly into an SSLContext. This ensures only that certificate (or its CA) is trusted.
82
+
83
+
```python
84
+
import ssl
85
+
from fmd_api import FmdClient
86
+
87
+
# Export your server's certificate to PEM (e.g., server-cert.pem)
88
+
ctx = ssl.create_default_context()
89
+
ctx.verify_mode = ssl.CERT_REQUIRED
90
+
ctx.check_hostname =True# keep hostname verification when possible
0 commit comments