Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 29 lines (22 sloc) 536 Bytes
#!/usr/bin/perl
use strict;
use warnings;
# Runs in cron, sets routes to select sites to hack around the Juniper
# fail of not having a split VPN.
my @host = map { chomp; $_ } <DATA>;
if (on_vpn()) {
my $gateway = qx[netstat -r | grep ^vpn.booking.com | awk '{print \$2}'];
for my $host (@host) {
system "route -nv add $host $gateway";
}
} else {
for my $host (@host) {
system "route delete $host";
}
}
sub on_vpn {
system("netstat -rn | grep -q jnc0") == 0;
}
__DATA__
w.nix.is
github.com