Using certificates in Websocket MQTT Server
- Dominant language
- C#
- Stars
- 5.1k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe your question
I create .Net Blazor App that works as MQTT broker (TCP and WS). I host this App on Azure WebApp Service. Due to fact on WebApp i can use only port 80, only Web Sockets work. Broker working fine, but i lake to make connection secure by certificates, to allow connection only for client with valid certificate
in program.cs i add following
```
uilder.Services.AddHostedMqttServer(
optionsBuilder =>
{
optionsBuilder
.WithEncryptedEndpoint()
.WithEncryptedEndpointPort(80)
.WithEncryptionCertificate(CertificateManager.GetServerCertificateFromFile().Export(X509ContentType.Pfx))
.WithEncryptionSslProtocol(SslProtocols.Tls12)
.WithClientCertificate()
.Build();
});
builder.Services.AddMqttConnectionHandler();
builder.Services.AddConnections();
builder.Services.AddSingleton();
```
```
public static X509Certificate2 GetServerCertificateFromFile()
{
X509Certificate2 certificate = new X509Certificate2(serverCertName,"pk820405", X509KeyStorageFlags.Exportable);
return certificate;
}
```
but i can still connect with any client, and without TSL encryption (if i check ignore certificate error in client)
so, my question is:
1. How to properly secure broker when running on azure WebApp
2. How to properly secure broker when running on kestrel
3. Can i use certificates generated from OpenSSl
### Which project is your question related to?
- Server
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.