~sutek/+junk/setup-vps

« back to all changes in this revision

Viewing changes to setup/policies/54_vpn

  • Committer: sutek at evil
  • Date: 2012-09-16 09:53:45 UTC
  • Revision ID: sutek@evil.com-20120916095345-hvy4juzthg88njoo
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Install VPN setup
 
3
#
 
4
# On the client side, use 192.168.88.1:8118 as a proxy address,
 
5
# and have a persistent ssh session with DynamicForward 1080
 
6
#
 
7
if user_confirms_y Install VPN concentrator?; then
 
8
  if package_is_installed pptd; then
 
9
    echo VPN already installed
 
10
  else
 
11
    echo Installing VPN
 
12
    apt-get install pptpd privoxy
 
13
    cp $etc/ppp/pptpd-options /etc/ppp/pptpd-options
 
14
  
 
15
    # Configure privoxy to use ssh forwarding
 
16
    if [ z$vpn_proxy_domain == z ]; then
 
17
      echo No VPN proxy domain configuration required
 
18
    elif file_contains $vpn_proxy_domain /etc/privoxy/config; then
 
19
      echo privoxy config already set up
 
20
    else
 
21
      perl -pi~ -e 's{^listen-address .*}{
 
22
  listen-address :8118
 
23
  forward-socks5 *.$ENV{vpn_proxy_domain}/ 127.0.0.1:1080 .
 
24
  forward-socks5 *.*.$ENV{vpn_proxy_domain}/ 127.0.0.1:1080 .
 
25
  forward-socks5 *.*.*.$ENV{vpn_proxy_domain}/ 127.0.0.1:1080 .
 
26
  forward-socks5 *.*.*.*.$ENV{vpn_proxy_domain}/ 127.0.0.1:1080 .
 
27
  forward $ENV{vpn_proxy_domain}/ .
 
28
  }' /etc/privoxy/config
 
29
    fi
 
30
  
 
31
    # Fiddle privoxy so that video still works
 
32
    if file_contains 'Fix video' /etc/privoxy/user.action; then
 
33
      echo user.action already set up
 
34
    else
 
35
      (echo '# Fix video on iOS devices'
 
36
       echo '{+client-header-tagger{range-requests}}'
 
37
       echo '/'
 
38
       echo ''
 
39
       echo '{-filter -deanimate-gifs}'
 
40
       echo ' TAG:^RANGE-REQUEST$') >> /etc/privoxy/user.action
 
41
    fi
 
42
  fi
 
43
 
 
44
  echo :
 
45
  echo : Remember to initialize /etc/ppp/chap-secrets appropriately
 
46
  echo :
 
47
fi