News for hackers. Stuff that matters.

Ask HN: How do you set up a virtual browser

When you need to do something on your computer that might be risky (like run a suspect executable) you can use a VM and feel comfortable safe in your ability to isolate it.

But how do you isolate your browser? There are so many cookies and identity bits in it that I want a bare-bones profile. It would be similar to the chrome-new command that someone posted previously, but it would let me pack in the non-identity parts of my experience:

- don't offer to save any passwords

- prompt for location on every download

- use the following ten search shortcuts

and maybe install an ad blocker (contains identiny information, but not much).

Is this possible short of using something like chrome-driver? Like can I create a temp profile, then a bash script to copy it to a new location every time I run the browser and use the blank copy?

Thanks in advance for any insight you might have.

( 8 comments | 5 points | on HN )
Re:Ask HN: How do you set up a virtual browser by hotdox on Sunday September 06, 2020 @04:33PM (#24394434)
I use next script. It creates temporarily dir for firefox, uses it as a profile dir and remove after firefox closed.

   #!/bin/sh -e
   DIR="${XDG_CACHE_HOME:-$HOME/.cache}"
   mkdir -p -- "$DIR"
   TEMP="$(mktemp -d -- "$DIR/firefox-XXXXXX")"
   trap "rm -rf -- '$TEMP'" INT TERM EXIT
   wget 'https://raw.githubusercontent.com/pyllyukko/user.js/master/user.js' -O "$TEMP/user.js"
   firefox -profile "$TEMP" -no-remote "$@"
It also uses very hardened options from https://github.com/pyllyukko/user.js

It is not my invention, but I lost a link to blog post

Re:Ask HN: How do you set up a virtual browser by hotdox on Sunday September 06, 2020 @04:37PM (#24394460)
Another alternative would be https://www.torproject.org/download/
Re:Ask HN: How do you set up a virtual browser by appleflaxen on Monday September 07, 2020 @04:49AM (#24397790)
this is awesome; thank you.
Re:Ask HN: How do you set up a virtual browser by yamrzou on Sunday September 06, 2020 @05:16PM (#24394745)
If security is your concern, you can run the browser inside a container: https://github.com/ConSol/docker-headless-vnc-container

You can also use: https://browsergap.dosyago.com/

There is also: https://firejail.wordpress.com/

Re:Ask HN: How do you set up a virtual browser by nickphx on Sunday September 06, 2020 @04:17PM (#24394330)
Re:Ask HN: How do you set up a virtual browser by gen3 on Sunday September 06, 2020 @04:18PM (#24394338)
Firefox has a bunch of setting like deleting cookies and history on close that can be configured. I find that hard to use as a daily driver. For me, Firefox containers and uBlock origin works well enough.

If you do want to do some auto config thing, I think it’s possible. Owasp ZAP has a button that auto configs a session with a whole bunch of features changed. It might be worth looking into how they do that. There is command line flags.

Re:Ask HN: How do you set up a virtual browser by gitgud on Monday September 07, 2020 @01:54AM (#24396934)
Is there a problem with "Incognito Mode"?

Modern browsers (Chromium and Firefox) are pretty well isolated as far as sand-boxing goes (compared to 15 years ago anyway).

But if you really want to avoid advanced finger-printing and tracking, then you really need to use a VPN or TOR. As sites can track your IP, OS, Browser, screen dimensions... etc

Re:Ask HN: How do you set up a virtual browser by appleflaxen on Monday September 07, 2020 @04:49AM (#24397783)
thanks for mentioning this. i don't really trust google on incognito mode. G will hide my identity from others, but it knows all my surfing habits, including anywhere I go with incognito.