Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2014-02-02
2
1,132 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 29

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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apple Remote Desktop to connect to XP 6 88
iOS vulnerability (9.3.5) 5 92
how to install MAC OSX on a MAC that has windows installed 5 60
apple id without bloatware 4 78
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…
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 > …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

792 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