I have an ASP.NET Core 2.2 web app running on Ubuntu. The web app is served by Kestrel configured as an Ubuntu service, running as www-data
user.
The web app uses a PFX certificate for signing custom responses. So, obviously I need to give www-data
full read access to the PFX certificate+key pair. This seems not safe enough.
I like how nginx is doing it (I have nginx running as a reverse proxy for the web app). Nginx reads private keys and their passwords as root
user when nginx process is starting up, so it's possible to set the strictest permissions on the private key of my https cert+key pair, leaving only the public .crt part accessible to www-data
, and it works just fine.
I'm wondering if there is some way to achieve similar mechanism with the ASP.NET Core app, so I don't have to give read access to the PFX private key to www-data
user?