Monthly Archives: September 2023

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

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