Restricting a qube to selected websites revisions

Go back to topic: Restricting a qube to selected websites

  1. v11 anchor; v11 full version
  2. v10 anchor; v10 full version
  3. v9 anchor; v9 full version
  4. v8 anchor; v8 full version
  5. v7 anchor; v7 full version
  6. v6 anchor; v6 full version
  7. v5 anchor; v5 full version
  8. v4 anchor; v4 full version
  9. v3 anchor; v3 full version
  10. v2 anchor; v2 full version

Revision #11

Edited on
2023-09-07
Edited by user
deeplow

Revision #10

Edited on
2021-10-10
Edited by user
fsflover

Revision #9

Edited on
2021-03-12
Edited by user
deeplow

Revision #8

Edited on
2021-03-12
Edited by user
Rooftop
The following is a description of **one** way to setup a Qube with restricted website access using only software that is already installed in Qubes OS. Create a qube based on template:fedora-32, lets call it **my-proxy**. Set its networking to **sys-firewall**. Create a qube based on template:fedora-32, lets call it **my-qube**. Set its networking to **none**. Start a terminal in **my-proxy** and run the following commands: The following is a description of *one* way to setup a qube with restricted website access using only software that is already installed in Qubes OS. Create a qube based on template:fedora-32 or fedora-33, lets call it **my-proxy**. Set its networking to **sys-firewall**. ![Screenshot_2021-03-12_16-46-28|624x328](upload://a9BobSbJ88PCmRBlRBOmg5opcci.png) Open **Qube Settings** for **my-proxy** and in the **Services** tab, add an entry for `tinyproxy` (enter tinyproxy in the text field and click the plus button). ![Screenshot_2021-03-12_16-47-19|605x500](upload://laY34n6USSz1QWYP2V3qM9ckAwv.png) Create a qube based on template:fedora-32 or fedora-33, lets call it **my-qube**. Set its networking to **none**. ![Screenshot_2021-03-12_16-47-55|624x328](upload://68UAyK6bxXRdAkTWlC7EvFW3L7l.png) First we need to make sure changes to the tinyproxy configuration files are preserved between reboots of **my-proxy**. Start a terminal in **my-proxy** and run the following command:
sudo mkdir -p /rw/config/tinyproxy sudo cp /etc/tinyproxy/tinyproxy.conf /rw/config/tinyproxy/tinyproxy.conf sudo mkdir -p /rw/config/qubes-bind-dirs.d
Edit **/rw/config/tinyproxy/tinyproxy.conf** and uncomment the following lines: Create the file **/rw/config/qubes-bind-dirs.d/50_user.conf** with the following contents:
binds+=( '/etc/tinyproxy' ) ``` Restart the **my-proxy** qube so the changes take effect. Edit **/etc/tinyproxy/tinyproxy.conf** and uncomment the following lines: ```
Create the file **/rw/config/tinyproxy/filter** and add all hostnames that should be allowed (note that these are regular expressions). Create the file **/etc/tinyproxy/filter** and add all host names that should be allowed (note that these are regular expressions).
Run the following command, otherwise tinyproxy will not start: `sudo touch /var/run/qubes-service/tinyproxy` Edit the file **/rw/config/rc.local** and add the following lines at the end of the file to replace the default tinyproxy configuration with our custom configuration and then start tinyproxy when the my-proxy VM is started: Edit the file **/rw/config/rc.local** and add the following line at the end of the file to start tinyproxy when the **my-proxy** qube is started:
rm -rf /etc/tinyproxy ln -s /rw/config/tinyproxy /etc/tinyproxy
In **dom0**, add the following to **/etc/qubes-rpc/policy/qubes.ConnectTCP**: In **dom0**, create the file **/etc/qubes-rpc/policy/qubes.ConnectTCP+8888** with the following contents (this will allow **my-qube** to connect to port 8888 of **my-proxy**):
In **my-qube**, edit **/rw/config/rc.local** to add the following line which will create a link between port 8888 in my-qube and port 8888 in my-proxy (port 8888 is the default port used by tinyproxy): In **my-qube**, edit **/rw/config/rc.local** to add the following line which will create a link between port 8888 in **my-qube** and port 8888 in **my-proxy** (port 8888 being the default port used by tinyproxy):
2. I'm relatively new to Qubes OS, so I welcome any suggestions/improvements/explanations of why this is a bad idea. 3. Attemping to access a blocked **https** site will result in "The proxy server is refusing connections" error - this is the expected hehaviour.` 2. Attemping to access a blocked **https** site will result in "The proxy server is refusing connections" error - this is the expected hehaviour.`

Revision #7

Edited on
2021-03-09
Edited by user
deeplow

Revision #6

Edited on
2021-01-31
Edited by user
Rooftop
rm -f /etc/tinyproxy rm -rf /etc/tinyproxy

Revision #5

Edited on
2021-01-28
Edited by user
Rooftop
Also check the tinyproxy log file at **/var/log/tinyproxy/tinyproxy.log** If tinyproxy is not running, check that **/var/run/qubes-service/tinyproxy** exists. Also check the tinyproxy log file at **/var/log/tinyproxy/tinyproxy.log** for any error messages.
3. In **my-qube**, check that the proxy has been set in Firefox.3. In **my-qube**, check that the HTTP/HTTPS proxy has been set in Firefox.

Revision #4

Edited on
2021-01-26
Edited by user
Rooftop
2. I'm relatively new to Qubes OS, so I welcome any suggestions/improvements/explanations of why this is a bad idea.2. I'm relatively new to Qubes OS, so I welcome any suggestions/improvements/explanations of why this is a bad idea. 3. Attemping to access a blocked **https** site will result in "The proxy server is refusing connections" error - this is the expected hehaviour.` **Troubleshooting** 1. In **my-proxy**, check that tinyproxy is running: `sudo systemctl status tinyproxy` Also check the tinyproxy log file at **/var/log/tinyproxy/tinyproxy.log** 2. In **my-qube**, run the following: `qvm-connect-tcp ::8888` You should get an "Address is already in use" error. 3. In **my-qube**, check that the proxy has been set in Firefox.

Revision #3

Edited on
2021-01-26
Edited by user
Rooftop
Edit **/rc/config/tinyproxy/tinyproxy.conf** and uncomment the following lines: Edit **/rw/config/tinyproxy/tinyproxy.conf** and uncomment the following lines:
Create the file **/rc/config/tinyproxy/filter** and add all hostnames that should be allowed (note that these are regular expressions). Create the file **/rw/config/tinyproxy/filter** and add all hostnames that should be allowed (note that these are regular expressions).

Revision #2

Edited on
2021-01-26
Edited by user
Rooftop
A common requirement seems to be the ability to restrict a Qubes access to a certain subset of websites; something that is difficult to achieve using the firewall rules due to multi-hosted websites/CDN's etc. A common requirement seems to be the ability to restrict a qube's access to a certain subset of websites; something that is difficult to achieve using the firewall rules due to multi-hosted websites/CDN's etc.