?
Solved

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

Posted on 2014-02-02
2
Medium Priority
?
1,221 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 31

Accepted Solution

by:
serialband earned 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Steve Jobs once said that Blu-ray is "a bag of hurt". As Macs users well known, things haven’t settled down (at least not from Apple’s perspective). Several years after that comment, Mac OS X still doesn’t support Blu-ray playback, nor has any Mac s…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
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 > …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

807 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