2019-05-07 13:09:48 +02:00
|
|
|
# Privoxy TLS proxy wrapper
|
|
|
|
|
|
|
|
## How it works
|
|
|
|
|
2019-05-07 13:11:41 +02:00
|
|
|
|
|
|
|
+---------+ +-----------+ +----------------+
|
|
|
|
| | | | | |
|
|
|
|
| Browser +<---------HTTP--------->+ Privoxy +<---------HTTP--------->+ HTTP webserver |
|
|
|
|
| | | | | |
|
|
|
|
+----+----+ +---+---+---+ +----------------+
|
|
|
|
^ ^ ^
|
|
|
|
| | |
|
|
|
|
| +--------------------------------------------------+
|
|
|
|
| | | | |
|
|
|
|
| | +---------+ | | +--------+ | +-----------------+
|
|
|
|
| | | | | | | | | | |
|
|
|
|
+---HTTPS--->+ Front +<--HTTP*--+ +---HTTP-->+ Rear +<---HTTPS--->+ HTTPS webserver |
|
|
|
|
| | | | | | | |
|
|
|
|
| +---------+ +--------+ | +-----------------+
|
|
|
|
| |
|
|
|
|
+--------------------------------------------------+
|
|
|
|
|
|
|
|
Transparent MitM
|
|
|
|
|
|
|
|
* Tagged for forwarding
|
|
|
|
|
2019-06-19 19:28:12 +02:00
|
|
|
## Setup in NixOS
|
|
|
|
|
|
|
|
1. Import to the file ./service.nix in your configuration by adding:
|
|
|
|
```nix
|
|
|
|
imports = [
|
|
|
|
(fetchGit https://maxwell.ydns.eu/git/rnhmjoj/privoxy-tls + "/service.nix")
|
|
|
|
];
|
|
|
|
```
|
|
|
|
or, better, copy it locally.
|
|
|
|
|
|
|
|
2. Create a CA. For example with GnuTLS:
|
|
|
|
```
|
|
|
|
certtool --generate-privkey --outfile ca.key
|
|
|
|
certtool --generate-self-signed --load-privkey ca.key --outfile ca.crt
|
|
|
|
```
|
|
|
|
or use the tool ./cert.py provided
|
|
|
|
```
|
2019-09-18 21:58:17 +02:00
|
|
|
python src/cert.py -f output
|
2019-06-19 19:28:12 +02:00
|
|
|
```
|
2019-09-18 21:02:52 +02:00
|
|
|
In the latter the "output" file will contain both private key and certificate;
|
|
|
|
split the file and store them separately.
|
2019-06-19 19:28:12 +02:00
|
|
|
|
|
|
|
3. Configure the proxy with the option set `services.privoxy.tls-wrapper`, for example
|
|
|
|
```nix
|
|
|
|
services.privoxy.tls-wrapper = {
|
|
|
|
enable = true;
|
|
|
|
caCert = /path/to/ca.crt; # these won't be included in the store
|
|
|
|
caKey = /path/to/ca.key;
|
|
|
|
noVerify = [ "self-signed.example" ];
|
|
|
|
passthru = [ "localhost" "*.local" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
```
|
|
|
|
More options are available and documented in ./service.nix
|
|
|
|
|
|
|
|
### Notes
|
|
|
|
|
|
|
|
- The CA will be automatically installed in the system trust store but
|
|
|
|
applications may use their own store and won't trust it.
|
|
|
|
You will need to add the CA manually in that case.
|
|
|
|
|
2019-05-07 13:09:48 +02:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
|
|
The MIT License (MIT)
|
|
|
|
|
|
|
|
Copyright (c) 2015 wheever
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|