Featured post

quick install scramble openvpn server on ubuntu 22.04

##########################################################
#
# Quick install already patched openvpn deb package for Ubuntu 22.04 64-bit

apt-get update && apt-get build-dep openvpn -y

wget --no-check-cert  "https://www.dropbox.com/scl/fi/xeq044grwuohtb71o3qy7/openvpn_2.5.9-jammy0_amd64.deb?rlkey=pbcbano0ibqbwm6q70nw21lmo&st=d5z9u9fz&dl=1" -O openvpn_2.5.9-jammy0_amd64.deb

# Install scramble openvpn
dpkg -i  openvpn_2.5.9-jammy0_amd64.deb

# Then install openvpn from nyr
wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh

#
# then add the following scramble code text to client and server scripts

scramble obfuscate randompassword

##########################################################

Featured post

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

# Using sbuild, virtualbox and vagrant.

# Quick install already patched openvpn deb package for Ubuntu 20.04 64-bit

apt-get update && apt-get build-dep openvpn -y

wget --no-check-cert https://www.dropbox.com/scl/fi/s5lzqvt2q8xm38zntjl6i/openvpn_2.4.12-focal0_amd64.deb

dpkg -i openvpn_2.4.12-focal0_amd64.deb

Could not get Jammy or Kinetic to compile, complain of fuzzy patch

Featured post

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

##########################################################

# Quick install already patched openvpn deb package for Ubuntu 22.04 64-bit

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/scl/fi/xeq044grwuohtb71o3qy7/openvpn_2.5.9-jammy0_amd64.deb
dpkg -i openvpn_2.5.9-jammy0_amd64.deb

################################################################


# Quick install already patched openvpn deb package for Ubuntu 20.04 64-bit

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/scl/fi/x2falr026qvpianss2g7e/openvpn_2.5.9-focal0_amd64.deb
dpkg -i openvpn_2.5.9-focal0_amd64.deb

################################################################


# Quick install already patched openvpn deb package for Ubuntu 22.10 64-bit

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/scl/fi/zt2323uob2xxusn1rjh6v/openvpn_2.5.9-kinetic0_amd64.deb
dpkg -i openvpn_2.5.9-kinetic0_amd64.deb

################################################################

#
# This is how I done it, I write this guide so I can
# remember the next time I need to do it.

#
#
# Built on windows 10 PC, using Virtualbox and vagrant

#

# Virtual box

# https://www.virtualbox.org/wiki/Downloads

#

#

# vagrant

# https://developer.hashicorp.com/vagrant/downloads

#

# vagrant openvpn scripts

#
# https://github.com/OpenVPN/openvpn-vagrant/archive/refs/heads/master.zip

# open power shell, in directory of vagrant master.zip
# unzip master.zip
# That will be our working directory
cd "G:\vagrant\openvpn-vagrant-master"

# install vagrant-vbguest

#
vagrant status
# Vagrant has detected project local plugins configured for this

# project which are not installed.

# vagrant-vbguest
# Install local plugins (Y/N) [N]: Y

# edit sbuild.sh in "G:\vagrant\openvpn-vagrant-master"
# remove everything and replace with the following
#
echo "Updating package cache"
apt-get update
echo
echo "Installing sbuild_wrapper dependencies"
apt-get -y install sbuild git quilt debhelper
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
echo

###################################################################
# Now we are going to connect to the ubuntu machine to build
vagrant up sbuild

vagrant ssh sbuild
sudo su

git clone https://github.com/OpenVPN/sbuild_wrapper.git
cd sbuild_wrapper/
scripts/setup.sh

# not sure if this is needed, but ok
sbuild-update --keygen

# We are going to remove all variants, only leave

nano config/variants.conf

ubuntu focal amd64
ubuntu jammy amd64
ubuntu kinetic amd64

# Now set the version
nano config/version.conf
PROGRAM_VERSION="${PROGRAM_VERSION:-2.5.9}"
########################################################
scripts/setup_chroots.sh
schroot -l|grep sbuild|grep source
# This is new
scripts/install-build-deps.sh
#
# fetch and load patch here
#
cd /home/vagrant
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.5.9/patches/02-tunnelblick-openvpn_xorpatch-a.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.5.9/patches/03-tunnelblick-openvpn_xorpatch-b.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.5.9/patches/04-tunnelblick-openvpn_xorpatch-c.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.5.9/patches/05-tunnelblick-openvpn_xorpatch-d.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.5.9/patches/06-tunnelblick-openvpn_xorpatch-e.diff

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

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

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

#########################################################
# Missing change log, we need to make something,
# So I copy changelog for 2.5.8 and just rename it
# I know it's not right, but chabuduo

cd /home/vagrant/sbuild_wrapper/packaging
cp changelog-2.5.8 changelog-2.5.9
nano changelog-2.5.9
cd ..

cd /home/vagrant/sbuild_wrapper/
scripts/prepare-all.sh
ls build/*/

#
# Need to do workaround
nano scripts/build-all.sh



# change build-dir to build-path
#
# otherwise get the following error
# sbuild --verbose --no-run-lintian
# --build-dir=/home/vagrant/sbuild_wrapper/build/buster --arch=i386
# --dist=buster openvpn_2.5.8-buster0.dsc
# Unknown option: build-dir
# E: Error parsing command-line options



scripts/build-all.sh



# because of the mess with build-dir to build-path
#
ls output-2.5.9-debian0


#
# Background
#
# Build scrambled openvpn deb packages

# Based on https://github.com/openvpn/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

Featured post

quick install scramble openvpn on ubuntu 18.04



##########################################################################
# 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/gt2an76red2qdli/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/gt2an76red2qdli/openvpn_2.4.8-bionic0_i386.deb
dpkg -i openvpn_2.4.8-bionic0_i386.deb
##########################################################################
#
# Then install openvpn from nyr

wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh
#
# then add the following scramble code to client and server scripts

scramble obfuscate YourPassword

Featured post

June 4th How to get around block

## On June 2nd 2019, in an effort to make people forget June 4th.
## The GFW done a mass blocking of IP’s of international servers.
## This only drew attention. The Streisand effect.
##
## So, to get around the block, you need.
##
## — a Website name, example.com (free) Goto https://freenom.com/
## — install a website on your VPS, e.g. nginx (VPS cost 2 USD)
## — use a CDN e.g. cloudflare.com or amazon (free)
## — install proxy v2ray+websocket
##
##
## That is it ! works
## And is actually faster than earlier direct connections
## Thank you GFW……
##
## Solution is working,
## Need to write it up, work in progress
## Reference guides
## https://docs.unixfy.me/books/tutorials/chapter/vpn-tutorials
## https://shenzhensuzy.wordpress.com/2018/11/28/v2ray-over-websocket-with-nginx-tls-plus-cdn/

1) a Website name, example.com
Goto https://freenom.com/
take out a free domain name, for 12 months.
e.g. mywebsite.com
When you have your cloudflare.com account
use the nameserver of cloudflare for DNS

TIP: When you visit this page, don’t use
a VPN, because at the end it will say sorry “technical error”

2) Create an account
https://www.cloudflare.com
point your domain name to the IP of your VPS
Also copy the nameserver, and update freenom.com
so it knows to use cloudflare.com

3) On your VPS install nginx
apt install nginx

4) At this stage its important that your website
is live, and accessible from China via CDN, http , not https at the moment.
http://mywebsite.com
You can edit the site to put some content. /var/www/html/ or /usr/share/nginx/html
Don’t go forward until it’s live, and accessible from China via CDN.

5) Set the server_name in /etc/nginx/sites-available/default to domain name of server.
nano /etc/nginx/sites-available/default


// Change from
server_name _;
// to
server_name mywebsite.com;

6) The next step changes depending on OS, Its installing certbot to make
your site become HTTPS. For Ubuntu 18.04 and Debian 9 its
apt install python-certbot-nginx
Get a certificate. Make sure to select yes for redirect.
certbot --nginx

For other OS see https://certbot.eff.org/all-instructions.

Add reverse proxy, between server name, and first location block

nano /etc/nginx/sites-available/default

server_name mywebsite.com;

// start of new code
location /websocket/ {
proxy_redirect off;
proxy_pass http://127.0.0.1:8388;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $http_host;
}
// end of new code


location / {

Reload nginx
nginx -s reload

7)Install V2Ray

bash <(curl -L -s https://install.direct/go.sh)

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)

EDIT: need to install workaround for environment variable

Fixed the problem
https://github.com/v2fly/v2ray-core/discussions/1514

nano /etc/systemd/system/v2ray.service

# Add this line at the end of the [Service] item:

EnvironmentFile=/root/v2_env

nano /root/v2_env

# Write the following on the v2_env file:

V2RAY_VMESS_AEAD_FORCED=false

———————————————–
TIP: must install V2ray as root, You cannot do it with sudo.
Do the following if you are not root.

# Set root password
sudo passwd

# log in as root, and enter password you just created
su –
bash <(curl -L -s https://install.direct/go.sh)

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
———————————————–

// Replace /etc/v2ray/config.json with the following


{
"inbounds": [
{
"port": 8388,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "bd5465fb-e3c9-475f-8088-2f63bcc67375",
"level": 1,
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/websocket/"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"routing": {
"rules": [
{
"type": "field",
"ip": [
"geoip:private"
],
"outboundTag": "blocked"
}
]
},
"dns": {
"hosts": {},
"servers": [
"9.9.9.9",
"1.1.1.1",
"8.8.8.8",
"1.0.0.1",
"114.114.114.114",
"localhost"
]
}
}


# You should at least change ID
# get a new ID from https://www.uuidgenerator.net/
# If you change “path”, make sure you change it on client side as well.
# must be the same.

# Start v2ray
# This is where the problems are, make sure it started

systemctl enable v2ray; systemctl start v2ray
service v2ray status

# For windows, use command line
# download https://github.com/v2ray/v2ray-core/releases
#
# Run from windows command line
v2ray.exe -config windowsconfig.json
# or run from shortcut
cmd v2ray.exe -config windowsconfig.json

# Here is a working client script for windows

// Config file of V2Ray. This file follows standard JSON format, with comments support.
// Uncomment entries below to satisfy your needs. Also read our manual for more detail at
// https://www.v2ray.com/
{
"log": {
// By default, V2Ray writes access log to stdout.
// "access": "/path/to/access/log/file",

// By default, V2Ray write error log to stdout.
// “error”: “/path/to/error/log/file”,

// Log level, one of “debug”, “info”, “warning”, “error”, “none”
“loglevel”: “warning”
},
// List of inbound proxy configurations.
“inbounds”: [{
// Port to listen on. You may need root access if the value is less than 1024.
“port”: 1180,

// IP address to listen on. Change to “0.0.0.0” to listen on all network interfaces.
“listen”: “127.0.0.1”,

// Tag of the inbound proxy. May be used for routing.
“tag”: “socks-inbound”,

// Protocol name of inbound proxy.
“protocol”: “socks”,

// Settings of the protocol. Varies based on protocol.
“settings”: {
“auth”: “noauth”,
“udp”: false,
“ip”: “127.0.0.1”
},

// Enable sniffing on TCP connection.
“sniffing”: {
“enabled”: true,
// Target domain will be overriden to the one carried by the connection, if the connection is HTTP or HTTPS.
“destOverride”: [“http”, “tls”]
}
}],
// List of outbound proxy configurations.
“outbounds”: [{
“protocol”: “vmess”,
“settings”: {
“vnext”: [
{
“address”: “mywebsite.com”,
“port”: 443,
“users”: [
{
“id”: “bd5465fb-e3c9-475f-8088-2f63bcc67375”,
“level”: 1,
“alterId”: 64,
“security”: “auto”
}
]
}
]
},
“streamSettings”: {
“network”: “ws”,
“wsSettings”: {
“path”: “/websocket/”
},
“security”: “tls”,
“tlsSettings”: {
// “serverName”: “mywebsite.com”,
“allowInsecure”: false
}
}
},
{
// Protocol name of the outbound proxy.
“protocol”: “freedom”,

// Settings of the protocol. Varies based on protocol.
“settings”: {},

// Tag of the outbound. May be used for routing.
“tag”: “direct”
},{
“protocol”: “blackhole”,
“settings”: {},
“tag”: “blocked”
}],

// Transport is for global transport settings. If you have multiple transports with same settings
// (say mKCP), you may put it here, instead of in each individual inbound/outbounds.
//”transport”: {},

// Routing controls how traffic from inbounds are sent to outbounds.
“routing”: {
“domainStrategy”: “IPOnDemand”,
“rules”:[
{
// Blocks access to private IPs. Remove this if you want to access your router.
“type”: “field”,
“ip”: [“geoip:private”],
“outboundTag”: “blocked”
},
{
// Blocks major ads.
“type”: “field”,
“domain”: [“geosite:category-ads”],
“outboundTag”: “blocked”
}
]
},

// Dns settings for domain resolution.
“dns”: {
// Static hosts, similar to hosts file.
“hosts”: {
// Match v2ray.com to another domain on CloudFlare. This domain will be used when querying IPs for v2ray.com.
“domain:v2ray.com”: “www.vicemc.net”,

// The following settings help to eliminate DNS poisoning in mainland China.
// It is safe to comment these out if this is not the case for you.
“domain:github.io”: “pages.github.com”,
“domain:wikipedia.org”: “www.wikimedia.org”,
“domain:shadowsocks.org”: “electronicsrealm.com”
},
“servers”: [
“1.1.1.1”,
{
“address”: “114.114.114.114”,
“port”: 53,
// List of domains that use this DNS first.
“domains”: [
“geosite:cn”
]
},
“8.8.8.8”,
“localhost”
]
},

// Policy controls some internal behavior of how V2Ray handles connections.
// It may be on connection level by user levels in ‘levels’, or global settings in ‘system.’
“policy”: {
// Connection policys by user levels
“levels”: {
“0”: {
“uplinkOnly”: 0,
“downlinkOnly”: 0
}
},
“system”: {
“statsInboundUplink”: false,
“statsInboundDownlink”: false
}
},

// Stats enables internal stats counter.
// This setting can be used together with Policy and Api.
//”stats”:{},

// Api enables gRPC APIs for external programs to communicate with V2Ray instance.
//”api”: {
//”tag”: “api”,
//”services”: [
// “HandlerService”,
// “LoggerService”,
// “StatsService”
//]
//},

// You may add other entries to the configuration, but they will not be recognized by V2Ray.
“other”: {}
}

============================================================================

EDIT 2023: On old system Debian 8, cannot install certbot, So instead use self signed certificates to make it HTTPS, the certs are called snakeoil ! Love the name.

# Lazy guide using self signed SSL certs instead of certbot

apt-get install ssl-cert

# The certificate and key can be regenerated manually with

# the following command (needs root privileges ie sudo):

make-ssl-cert generate-default-snakeoil –force-overwrite

===================================

Just remove the #

nano /etc/nginx/sites-available/default

#
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
#
# Self signed certs generated by the ssl-cert package
# Don’t use them in a production server!
#
include snippets/snakeoil.conf;

Featured post

Shadowsocks on Cent OS or Debian VPS


# lazy quick install
# For China choose xchacha20-ietf-poly1305

# 2024 workaround

On Raspbian OS the scripts fail saying unable to install python

The workaround is to edit the Teddy scripts in nano, press  CTRL \  to  find and replace, find python replace with python3

================================================================================

wget https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh –no-check-certificate && chmod +x shadowsocks.sh && ./shadowsocks.sh

# choose all possible install

wget https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh –no-check-certificate && chmod +x shadowsocks-all.sh && ./shadowsocks-all.sh

# Check
cat /etc/shadowsocks.json

# Edit
nano /etc/shadowsocks.json

# Get Client from
http://shadowsocks.org/en/download/clients.html


# Comments
If VPS is NAT, it will not have correct server IP address.

# Here are Teddy scripts edited

wget –no-check-cert https://www.dropbox.com/scl/fi/y38vpjodizs246ezttsqc/shadowsocks-all-python3.sh

sudo chmod +x shadowsocks-all-python3.sh

sudo ./shadowsocks-all-python3.sh

Run
shadowsocks-all-python3.sh

Pick Shadowsocks-libev

13) xchacha20-ietf-poly1305

Other one click install scripts for shadowsocks. Blocked in China

Will work for a few days, until they block the IP

https://github.com/loyess/2022

Installation

curl -OL https://github.com/loyess/2022/raw/main/2022script.sh
chmod +x 2022script.sh
./2022script.sh
Featured post

Install scrambled Openvpn server (from source code) on a openVZ box running Debian or Ubuntu


# Tested working on Ubuntu 14.04 32Bit - Minimal i386, on OpenVZ
#
# This time we install from source code and compile
#
# Summary of Files that we will use
###############################################
# Script to start openvpn [ /etc/init.d/openvpn ]
# https://www.dropbox.com/s/nz4dyons6tlsbr4/etcinitdopenvpn.sh
#
# Script to merge Client keys and certs
# https://www.dropbox.com/s/pdl8jyr0gzys3d6/merge.sh
#
# Script to merge Server keys and certs
# https://www.dropbox.com/s/9wc3we8ezfucj1j/merge_server.sh
#
# openvpn source code
# http://swupdate.openvpn.org/community/releases/openvpn-2.3.8.zip
###############################################

# We need to add a few components to be able to compile
# And please check your openssl version has heartbleed fix
apt-get update
apt-get install --only-upgrade openssl -y
apt-get install gcc 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 git -y

# fetch source code & apply patch
cd $HOME/
wget http://swupdate.openvpn.org/community/releases/openvpn-2.3.8.zip
unzip openvpn-2.3.8.zip
wget https://github.com/clayface/openvpn_xorpatch/archive/master.zip
unzip master.zip
cp openvpn_xorpatch-master/openvpn_xor.patch openvpn-2.3.8/
cd openvpn-2.3.8/
git apply --check openvpn_xor.patch
git apply openvpn_xor.patch

# This is the bit where we make and install the new openvpn server
mkdir /etc/openvpn/
cd $HOME/openvpn-2.3.8/
./configure --prefix=/usr
make
make install
wget --no-check-cert https://www.dropbox.com/s/nz4dyons6tlsbr4/etcinitdopenvpn.sh -O /etc/init.d/openvpn
chmod +x /etc/init.d/openvpn
update-rc.d openvpn defaults

# For test purposes only here are a pair of client/server scripts
# https://www.dropbox.com/s/u06t53fb7qwov47/client1.ovpn?dl=0
# https://www.dropbox.com/s/cxt7ajdxczifsqm/server.conf?dl=0
# Now we create keys and certs using the new easyrsa3
# You need to make a new passphrase during this process

mkdir $HOME/clientside
mkdir $HOME/serverside
cd $HOME/serverside
wget https://github.com/OpenVPN/easy-rsa/archive/master.zip
unzip master.zip
cd easy-rsa-master/easyrsa3
openvpn --genkey --secret ta.key
./easyrsa init-pki
./easyrsa --batch build-ca nopass
./easyrsa --batch build-server-full server nopass
./easyrsa --batch build-client-full client1 nopass
./easyrsa gen-dh

cp $HOME/serverside/easy-rsa-master/easyrsa3/pki/ca.crt $HOME/serverside/
cp $HOME/serverside/easy-rsa-master/easyrsa3/pki/issued/server.crt $HOME/serverside/
cp $HOME/serverside/easy-rsa-master/easyrsa3/pki/dh.pem $HOME/serverside/dh2048.pem
cp $HOME/serverside/easy-rsa-master/easyrsa3/pki/private/server.key $HOME/serverside/
cp $HOME/serverside/easy-rsa-master/easyrsa3/ta.key $HOME/serverside/
cp $HOME/serverside/easy-rsa-master/easyrsa3/pki/issued/client1.crt $HOME/clientside/
cp $HOME/serverside/easy-rsa-master/easyrsa3/ta.key $HOME/clientside/
cp $HOME/serverside/easy-rsa-master/easyrsa3/pki/ca.crt $HOME/clientside/
cp $HOME/serverside/easy-rsa-master/easyrsa3/pki/private/client1.key $HOME/clientside/

# Client Script
nano $HOME/clientside/client1.ovpn

client
dev tun
scramble obfuscate test
proto udp
remote change_this_to_server_address 34557
resolv-retry infinite
nobind
sndbuf 0
rcvbuf 0
persist-key
persist-tun
ca ca.crt
cert client1.crt
key client1.key
tls-auth ta.key 1
remote-cert-tls server
cipher AES-256-CBC
comp-lzo
verb 3
fast-io
script-security 2

# Now merge certs and keys into client script, so we only have one file to handle
cd $HOME/clientside/
wget https://www.dropbox.com/s/pdl8jyr0gzys3d6/merge.sh -O merge.sh
chmod +x merge.sh
$HOME/clientside/merge.sh

# Now transfer client script client1.ovpn
# in $HOME/clientside/ to your client PC
# Due to permissions, I had to transfer it to C:\
# Then in windows, copy the file
# to C:\Program Files (x86)\OpenVPN\config

# Below is OpenVPN server configuration
nano $HOME/serverside/server.conf

port 34557
proto udp
dev tun
scramble obfuscate test
ca ca.crt
cert server.crt
key server.key
tls-auth ta.key 0
dh dh2048.pem
sndbuf 0
rcvbuf 0
server 10.8.0.0 255.255.255.0
cipher AES-256-CBC
comp-lzo
persist-key
persist-tun
user nobody
group nogroup
status openvpn-status.log
verb 3
push "redirect-gateway def1"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
keepalive 5 30

# Now merge certs and keys into server script, so we only have one file to handle
cd $HOME/serverside/
wget --no-check-cert https://www.dropbox.com/s/9wc3we8ezfucj1j/merge_server.sh -O merge_server.sh
chmod +x merge_server.sh
./merge_server.sh

# Now copy the merged server script to /etc/openvpn/
cp $HOME/serverside/server.conf /etc/openvpn/

# uncomment to allow data redirect
nano /etc/sysctl.conf

net.ipv4.ip_forward=1

# Make file for firewall setting
nano /usr/local/bin/firewall.sh

#!/bin/bash
iptables -t filter -F
iptables -t nat -F
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s "10.8.0.0/24" -j ACCEPT
iptables -A FORWARD -j REJECT
iptables -t nat -A POSTROUTING -s "10.8.0.0/24" -j MASQUERADE

# Make firewall script executable, run it and check
chmod +x /usr/local/bin/firewall.sh
/usr/local/bin/firewall.sh
iptables --list

# add new text line into file /etc/rc.local
# before ‘exit 0' to ensure the firewall rules are run at reboot or power up.
nano /etc/rc.local

/usr/local/bin/firewall.sh

# Alternative Firewall setting
# iptables -t nat -A POSTROUTING -o venet0 -j SNAT --to-source IP_ADDRESS_VPS
# iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source IP_ADDRESS_VPS

# Start everything
sysctl -w net.ipv4.ip_forward=1
/etc/init.d/openvpn restart

# Check server is running
/etc/init.d/openvpn status

# TIP: You can save the pair of scripts elsewhere for reuse later
# $HOME/clientside/client1.ovpn
# $HOME/serverside/server.conf

# TIP:restart server after changes to server script
/etc/init.d/openvpn restart
# TIP: after reinstall system turn TUN/TAP off, and on again
# TIP: otherwise I could not start server.

 

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

Build scrambled openvpn (2.4.4) 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
# 512 MB Memory / 20 GB Disk / - Ubuntu 14.04.5 x64
################################################################
# Quick install already patched openvpn deb package for Ubuntu 14.04 64-bit

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/seihrxs5osd0wnx/openvpn_2.4.4-trusty0_amd64.deb
dpkg -i openvpn_2.4.4-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/opdgst9jpuw5qyk/openvpn_2.4.4-trusty0_i386.deb
dpkg -i openvpn_2.4.4-trusty0_i386.deb
##########################################################################
# Quick install patched openvpn deb package for Debian 8.7 64-bit

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

apt-get update && apt-get build-dep openvpn -y
wget --no-check-cert https://www.dropbox.com/s/2ezudrsjhauh9ey/openvpn_2.4.4-jessie0_i386.deb
dpkg -i dpkg -i openvpn_2.4.4-jessie0_i386.deb
systemctl start openvpn@server.service # error code until server.conf exists #
##########################################################################
# 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/peuvr57kamtl4u0/openvpn_2.4.4-xenial0_amd64.deb
dpkg -i openvpn_2.4.4-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/5fz1rqpmio6s23a/openvpn_2.4.4-xenial0_i386.deb
dpkg -i openvpn_2.4.4-xenial0_i386.deb
systemctl start openvpn@server.service # error code until server.conf exists #
##########################################################################

# This is how I did it from the start
# and so I can remember 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-blacklist openvpn-blacklist openssl sbuild git dh-systemd systemd -y
apt-get dist-upgrade -y

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

# This time, we need to update the config version
git clone https://github.com/mattock/sbuild_wrapper.git
cd sbuild_wrapper

## edit /config/version.conf to update openvpn verion

nano ./config/version.conf
PROGRAM_VERSION="${PROGRAM_VERSION:-2.4.4}"

## get changelog from https://community.openvpn.net/openvpn/wiki/ChangesInOpenvpn24
cp ./packaging/changelog-2.4.2 ./packaging/changelog-2.4.4
nano ./packaging/changelog-2.4.4

openvpn (2.4.4-debian0) stable; urgency=high
* Make this changelog so it can build, not worried about details
* Fix socks_proxy_port pointing to invalid data
-- Samuli Seppänen Thu, 11 May 2017 10:00:00 +0000

# Install
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

# Config each chroot

sbuild-shell trusty-amd64
apt-get update
apt-get build-dep openvpn -y
exit

sbuild-shell trusty-i386
apt-get update
apt-get build-dep openvpn -y
exit

sbuild-shell xenial-amd64
echo "deb http://fi.archive.ubuntu.com/ubuntu xenial main universe" > /etc/apt/sources.list
echo "deb-src http://fi.archive.ubuntu.com/ubuntu xenial main universe" >> /etc/apt/sources.list
apt-get update
apt-get install libsystemd-dev -y
apt-get install dh-systemd systemd -y
exit

sbuild-shell xenial-i386
echo "deb http://fi.archive.ubuntu.com/ubuntu xenial main universe" > /etc/apt/sources.list
echo "deb-src http://fi.archive.ubuntu.com/ubuntu xenial main universe" >> /etc/apt/sources.list
apt-get update
apt-get install libsystemd-dev
exit

sbuild-shell jessie-amd64
apt-get install libsystemd-daemon-dev -y
exit

sbuild-shell jessie-i386
apt-get install libsystemd-daemon-dev -y
exit

sbuild-shell wheezy-amd64
apt-get build-dep openvpn -y
exit

sbuild-shell wheezy-i386
apt-get build-dep openvpn -y
exit

sbuild-shell precise-amd64
apt-get build-dep openvpn -y
exit

sbuild-shell precise-i386
apt-get build-dep openvpn -y
exit

scripts/update-all.sh

# Fetch the scramble Openvpn Patch

cd $HOME
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.4/patches/02-tunnelblick-openvpn_xorpatch-a.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.4/patches/03-tunnelblick-openvpn_xorpatch-b.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.4/patches/04-tunnelblick-openvpn_xorpatch-c.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.4/patches/05-tunnelblick-openvpn_xorpatch-d.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.4/patches/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/precise/
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/wheezy/
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/*

# Do a Checksum

./output/sha256sum *

d14e645951caa58e9d8e2dbe56eeabda4762ebc89ef770b679183d85fd89e233 openvpn_2.4.4-jessie0_amd64.deb
1bbc8f58ec36186fc7539a2ab80889592dc5b8aca1528e801df173989ad70a65 openvpn_2.4.4-jessie0_i386.deb
adc992fb443d67d02f97da0838984d9f7131553305f58b87756daf3ead16bf18 openvpn_2.4.4-precise0_amd64.deb
fcf2715bf7328aedee01cd94fc8d274914557d19310b4b95a8d9a4a3cd55bfc6 openvpn_2.4.4-precise0_i386.deb
7244ce6fe9142673eb834c27881ddfcbe9a72a13f0af419043d181529f9eacfc openvpn_2.4.4-trusty0_amd64.deb
9fcab0551ab39638239ad25d4809bb180b88228b0ed5224e94a93b1c7222df06 openvpn_2.4.4-trusty0_i386.deb
ad7c2699d074acbadccbb5ebce6090dbc5d1ac6e70c22eb322c3d91b094243d4 openvpn_2.4.4-wheezy0_amd64.deb
820cb604194812f88c63312b18478b9cb2be3b4ade702bad1ae8cfea49f1df1f openvpn_2.4.4-wheezy0_i386.deb
218d0d69da6eb6952f29ea602834cb31abc0a796c9ef435506fd3b4275693c4c openvpn_2.4.4-xenial0_amd64.deb
426d5d98258096e399aed8e9ec3382ce9992b7cea575b61bc6ef3c3cca234fe0 openvpn_2.4.4-xenial0_i386.deb

./output/sha256sum * > ./output/checksum.log

# 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


# You can check if your target platforms are already supported by your
# operating system's debootstrap scripts:
# Ubuntu 14.04 already has these bootstrap for trusty, so I didn't need to do anything.
# ls /usr/share/debootstrap/scripts
# if you don't have them, then you need to fetch
# wget http://ftp.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.75_all.deb
# dpkg -i debootstrap_1.0.75_all.deb


# 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