nlevitt / monie

man-in-the-middle http/https proxy library in rust
MIT License
32 stars 10 forks source link

Add env variables for custom certificate and key #4

Open sverch opened 5 years ago

sverch commented 5 years ago

MONIE_KEY_FILE and MONIE_CERT_FILE can be used to control what certificate is served up by this server.

Taken mostly from https://github.com/ctz/hyper-rustls/blob/master/examples/server.rs.

shirshak55 commented 4 years ago

@sverch will this be useful because you are not using authority meaning it will be valid for only 1 authority. As it is mitm proxy i suppose it can mitm many other domains?

sverch commented 4 years ago

@shirshak55 My main use case here was being able to trust the certificate served up by this proxy on my system, because I wanted to man in the middle but I didn't want to figure out how to get each client application to trust it. Since it creates a self signed certificate on demand I couldn't figure out how to trust it without this change.

You're right that this does limit the domains the certificate will be valid for. Ideally I'd like to have a CA certificate I can trust that this proxy uses to generate certificates, but that seems more involved.