Blame
5c5a0f | Hargata Softworks | 2024-01-29 03:14:33 | 1 | # Set Up HTTPS |
2 | ||||
3 | LubeLogger runs on Kestrel, which is a cross-platform standalone web server provided by .NET | |||
4 | ||||
5 | If you're running LubeLogger behind a reverse proxy(i.e. NGINX), then this walkthrough does not apply to you since the SSL certs will be served up by NGINX instead of Kestrel. | |||
6 | ||||
7 | This article covers the step-by-step process to set up HTTPS for a LubeLogger instance. | |||
8 | ||||
9 | ## Docker | |||
10 | If you're running LubeLogger on a Docker instance, first read [this article by Microsoft](https://learn.microsoft.com/en-us/aspnet/core/security/docker-compose-https?view=aspnetcore-8.0) | |||
11 | ||||
12 | 1. Convert the .PEM / .CRT files into .PFX, read [this StackOverflow post](https://stackoverflow.com/questions/808669/convert-a-cert-pem-certificate-to-a-pfx-certificate) | |||
13 | 2. Open and modify the .env file and add the following lines(note that in this example I used bob as the password for the cert) | |||
15772e | Hargata Softworks | 2024-10-04 02:41:52 | 14 | > [!NOTE] |
15 | > You can use the [LubeLogger Configurator](https://lubelogger.com/configure) | |||
9814e7 | Hargata Softworks | 2024-10-04 02:43:28 | 16 | > for this step |
5c5a0f | Hargata Softworks | 2024-01-29 03:14:33 | 17 | ``` |
18 | ASPNETCORE_Kestrel__Certificates__Default__Password=bob | |||
19 | ASPNETCORE_Kestrel__Certificates__Default__Path=/https/<yourPFXCertificateName>.pfx | |||
20 | ASPNETCORE_URLS=https://+:443;http://+:80 | |||
21 | ``` | |||
22 | 3. Open and modify docker-compose.yml. You will need to bind a new volume to the Docker container so that Kestrel can access the certificate file. | |||
23 | ``` | |||
24 | volumes: | |||
25 | - ~/https/:/https:ro | |||
26 | ``` | |||
af42ad | Hargata Softworks | 2024-01-29 03:15:26 | 27 | 4. Run `docker-compose up -d` to start up the container and `https://localhost` will now have a valid cert. |
5c5a0f | Hargata Softworks | 2024-01-29 03:14:33 | 28 | |
29 | ## Windows | |||
30 | If you're running LubeLogger as the standalone Windows executable, first read [this article by Microsoft](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-8.0#configure-https-in-appsettingsjson) | |||
31 | ||||
32 | 1. Convert the .PEM / .CRT files into .PFX, read [this StackOverflow post](https://stackoverflow.com/questions/808669/convert-a-cert-pem-certificate-to-a-pfx-certificate) | |||
33 | 2. Open and modify appsettings.json located in the same directory as the CarCareTracker executable and add the following lines(note that in this example I used bob as the password for the cert) | |||
15772e | Hargata Softworks | 2024-10-04 02:41:52 | 34 | > [!NOTE] |
35 | > You can use the [LubeLogger Configurator](https://lubelogger.com/configure) | |||
9814e7 | Hargata Softworks | 2024-10-04 02:43:28 | 36 | > for this step |
5c5a0f | Hargata Softworks | 2024-01-29 03:14:33 | 37 | ``` |
38 | "Kestrel": { | |||
39 | "Endpoints": { | |||
40 | "Http": { | |||
41 | "Url": "http://localhost:80" | |||
42 | }, | |||
43 | "HttpsInlineCertFile": { | |||
44 | "Url": "https://localhost:443", | |||
45 | "Certificate": { | |||
46 | "Path": "<path to .pfx file>", | |||
47 | "Password": "bob" | |||
48 | } | |||
49 | } | |||
50 | } | |||
51 | ``` | |||
af42ad | Hargata Softworks | 2024-01-29 03:15:26 | 52 | 3. Restart the app and `https://localhost` will now have a valid cert. |