Guest User

Untitled

a guest
Oct 29th, 2017
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. # Automatically generated configuration
  2. daemon
  3. client
  4. dev tun11
  5. proto udp
  6. remote nl.privateinternetaccess.com 1198
  7. resolv-retry 30
  8. nobind
  9. persist-key
  10. persist-tun
  11. comp-lzo adaptive
  12. ncp-ciphers AES-128-GCM:AES-256-GCM:AES-128-CBC:AES-256-CBC
  13. cipher AES-128-CBC
  14. redirect-gateway def1
  15. verb 3
  16. script-security 2
  17. up updown.sh
  18. down updown.sh
  19. ca ca.crt
  20. status-version 2
  21. status status
  22.  
  23. # Custom Configuration
  24. syslog [progname]
  25. persist-key
  26. persist-tun
  27. tls-client
  28. auth-user-pass /tmp/password.txt
  29. comp-lzo
  30. verb 3
  31. reneg-sec 0
  32. ipchange "/etc/openvpn/test.sh"
  33. script-security 3
  34.  
  35. #!/opt/bin/bash
  36. #
  37. # Enable port forwarding when using Private Internet Access
  38. #
  39. # Usage:
  40. # ./port_forwarding.sh
  41. set -x
  42. exec 5>/etc/openvpn/mylog
  43. BASH_XTRACEFD="5"
  44. PS4='$LINENO: '
  45.  
  46. TRANSUSER=me
  47. TRANSPASS=mypass
  48. TRANSHOST=192.168.1.251
  49.  
  50. client_id_file="/etc/openvpn/pia_client_id"
  51. if [ ! -f "$client_id_file" ]; then
  52. if hash /opt/bin/shasum 2>/dev/null; then
  53. /usr/bin/head -n 100 /dev/urandom | /opt/bin/shasum -a 256 | tr -d " -" > "$client_id_file"
  54. elif hash /opt/bin/sha256sum 2>/dev/null; then
  55. /usr/bin/head -n 100 /dev/urandom | /opt/bin/sha256sum | tr -d " -" > "$client_id_file"
  56. else
  57. /bin/echo "Please install shasum or sha256sum, and make sure it is visible in your $PATH"
  58. exit 1
  59. fi
  60. fi
  61. client_id=`/bin/cat "$client_id_file"`
  62. json=`/opt/bin/curl "http://209.222.18.222:2000/?client_id=$client_id" 2>/dev/null`
  63. if [ "$json" == "" ]; then
  64. json='Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding'
  65. fi
  66.  
  67. /bin/echo server returned message: $json
  68.  
  69. #trim VPN forwarded port from JSON
  70. PORT=$(echo $json | /usr/bin/awk 'BEGIN{r=1;FS="[{}":]+"} /port/{r=0; print $3} END{exit r}')
  71. /bin/echo if successful port is:$PORT
  72.  
  73. #change transmission port on the fly
  74.  
  75. /opt/bin/transmission-remote $TRANSHOST --auth $TRANSUSER:$TRANSPASS -p "$PORT"
  76. /bin/echo your transmission details: $TRANSHOST $TRANSUSER $TRANSPASS
  77.  
  78. + PS4='$LINENO: '
  79. 12: TRANSUSER=me
  80. 13: TRANSPASS=pass
  81. 14: TRANSHOST=192.168.1.251
  82. 16: client_id_file=/etc/openvpn/pia_client_id
  83. 17: '[' '!' -f /etc/openvpn/pia_client_id ']'
  84. 227: /bin/cat /etc/openvpn/pia_client_id
  85. 27: client_id=080db0a6e936918d405683447a78bf426273e9a1ea2ecce744722ac3241d4232
  86. 228: /opt/bin/curl 'http://209.222.18.222:2000/?client_id=080db0a6e936918d405683447a78bf426273e9a1ea2ecce744722ac3241d4232'
  87. 28: json=
  88. 29: '[' '' == '' ']'
  89. 30: json='Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding'
  90. 33: /bin/echo server returned message: Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding
  91. 336: echo Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding
  92. 336: /usr/bin/awk 'BEGIN{r=1;FS="[{}":]+"} /port/{r=0; print $3} END{exit r}'
  93. 36: PORT=
  94. 37: /bin/echo if successful port is:
  95. 41: /opt/bin/transmission-remote 192.168.1.251 --auth me:pass -p ''
  96. 42: /bin/echo your transmission details: 192.168.1.251 me pass
  97.  
  98. 16: client_id_file=/etc/openvpn/pia_client_id
  99. 17: '[' '!' -f /etc/openvpn/pia_client_id ']'
  100. 227: /bin/cat /etc/openvpn/pia_client_id
  101. 27: client_id=080db0a6e936918d405683447a78bf426273e9a1ea2ecce744722ac3241d4232
  102. 228: /opt/bin/curl 'http://209.222.18.222:2000/?client_id=080db0a6e936918d405683447a78bf426273e9a1ea2ecce744722ac3241d4232'
  103. 28: json='{"port":44257}'
  104. 29: '[' '{"port":44257}' == '' ']'
  105. 33: /bin/echo server returned message: '{"port":44257}'
  106. 336: echo '{"port":44257}'
  107. 336: /usr/bin/awk 'BEGIN{r=1;FS="[{}":]+"} /port/{r=0; print $3} END{exit r}'
  108. 36: PORT=44257
  109. 37: /bin/echo if successful port is:44257
Add Comment
Please, Sign In to add comment