Nacho's Tidbits
// posts

Fuck LaLiga or how I don't watch football

As you may know, whenever there’s a football match in Spain, LaLiga decides to force most ISP to block a set of IPs to avoid piracing their games.

Leaving aside the idiocity of whoever gave them the authority to do this and change the set of IPs to block based on their feelings… It happens to be that they decided to block CloudFlare nodes because some piracy sites use it… like you know… 90% of the internet?

All this makes that during football a lot of sites just don’t work, regardless if they are related to football at all. La Liga says this is a small % but somehow I can’t stop finding that small % in my daily usage.

On top of all that, I don’t even watch football and I don’t care about it, so I got tired and finally said Fuck LaLiga.

Setup

In order to skip the IPS IP blocking we will need a small machine outside of Spain to use a VPN proxy, I happen to have a small VPS in Hetzner for email sending, so I gave it a second job.

My router wilñl send the traffic through the VPN but I don’t want to send ALL my traffic, only those blocked IPs.

IPs sources

hayahora.futbol tracks blocked IPs and provides a JSON and a DNS server for knowing if an IP is affected.

This is a best-effort as not even the list of blocked IPs is published anywhere… not that people should care about this based on LaLiga…

VPN setup

Any VPN you like will make the work I went with Wireguard because I had experience with it and my router is capable of using tunnels with it.

1apt update && sudo apt install -y wireguard iptables
2sudo su
3cd /etc/wireguard
4umask 077
5wg genkey | tee server.key | wg pubkey > server.pub
6wg genkey | tee unifi.key  | wg pubkey > unifi.pub
7
8# get network iface
9ip route get 1.1.1.1 | awk '{print $5; exit}' # eth0

Create the config

 1cat > /etc/wireguard/wg0.conf <<EOF
 2[Interface]
 3Address = 10.66.66.1/24
 4ListenPort = 51820
 5PrivateKey = $(cat server.key)
 6PostUp   = iptables -t nat -A POSTROUTING -s 10.66.66.0/24 -o eth0 -j MASQUERADE; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -m state --state RELATED,ESTABLISHED -j ACCEPT
 7PostDown = iptables -t nat -D POSTROUTING -s 10.66.66.0/24 -o eth0 -j MASQUERADE; iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -m state --state RELATED,ESTABLISHED -j ACCEPT
 8
 9[Peer]
10# UniFi gateway
11PublicKey = $(cat unifi.pub)
12AllowedIPs = 10.66.66.2/32
13EOF

Start the server

1echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/99-wireguard.conf
2sysctl --system
3systemctl enable --now wg-quick@wg0

And enable OpenSSH in your firewall. Check your provider config too as you may have a top-level firewall in it.

1ufw allow OpenSSH
2ufw allow 51820/udp
3ufw enable

Create the client config, copy the result for later.

 1cat > /root/unifi-wg.conf <<EOF
 2[Interface]
 3PrivateKey = $(cat /etc/wireguard/unifi.key)
 4Address = 10.66.66.2/32
 5DNS = 1.1.1.1
 6
 7[Peer]
 8PublicKey = $(cat /etc/wireguard/server.pub)
 9Endpoint = $(curl -4 -s ifconfig.me):51820
10AllowedIPs = 0.0.0.0/0
11PersistentKeepalive = 25
12EOF

Baseline test

Run one IP that you have blocked with nc -vz -w 5 $IP 443. Run it on the server and your PC it should fail in your PC only. Test again after to verify routing works.

Client

Here, you could use any client in your PC, in my case I wanted this in my router directly. I use Unifi Gateways here.

Go to Settings > VPN > VPN CLIENT > New VPN, choose WireGuard and upload the above file.

In your remote server run wg show and you should see latest handshake and the transfer field go up slowly.

Routing policy

Go to Settings > Policy Table > Create New Policy > Route add the interface you created before, your PC as source and the test IP. Disable killswitch so if the tunnel ever goes down your network keeps working.

Try the nc command again and everything should work. Remember to apply it for all devices you want to be affected or all of them.

Automation

From this point forward you can update the list of 300 something IPs by hand and hope doesn’t change much over time…

Or you could, and probly should, automate it.

If you are with me on the Unifi setup, then I built noveofutbol a small rust automation to update the list provided by hayahora.futbol.

I deployed this on my docker lxc and done… Any IP added to the list will be routed through the VPN and once is empty the VPN will not be used.

Happy wife, happy life and fuck la liga or something like that.