Monthly Archives: February 2020

howto Setup server shadowsocks + v2ray plugin


# Using v2ray+ws+tls+CDN works good, but it kills the battery on android phone.
# For this reason, good to know how to setup shadowsocks + v2ray plugin.

#
# This post shows you how to setup the server.
# We make a unique path, so you can still have regular v2ray on another path.
#
# You need VPS server ubuntu 18.04 or 16.04, we used digitalocean for example
# You need a domain name, either free or cheap 1 $ year (for 1st year, e.g. godaddy)
# You need an account at cloudflare
#
# We will route shadowsocks traffic over TLS https, via cloudflare CDN
# This means the Chinese cannot know your actual server IP, all they
# see a domainname, and a website, which should be boring and very long make them read it all.
# The Chinese cannot block your server IP, and cannot launch a DDOS attack.
#
# A few things you should change and make random.
# 1) the path , below we used abc123. use something random
# 2) shadowsocks password, below we used pass1234, use something random
#
# Ok lets get started.
# Create droplet on digitalocean
# get your IP e.g. 167.71.130.183
#
# In cloudflare
# point your domain to IP
# IMPORTANT turn off all encryption to example.com
# later we will turn it on again after we have https certs
#
# login to digitalocean droplet
#
#
apt-get update
apt-get upgrade -y
apt-get install nginx python-certbot-nginx -y
# Test you can access http://example.com by http (not https)
# Set the server_name and add reverse proxy
nano /etc/nginx/sites-available/default
# Change from
# server_name _;
# to
server_name example.com;
location /abc123 {
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}
# Reload data
nginx -s reload
# Add https
# remember press 2 for redirect, the rest doesn't really matter.
certbot --nginx
# IMPORTANT afterwards switch back cloudflare, turn on full encryption
# verify https is working https://example.com
# add plugin
wget --no-check-certificate https://tls.mbed.org/download/mbedtls-2.16.4-gpl.tgz

wget https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-2.16.5.tar.gz
gunzip mbedtls-2.16.5.tar.gz
tar -xvf mbedtls-2.16.5.tar
cp -rf mbedtls-mbedtls-2.16.5/ mbedtls-2.16.5/

wget https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-2.16.5.tar.gz
cp mbedtls-2.16.5.tar.gz mbedtls-2.16.5.gtz

./ubuntu-ss-install.sh
Congratulations, Shadowsocks-libev server install completed
Your Server IP : example.com
Your Server Port : 443
Your Password : pass1234
Your Encryption Method: aes-256-gcm
Your Plugin : v2ray-plugin
Your Plugin options : tls;host=example.com
Enjoy it!
# backup of install script, just for reference, incaseĀ 
# github version disappears https://pastebin.com/38UjgNNd
# edit config file, to move the shadowsocks server to 10001 (or whatever internal port you like)
# and change the plugin_opts
nano /etc/shadowsocks-libev/config.json
{
"server":"0.0.0.0",
"server_port":10001,
"password":"pass1234",
"timeout":300,
"method":"aes-256-gcm",
"plugin":"v2ray-plugin",
"plugin_opts":"server;path=/abc123;loglevel=none"
}
# restart shadowsocks server
systemctl restart shadowsocks
systemctl status shadowsocks
# That is it, it works in China.
# And using the shadowsocks app with v2ray plugin, saves the battery.
# Screenshots phone
#
# To configure shadowsocks + v2ray plugin for windows client
# Download v2ray plugin for windows
# https://github.com/shadowsocks/v2ray-plugin/releases
# e.g. v2ray-plugin_windows_386.exe
#
# Open shadowsocks for windows
# Plugin Program C:..path.../v2ray-plugin_windows_386.exe
# Plugin Options path=/abc123;host=example.com;tls
#
comments/help welcome

Build scrambled openvpn (2.4.8) linux deb packages for VPS using sbuild


# Build scrambled openvpn deb packages
# Based on https://github.com/mattock/sbuild_wrapper
# and https://wiki.debian.org/sbuild
# scramble xor patch
# https://github.com/Tunnelblick/Tunnelblick/tree/master/third_party/sources/openvpn
# https://github.com/clayface/openvpn_xorpatch

# Built on a digitalocean VPS
# 1GB Memory / 25 GB Disk / - Ubuntu 18.04.03 (LTS) x64
#
#
################################################################
# Quick install already patched openvpn deb package for Ubuntu 18.04 64-bit

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/b26orwsjtdfxtx5/openvpn_2.4.8-bionic0_amd64.deb
dpkg -i openvpn_2.4.8-bionic0_amd64.deb
################################################################
# Quick install already patched openvpn deb package for Ubuntu 18.04 32-bit

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/94j5pgju85bko7l/openvpn_2.4.8-bionic0_i386.deb
dpkg -i openvpn_2.4.8-bionic0_i386.deb
##########################################################################
# Quick install patched openvpn deb package for Ubuntu 16.04 64-bit

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/trf3md9yxv4oil3/openvpn_2.4.8-xenial0_amd64.deb
dpkg -i openvpn_2.4.8-xenial0_amd64.deb
systemctl start openvpn@server.service # error code until server.conf exists #
##########################################################################
# Quick install patched openvpn deb package for Ubuntu 16.04 32-bit

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/xo108q20q51i112/openvpn_2.4.8-xenial0_i386.deb
dpkg -i openvpn_2.4.8-xenial0_i386.deb
systemctl start openvpn@server.service # error code until server.conf exists #
##########################################################################
# Quick install patched openvpn deb package for Ubuntu 14.04 64-bit Minimal

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/jcj8qa5jwd9g7vu/openvpn_2.4.8-trusty0_amd64.deb
dpkg -i openvpn_2.4.8-trusty0_amd64.deb
##########################################################################
# Quick install patched openvpn deb package for Ubuntu 14.04 32-bit Minimal

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/exs1cige1mnec7z/openvpn_2.4.8-trusty0_i386.deb
dpkg -i openvpn_2.4.8-trusty0_i386.deb
##########################################################################
# Quick install patched openvpn deb package for Debian 10 64-bit Minimal

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/k67bsennhk8uq6m/openvpn_2.4.8-buster0_amd64.deb
dpkg -i openvpn_2.4.8-buster0_amd64.deb
##########################################################################
# Quick install patched openvpn deb package for Debian 10 32-bit Minimal

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/jcjar37dflytlfo/openvpn_2.4.8-buster0_i386.deb
dpkg -i openvpn_2.4.8-buster0_i386.deb
##########################################################################
# Quick install patched openvpn deb package for Debian 9 64-bit Minimal

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/2xlgfziyb2v98b8/openvpn_2.4.8-stretch0_amd64.deb
dpkg -i openvpn_2.4.8-stretch0_amd64.deb
##########################################################################
# Quick install patched openvpn deb package for Debian 9 32-bit Minimal

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/3ql86bqc7frc39d/openvpn_2.4.8-stretch0_i386.deb
dpkg -i openvpn_2.4.8-stretch0_i386.deb
##########################################################################

# This is how I did it from the start
# it's so I can remember for the next time

apt-get update && apt-get install gcc rng-tools make automake autoconf dh-autoreconf file patch perl dh-make debhelper devscripts gnupg lintian quilt libtool pkg-config libssl-dev liblzo2-dev libpam0g-dev libpkcs11-helper1-dev openssl sbuild git dh-systemd systemd -y

# Open a second separate shell just for the following rngd command
apt-get install rng-tools
rngd -f -r /dev/urandom

# Install
git clone https://github.com/mattock/sbuild_wrapper.git
cd sbuild_wrapper
scripts/setup.sh
sbuild-update --keygen
scripts/setup_chroots.sh
sbuild-adduser $LOGNAME
cp /usr/share/doc/sbuild/examples/example.sbuildrc $HOME/.sbuildrc
schroot -l|grep sbuild|grep source
scripts/update-all.sh

# EDIT as of 11/6/2023 the variants.conf needs to be edited to remove stretch

# Fetch the scramble Openvpn Patch

cd $HOME
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.8/patches/02-tunnelblick-openvpn_xorpatch-a.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.8/patches/03-tunnelblick-openvpn_xorpatch-b.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.8/patches/04-tunnelblick-openvpn_xorpatch-c.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.8/patches/05-tunnelblick-openvpn_xorpatch-d.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.8/patches/06-tunnelblick-openvpn_xorpatch-e.diff

cd $HOME/sbuild_wrapper/packaging/bionic/
QUILT_PATCHES=debian/patches quilt import $HOME/02-tunnelblick-openvpn_xorpatch-a.diff
QUILT_PATCHES=debian/patches quilt import $HOME/03-tunnelblick-openvpn_xorpatch-b.diff
QUILT_PATCHES=debian/patches quilt import $HOME/04-tunnelblick-openvpn_xorpatch-c.diff
QUILT_PATCHES=debian/patches quilt import $HOME/05-tunnelblick-openvpn_xorpatch-d.diff
QUILT_PATCHES=debian/patches quilt import $HOME/06-tunnelblick-openvpn_xorpatch-e.diff

cd $HOME/sbuild_wrapper/packaging/buster/
QUILT_PATCHES=debian/patches quilt import $HOME/02-tunnelblick-openvpn_xorpatch-a.diff
QUILT_PATCHES=debian/patches quilt import $HOME/03-tunnelblick-openvpn_xorpatch-b.diff
QUILT_PATCHES=debian/patches quilt import $HOME/04-tunnelblick-openvpn_xorpatch-c.diff
QUILT_PATCHES=debian/patches quilt import $HOME/05-tunnelblick-openvpn_xorpatch-d.diff
QUILT_PATCHES=debian/patches quilt import $HOME/06-tunnelblick-openvpn_xorpatch-e.diff

cd $HOME/sbuild_wrapper/packaging/jessie/
QUILT_PATCHES=debian/patches quilt import $HOME/02-tunnelblick-openvpn_xorpatch-a.diff
QUILT_PATCHES=debian/patches quilt import $HOME/03-tunnelblick-openvpn_xorpatch-b.diff
QUILT_PATCHES=debian/patches quilt import $HOME/04-tunnelblick-openvpn_xorpatch-c.diff
QUILT_PATCHES=debian/patches quilt import $HOME/05-tunnelblick-openvpn_xorpatch-d.diff
QUILT_PATCHES=debian/patches quilt import $HOME/06-tunnelblick-openvpn_xorpatch-e.diff

cd $HOME/sbuild_wrapper/packaging/stretch/
QUILT_PATCHES=debian/patches quilt import $HOME/02-tunnelblick-openvpn_xorpatch-a.diff
QUILT_PATCHES=debian/patches quilt import $HOME/03-tunnelblick-openvpn_xorpatch-b.diff
QUILT_PATCHES=debian/patches quilt import $HOME/04-tunnelblick-openvpn_xorpatch-c.diff
QUILT_PATCHES=debian/patches quilt import $HOME/05-tunnelblick-openvpn_xorpatch-d.diff
QUILT_PATCHES=debian/patches quilt import $HOME/06-tunnelblick-openvpn_xorpatch-e.diff

cd $HOME/sbuild_wrapper/packaging/trusty/
QUILT_PATCHES=debian/patches quilt import $HOME/02-tunnelblick-openvpn_xorpatch-a.diff
QUILT_PATCHES=debian/patches quilt import $HOME/03-tunnelblick-openvpn_xorpatch-b.diff
QUILT_PATCHES=debian/patches quilt import $HOME/04-tunnelblick-openvpn_xorpatch-c.diff
QUILT_PATCHES=debian/patches quilt import $HOME/05-tunnelblick-openvpn_xorpatch-d.diff
QUILT_PATCHES=debian/patches quilt import $HOME/06-tunnelblick-openvpn_xorpatch-e.diff

cd $HOME/sbuild_wrapper/packaging/xenial/
QUILT_PATCHES=debian/patches quilt import $HOME/02-tunnelblick-openvpn_xorpatch-a.diff
QUILT_PATCHES=debian/patches quilt import $HOME/03-tunnelblick-openvpn_xorpatch-b.diff
QUILT_PATCHES=debian/patches quilt import $HOME/04-tunnelblick-openvpn_xorpatch-c.diff
QUILT_PATCHES=debian/patches quilt import $HOME/05-tunnelblick-openvpn_xorpatch-d.diff
QUILT_PATCHES=debian/patches quilt import $HOME/06-tunnelblick-openvpn_xorpatch-e.diff

# Prepare
cd $HOME/sbuild_wrapper/
scripts/prepare-all.sh
ls build/*/

# Now lets build it
scripts/build-all.sh

# Check output
ls ./output/*

# ./output/openvpn_2.4.8-bionic0_amd64.deb
# ./output/openvpn_2.4.8-bionic0_i386.deb
# ./output/openvpn_2.4.8-buster0_amd64.deb
# ./output/openvpn_2.4.8-buster0_i386.deb
# ./output/openvpn_2.4.8-stretch0_amd64.deb
# ./output/openvpn_2.4.8-stretch0_i386.deb
# ./output/openvpn_2.4.8-trusty0_amd64.deb
# ./output/openvpn_2.4.8-trusty0_i386.deb
# ./output/openvpn_2.4.8-xenial0_amd64.deb
# ./output/openvpn_2.4.8-xenial0_i386.deb

# Do a Checksum

./output/sha256sum *

d3b6c66b2973786b2c3e8f0f202d27aec0a9aa4725e96aea8b731f51738760f5 openvpn_2.4.8-bionic0_amd64.deb
5aad3923bf36e700ea52065439dc632825489c902a212033e0de3f9e34ec3941 openvpn_2.4.8-bionic0_i386.deb
5909c2be843dbc3489dfe94ced0f088faef484d89fc1f035b22ba78831651cb7 openvpn_2.4.8-buster0_amd64.deb
2597289c7f33310e8be734e294fbc7efb444e2b13cc7861afa5d66b0e4ea3912 openvpn_2.4.8-buster0_i386.deb
5f9ba47ae022772cbb119add0b8053a114f06ee145e78d9817a1e351ed27c301 openvpn_2.4.8-stretch0_amd64.deb
f9476998e4c055cab5c31094013f5f38d898012d130ab856b1b53f7fc2e9ee97 openvpn_2.4.8-stretch0_i386.deb
7433368850cb1854b8aa673370edee4517e73e87771c3ab8b42f8e2b98ca2e83 openvpn_2.4.8-trusty0_amd64.deb
48458f36a5d02b266163d5581ba9ff033c1efec673a4ce73c0324558d9f615b8 openvpn_2.4.8-trusty0_i386.deb
73a349d17c17ef0ed91ea183d91d39bac216baed6e53df14a8b9e7dff24e11ba openvpn_2.4.8-xenial0_amd64.deb
a917c64a7ca782dba352d70d223d1030160ffc0fec8aeda26e85529e7e78fa32 openvpn_2.4.8-xenial0_i386.deb

sha256sum * > checksum.log

# Dropbox links 2.4.8 Partial tested, leave comment if prob
https://www.dropbox.com/s/ld51c1rtwewux3o/checksum.log?dl=0
https://www.dropbox.com/s/b26orwsjtdfxtx5/openvpn_2.4.8-bionic0_amd64.deb
https://www.dropbox.com/s/94j5pgju85bko7l/openvpn_2.4.8-bionic0_i386.deb
https://www.dropbox.com/s/trf3md9yxv4oil3/openvpn_2.4.8-xenial0_amd64.deb
https://www.dropbox.com/s/xo108q20q51i112/openvpn_2.4.8-xenial0_i386.deb
https://www.dropbox.com/s/k67bsennhk8uq6m/openvpn_2.4.8-buster0_amd64.deb
https://www.dropbox.com/s/jcjar37dflytlfo/openvpn_2.4.8-buster0_i386.deb
https://www.dropbox.com/s/2xlgfziyb2v98b8/openvpn_2.4.8-stretch0_amd64.deb
https://www.dropbox.com/s/3ql86bqc7frc39d/openvpn_2.4.8-stretch0_i386.deb
https://www.dropbox.com/s/jcj8qa5jwd9g7vu/openvpn_2.4.8-trusty0_amd64.deb
https://www.dropbox.com/s/exs1cige1mnec7z/openvpn_2.4.8-trusty0_i386.deb

# Dropbox links 2.4.4
https://www.dropbox.com/s/rb7qc8byj7vx1ht/checksum_2.4.4.log?dl=0
https://www.dropbox.com/s/vv78fc6z24q9tsh/openvpn_2.4.4-jessie0_amd64.deb?dl=0
https://www.dropbox.com/s/2ezudrsjhauh9ey/openvpn_2.4.4-jessie0_i386.deb?dl=0
https://www.dropbox.com/s/a362uhjqppy58ar/openvpn_2.4.4-precise0_amd64.deb?dl=0
https://www.dropbox.com/s/gr662xxtem3u7s2/openvpn_2.4.4-precise0_i386.deb?dl=0
https://www.dropbox.com/s/seihrxs5osd0wnx/openvpn_2.4.4-trusty0_amd64.deb?dl=0
https://www.dropbox.com/s/opdgst9jpuw5qyk/openvpn_2.4.4-trusty0_i386.deb?dl=0
https://www.dropbox.com/s/fwgg53c0inqfaya/openvpn_2.4.4-wheezy0_amd64.deb?dl=0
https://www.dropbox.com/s/34ce6rkdei2xpg1/openvpn_2.4.4-wheezy0_i386.deb?dl=0
https://www.dropbox.com/s/peuvr57kamtl4u0/openvpn_2.4.4-xenial0_amd64.deb?dl=0
https://www.dropbox.com/s/5fz1rqpmio6s23a/openvpn_2.4.4-xenial0_i386.deb?dl=0

# Dropbox links 2.4.1
https://www.dropbox.com/s/8vmzoit47x278wr/openvpn_2.4.1-jessie0_amd64.deb?dl=0
https://www.dropbox.com/s/is9bvmnks5v410r/openvpn_2.4.1-jessie0_i386.deb?dl=0
https://www.dropbox.com/s/63fefoexhgiqq3i/openvpn_2.4.1-precise0_amd64.deb?dl=0
https://www.dropbox.com/s/ur4ff0h6v0sc9mm/openvpn_2.4.1-precise0_i386.deb?dl=0
https://www.dropbox.com/s/qijxlwrb58jr8rr/openvpn_2.4.1-trusty0_amd64.deb?dl=0
https://www.dropbox.com/s/t0aq1d1brsc5ly4/openvpn_2.4.1-trusty0_i386.deb?dl=0
https://www.dropbox.com/s/k6g9xn605kv49eo/openvpn_2.4.1-wheezy0_amd64.deb?dl=0
https://www.dropbox.com/s/y9p0sgjtgsymzxj/openvpn_2.4.1-wheezy0_i386.deb?dl=0
https://www.dropbox.com/s/aoysxwzzk31wvu6/openvpn_2.4.1-xenial0_amd64.deb?dl=0
https://www.dropbox.com/s/doe8mdkkev8jblr/openvpn_2.4.1-xenial0_i386.deb?dl=0

# Dropbox links 2.3.14 all tested working
https://www.dropbox.com/s/8yxsrm7eh4rwbyk/openvpn_2.3.14-jessie0_amd64.deb?dl=0
https://www.dropbox.com/s/6ly8ek2gdirkcmy/openvpn_2.3.14-jessie0_i386.deb?dl=0
https://www.dropbox.com/s/tyij9ysouhqyze7/openvpn_2.3.14-trusty0_amd64.deb?dl=0
https://www.dropbox.com/s/uxwb3gzg68fxnwb/openvpn_2.3.14-trusty0_i386.deb?dl=0
https://www.dropbox.com/s/axukayantse89cl/openvpn_2.3.14-xenial0_amd64.deb?dl=0
https://www.dropbox.com/s/68i5jp13nbypyz0/openvpn_2.3.14-xenial0_i386.deb?dl=0

# Dropbox links 2.3.12
https://www.dropbox.com/s/o3e4s4bq90gx71j/openvpn_2.3.12-scramble-ubuntu1204_amd64.deb?dl=0
https://www.dropbox.com/s/8isbarc9xegyj4n/openvpn_2.3.12-scramble-ubuntu1204_i386.deb?dl=0
https://www.dropbox.com/s/xzcsfx6j4jkzbr4/openvpn_2.3.12-scramble-ubuntu1404_amd64.deb?dl=0
https://www.dropbox.com/s/ewgw1uje5kmtndn/openvpn_2.3.12-scramble-ubuntu1404_i386.deb?dl=0



# If you get the following error
# Not enough random bytes available. Please do some other work to give
# the OS a chance to collect more entropy!
#
# Then from another shell install random number generator
#
# apt-get install rng-tools
# rngd -f -r /dev/urandom