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 | ``` | |||
6b6617 | Hargata Softworks | 2024-10-08 14:33:39 | 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. |
5c5a0f | Hargata Softworks | 2024-01-29 03:14:33 | 23 | ``` |
24 | volumes: | |||
e9643b | Hargata Softworks | 2024-10-14 18:38:45 | 25 | - ./https/:/https:ro |
5c5a0f | Hargata Softworks | 2024-01-29 03:14:33 | 26 | ``` |
7ba7cd | Hargata Softworks | 2024-10-08 14:34:16 | 27 | 4. Check the port bindings to ensure that traffic is being forwarded to port 443 |
6b6617 | Hargata Softworks | 2024-10-08 14:33:39 | 28 | ``` |
29 | ports: | |||
30 | - 443:443 | |||
31 | ``` | |||
32 | 5. 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 | 33 | |
34 | ## Windows | |||
35 | 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) | |||
36 | ||||
37 | 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) | |||
38 | 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 | 39 | > [!NOTE] |
40 | > You can use the [LubeLogger Configurator](https://lubelogger.com/configure) | |||
9814e7 | Hargata Softworks | 2024-10-04 02:43:28 | 41 | > for this step |
5c5a0f | Hargata Softworks | 2024-01-29 03:14:33 | 42 | ``` |
43 | "Kestrel": { | |||
44 | "Endpoints": { | |||
45 | "Http": { | |||
46 | "Url": "http://localhost:80" | |||
47 | }, | |||
48 | "HttpsInlineCertFile": { | |||
49 | "Url": "https://localhost:443", | |||
50 | "Certificate": { | |||
51 | "Path": "<path to .pfx file>", | |||
52 | "Password": "bob" | |||
53 | } | |||
54 | } | |||
55 | } | |||
56 | ``` | |||
af42ad | Hargata Softworks | 2024-01-29 03:15:26 | 57 | 3. Restart the app and `https://localhost` will now have a valid cert. |