Hacker Newsnew | past | comments | ask | show | jobs | submit | cisco87's commentslogin

Mh interesting, I've wrote a while ago a script to start on connection in order to have mullvad coexist with tailscale, if anyone is interested, I also have one for NVPN

  DOMAINS=(login controlplane log derp1-all derp2-all derp3-all derp4-all derp5-all derp6-all derp7-all derp8-all derp9-all derp10-all derp11-all derp12-all derp13-all derp14-all derp15-all derp16-all derp17-all derp18-all derp19-all derp20-all derp21-all derp22-all derp23-all derp24-all)

  FWMARK=$(wg show $1 fwmark)

  for d in ${DOMAINS[@]}; do
    IPS=$(dig +answer -4 $d.tailscale.com +short)

    for IP in ${IPS[@]}; do
      iptables -I INPUT --in-interface tailscale0 -j MARK --set-mark $FWMARK
      iptables -I OUTPUT --out-interface tailscale0 -j MARK --set-mark $FWMARK

      iptables -I INPUT -d $IP/32 -j MARK --set-mark $FWMARK
      iptables -I INPUT -s $IP/32 -j MARK --set-mark $FWMARK 
      iptables -I OUTPUT -d $IP/32 -j MARK --set-mark $FWMARK
     done;

  done;

  iptables -I OUTPUT -d 100.100.100.100/32 -j MARK --set-mark $FWMARK
  iptables -I OUTPUT -s 100.100.100.100/32 -j MARK --set-mark $FWMARK
  iptables -I INPUT -d 100.100.100.100/32 -j MARK --set-mark $FWMARK
  iptables -I INPUT -s 100.100.100.100/32 -j MARK --set-mark $FWMARK


Side note: you can simplify the first line like this:

    DOMAINS=(login controlplane log derp{1..24}-all)


Thank you!


What is the $1 in `wg show $1` work and how/when do you run this script?


Ah yeah so $1 is the mullvad interface name, and you run it by placing it in the mullvad's wg conf file as

  PostUp = /path/to/script.sh %i


Code blocks are done on here by indenting with 2 spaces, not with ```


Ah nice thank you


Location: Amsterdam, The Netherlands

Remote: Yes

Willing to relocate: Yes, to Berlin or London.

Technologies: php, c#, rust, js, ts, objective-c/cocoatouch, docker, vagrant, puppet, ansible, linux, aws

Résumé/CV: https://mega.nz/file/YZhDVLBT#YiblTkskkliOTL6NE4DydBdBPLnQcq...

Email: hn [AT] francescoallara.it


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: