Solved

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

Posted on 2014-02-02
2
1,094 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 27

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Even though Mac OS X has been around for many years now, certain well-liked and eminently useful software apps never made the jump from Mac OS 9 to Mac OS X. Ever used Word Perfect for Mac? Version 3.5 was the last version, built for Mac OS 9. Who c…
Are you looking to clear some space on your phone for the latest iOS 8 update? Did you switch to Spotify so you no longer need to keep music native on your phone? Run out of space for taking photos while in the middle of vacation? Sometimes the quic…
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…

758 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

20 Experts available now in Live!

Get 1:1 Help Now