Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mindaugasveblauskas committed Jan 16, 2020
0 parents commit 15116ad
Show file tree
Hide file tree
Showing 8 changed files with 771 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
variables:
PUBLIC_REPO_URL: git@github.com:ProtonVPN/win-openvpn.git

stages:
- build
- mirror

before_script:
- docker info

build:
stage: build
tags:
- windows
script:
- docker build -t openvpn .
- docker rm -f openvpn 2>&1 | out-null ; $global:LASTEXITCODE = $null
- docker run --name openvpn openvpn
- Remove-Item openvpn -Recurse -ErrorAction Ignore 2>&1 | out-null ; $global:LASTEXITCODE = $null
- New-Item -ItemType directory -Path openvpn
- docker cp openvpn:/home/openvpn-build/generic/image-win32/openvpn/bin openvpn/x86
- docker cp openvpn:/home/openvpn-build/generic/image-win64/openvpn/bin openvpn/x64
artifacts:
paths:
- openvpn
expire_in: '2 yrs'

mirror:
stage: mirror
tags:
- windows
only:
refs:
- tags
- master
script:
- powershell -File prepare-ssh.ps1
- git clone "$CI_REPOSITORY_URL" --branch master _APP_CLONE;
- cd _APP_CLONE
- git remote add public $PUBLIC_REPO_URL
- git push public master
- git push public "$(git describe --abbrev=0)"
14 changes: 14 additions & 0 deletions COPYING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright (c) 2020 Proton Technologies AG

ProtonVPN is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

ProtonVPN is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ProtonVPN. If not, see <https://www.gnu.org/licenses/>.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu:18.04
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl zip wget git make gcc gcc-mingw-w64 man2html autoconf libtool net-tools libpam0g-dev
RUN cd /home && git clone --branch openvpn-install-2.4.8-I601 https://github.com/OpenVPN/openvpn-build.git
WORKDIR /home/openvpn-build/generic
COPY patches/openvpn-2.4.8_1.patch patches/openvpn-2.4.8_1.patch
COPY patches/openvpn-2.4.8_2.patch patches/openvpn-2.4.8_2.patch
RUN IMAGEROOT=`pwd`/image-win32 CHOST=i686-w64-mingw32 CBUILD=x86_64-pc-linux-gnu ./build
RUN IMAGEROOT=`pwd`/image-win64 CHOST=x86_64-w64-mingw32 CBUILD=x86_64-pc-linux-gnu ./build
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Scripts for building OpenVPN used in ProtonVPN for Windows
17 changes: 17 additions & 0 deletions patches/openvpn-2.4.8_1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -1582,11 +1582,12 @@
char iface[64];
openvpn_snprintf(iface, sizeof(iface), "interface=%lu", tt->adapter_index );
argv_printf(&argv,
- "%s%sc interface ipv6 set address %s %s store=active",
+ "%s%sc interface ipv6 set address %s %s/%d store=active",
get_win_sys_path(),
NETSH_PATH_SUFFIX,
iface,
- ifconfig_ipv6_local );
+ ifconfig_ipv6_local,
+ 128);
netsh_command(&argv, 4, M_FATAL);
/* set ipv6 dns servers if any are specified */
netsh_set_dns6_servers(tt->options.dns6, tt->options.dns6_len, actual);
10 changes: 10 additions & 0 deletions patches/openvpn-2.4.8_2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- openvpn-2.4.8/version.m4
+++ openvpn-2.4.8/version.m4
@@ -10,6 +10,6 @@
define([PRODUCT_BUGREPORT], [openvpn-users@lists.sourceforge.net])
define([PRODUCT_VERSION_RESOURCE], [2,4,8,0])
dnl define the TAP version
-define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901])
+define([PRODUCT_TAP_WIN_COMPONENT_ID], [tapprotonvpn])
define([PRODUCT_TAP_WIN_MIN_MAJOR], [9])
define([PRODUCT_TAP_WIN_MIN_MINOR], [9])
3 changes: 3 additions & 0 deletions prepare-ssh.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
New-Item -ItemType Directory -Force -Path "$env:userprofile\.ssh"
"$env:SSH_PRIVATE_KEY`n".Replace("`r`n","`n") | Out-File -NoNewline -Encoding ASCII -FilePath "$env:userprofile\.ssh\id_rsa"
ssh-keyscan -t rsa github.com | Set-Content "$env:userprofile\.ssh\known_hosts"

0 comments on commit 15116ad

Please sign in to comment.