Solved

Patch openvpn 2.3 (xor.patch) on Mac OSX 10.9 macports

Posted on 2014-02-02
2
1,105 Views
Last Modified: 2014-03-05
HI, I need to patch openvpn on my mac, so I can use the "scramble" and "scramble obfuscate" config flags that are helpful for obfuscating traffic.

(my server is configured with this patch, so I can not connect if my client does not support it.) In windows I have build the openvpn client successfully, but on Mac I am not familiar with the process.

The patch I need to apply is this:
https://github.com/clayface/openvpn_xorpatch/blob/master/openvpn_xor.patch

I have download xcode and Macports on my mac 10.9 (mavericks), and I just need the commands in order to:

-download source code of openvpn2.3
-apply openvpn_xor.patch from the github above
-build, make, install openvpn2 through macports

can someone help?

in LInux, the commands are the below, for reference:

# Now download OpenVPN source code and update with patch 
cd $HOME
wget https://github.com/OpenVPN/openvpn/archive/release/2.3.zip
unzip 2.3.zip

wget https://github.com/clayface/openvpn_xorpatch/archive/master.zip
unzip master.zip

cp openvpn_xorpatch-master/openvpn_xor.patch openvpn-release-2.3/
cd openvpn-release-2.3/
git apply --check openvpn_xor.patch
git apply openvpn_xor.patch
cd $HOME
sudo mv ./openvpn-release-2.3/ /etc/openvpn

# We need to add a few components to be able to compile
sudo apt-get update
sudo 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 -y
sudo apt-get update

# This is the bit where we make the new openvpn server
cd /etc/openvpn/
sudo autoreconf -i -v -f
sudo ./configure --prefix=/usr
sudo make
sudo make install
sudo nano /etc/init.d/openvpn

# goto pastebin, copy RAW
# http://pastebin.com/Bvpuejt0

# or sudo wget http://pastebin.com/raw.php?i=Bvpuejt0 -O /etc/init.d/openvpn
# or sudo wget https://gist.github.com/john564/6765292/raw/0a97df1237a138a5a941bbec45b6cd41e973f840/etc+init.d+openvpn -O /etc/init.d/openvpn

sudo chmod +x /etc/init.d/openvpn
sudo update-rc.d openvpn defaults

Open in new window

0
Comment
Question by:sk391
2 Comments
 
LVL 28

Accepted Solution

by:
serialband earned 500 total points
ID: 39830508
The basic command are the same, so you can do just about the same thing.  You'll just have to install wget and git if you haven't already done so.  I went from Fink, to MacPorts to HomeBrew, so my MacPorts command is a bit rusty.  I can get you started, but I haven't use MacPorts in a while and don't remember how or where everything gets placed.  Too much new data has pushed out the old.
port install git.
port install wget

Open in new window


Once you've installed wget and git, this first part is the same.
# Now download OpenVPN source code and update with patch 
cd $HOME
wget https://github.com/OpenVPN/openvpn/archive/release/2.3.zip
unzip 2.3.zip

wget https://github.com/clayface/openvpn_xorpatch/archive/master.zip
unzip master.zip

cp openvpn_xorpatch-master/openvpn_xor.patch openvpn-release-2.3/
cd openvpn-release-2.3/
git apply --check openvpn_xor.patch
git apply openvpn_xor.patch
cd $HOME
sudo mv ./openvpn-release-2.3/ /etc/openvpn

Open in new window


You'll also have to change the debian/ubuntu apt-get command to port selfupdate and also run softwareupdate -i -a if you want to update your mac.  Unfortunately, I don't know if MacPorts has all these tools.  You might want to skip this part and run the working make commands below first to see what you actually need.  I took out gcc, make and some of the other "make/conf" tools, because you should have them with xcode.  It's best not to attempt to install duplicates that may confuse everything or possibly be out of date.
# We need to add a few components to be able to compile
sudo port selfupdate
sudo port install  dh-autoreconf  perl dh-make debhelper devscripts gnupg lintian quilt libtool pkg-config libssl-dev liblzo2-dev libpam0g-dev libpkcs11-helper1-dev -y
sudo port selfupdate

Open in new window

The last line depends on whether MacPorts actually places the openvpn startup in init.d, since Macs don't really use init.d.  The use launchctl to configure the launchdaemons/launchagents.
# This is the bit where we make the new openvpn server
cd /etc/openvpn/
sudo autoreconf -i -v -f
sudo ./configure --prefix=/usr
sudo make
sudo make install
sudo nano /etc/init.d/openvpn

Open in new window

The last lines also depend on how MacPorts handles the installation.  Does MacPorts put everything in /etc/ as linux does, or does it put it somewhere else.
# goto pastebin, copy RAW
# http://pastebin.com/Bvpuejt0

# or sudo wget http://pastebin.com/raw.php?i=Bvpuejt0 -O /etc/init.d/openvpn
# or sudo wget https://gist.github.com/john564/6765292/raw/0a97df1237a138a5a941bbec45b6cd41e973f840/etc+init.d+openvpn -O /etc/init.d/openvpn

sudo chmod +x /etc/init.d/openvpn
sudo update-rc.d openvpn defaults

Open in new window

                                 
I hope this puts you on the right track.
0
 
LVL 1

Author Comment

by:sk391
ID: 39830571
thank you, I will try this, i also saw there is something called "local repository" for macports, if I create a portfile in my local machine and add "file:///path" to my repositories sources, i should be able to do "port install -s openvpn2" to install openvpn2 from source, and add "patchfiles xor_openvpn.patch" in the portfile?

guide.macports.org/#development.local-repositories

http://guide.macports.org/#development.patches
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
unable to open iTunes version 10.4  after uninstalling newer version 3 65
How to download an Apple App onto a PC 3 62
time machine 8 45
apple tv fire 15 39
A common question or need, when setting-up a new Mac for someone would be to make all of the applications, installed, available from the dock. Many people often do not realize an application is installed unless it is in the dock. Creating a custo…
iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
Users will learn how resize a batch of photos from a single command in Photoshop via Photoshop's Image Processor. Open up an Image you'd like to resize in Adobe Photoshop: Adjust the image size according to your preferences. Image > Adjustments > …
Users will learn how to set proper sequence settings, scale images, paste attributes, add transitions, fades, and music. Open up Final Cut Pro 7 and Create a new Project: Set the Sequence Settings. a) Click File > Easy Setup > Format > Apple ProRe…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now