-
Notifications
You must be signed in to change notification settings - Fork 5
258 lines (223 loc) · 9.38 KB
/
build_openvpn_linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
name: linux-openvpn
on: [push]
jobs:
Build-OpenVPN-Linux:
name: 'Build-OpenVPN-Ubuntu'
runs-on: ubuntu-20.04
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[linux]') ||
contains(github.event.head_commit.message, '[linux-openvpn]') ||
contains(github.event.head_commit.message, '[openvpn]')
strategy:
matrix:
arch: [x86_64] #, x86, arm32, arm64]
fail-fast: false
env:
CFLAGS: "-static-libgcc -g -O1"
UBSAN_OPTIONS: print_stacktrace=1
BUILD_DIR: ${{ github.workspace }}/../_deps/openvpn_build
INSTALL_DIR: ${{ github.workspace }}/../openvpn_inst
OPEN_SSL_VER: "3.0.13"
_ARCH: ${{matrix.arch}}
OPENSSL_LIBS: "-L${INSTALL_DIR}/lib -lssl -lcrypto"
OPENSSL_CFLAGS: "-I${INSTALL_DIR}/include"
LZO_LIBS: "-L${INSTALL_DIR}/lib -llzo2"
LZO_CFLAGS: "-I${INSTALL_DIR}/include"
LZ4_LIBS: "-L${INSTALL_DIR}/lib -llz4"
LZ4_CFLAGS: "-I${INSTALL_DIR}/include"
steps:
- name: Set up build environment
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: gcc-multilib g++-multilib libnl-genl-3-dev libcap-ng-dev libpam0g-dev
version: 1.0
- name: Creating work-folder
run: |
mkdir -pv ${BUILD_DIR}
mkdir -pv ${INSTALL_DIR}
mkdir -pv ${INSTALL_DIR}/include
mkdir -pv ${INSTALL_DIR}/lib
- name: Build OpenSSL
run: |
cd ${BUILD_DIR}
curl https://www.openssl.org/source/openssl-${OPEN_SSL_VER}.tar.gz | tar zx
cd ${BUILD_DIR}/openssl-${OPEN_SSL_VER}
./Configure no-tests linux-x86_64 enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp -static-libgcc --openssldir=/usr/local/lib
echo "************************************************"
echo "******** Compiling OpenSSL..."
echo "************************************************"
make
echo "************************************************"
echo "******** Copying OpenSSL include folder and static libraries..."
# if you want to use OS-default SHARED openssl libraries - not necessary to compile it.
# Just copy required headers of OpenSSL (include folder)
cp -r ${BUILD_DIR}/openssl-${OPEN_SSL_VER}/include/openssl ${INSTALL_DIR}/include/
# if you want to use OS-default SHARED openssl libraries - skip copying this static libraries
cp ${BUILD_DIR}/openssl-${OPEN_SSL_VER}/libcrypto.a ${INSTALL_DIR}/lib/
cp ${BUILD_DIR}/openssl-${OPEN_SSL_VER}/libssl.a ${INSTALL_DIR}/lib/
- name: Build LZO
run: |
echo "************************************************"
echo "******** Downloading LZO sources..."
echo "************************************************"
cd ${BUILD_DIR}
curl https://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz | tar zx
cd lzo-2.10
echo "************************************************"
echo "******** Compiling LZO..."
echo "************************************************"
./configure --prefix="${INSTALL_DIR}" && make && make install
- name: Build LZ4
run: |
cd ${BUILD_DIR}
git clone https://github.com/lz4/lz4
cd lz4
git checkout release
sudo make install PREFIX="${INSTALL_DIR}"
cd ${INSTALL_DIR}/lib
sudo rm *.so
- name: 'Get openvpn'
uses: actions/checkout@v3
with:
repository: OpenVPN/openvpn
ref: release/2.5
path: openvpn
- name: autoconf
working-directory: openvpn
run: autoreconf -fvi
- name: configure
working-directory: openvpn
run: OPENSSL_LIBS="${INSTALL_DIR}/lib/libssl.a ${INSTALL_DIR}/lib/libcrypto.a -lpthread -ldl" OPENSSL_CFLAGS="-I${INSTALL_DIR}/include"
LZO_LIBS="-L${INSTALL_DIR}/lib -llzo2"
LZO_CFLAGS="-I${INSTALL_DIR}/include" LZ4_LIBS="-L${INSTALL_DIR}/lib -llz4" LZ4_CFLAGS="-I${INSTALL_DIR}/include"
./configure --disable-debug --enable-static=yes --enable-shared=no --disable-dependency-tracking --disable-dco --disable-plugin-auth-pam --disable-plugins --disable-silent-rules --with-crypto-library=openssl
- name: make all
working-directory: openvpn
run: make -j4
# - name: make check
# working-directory: openvpn
# run: make check
- name: copy libs
working-directory: openvpn
run: |
mkdir buildOvpn
mkdir buildOvpn/${{matrix.arch}}
cp src/openvpn/openvpn buildOvpn/${{matrix.arch}}/openvpn
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: openvpn-linux
path: openvpn/buildOvpn/*
Build-OpenVPN3-Linux:
name: 'Build-OpenVPN3-Ubuntu'
runs-on: ubuntu-20.04
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[linux]') ||
contains(github.event.head_commit.message, '[linux-openvpn]') ||
contains(github.event.head_commit.message, '[openvpn]')
strategy:
matrix:
arch: [x86_64] #, x86, arm32, arm64]
fail-fast: false
env:
O3: "${{ github.workspace }}/O3"
DEP_DIR: "${{ github.workspace }}/O3/deps"
DL: "${{ github.workspace }}/O3/dl"
CFLAGS: "-static-libgcc -g -O1 -ldl"
OPEN_SSL_VER: "1.1.1t"
steps:
- name: Set up build environment
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: g++ make libmbedtls-dev libssl-dev liblz4-dev cmake gcc-multilib g++-multilib libnl-genl-3-dev libcap-ng-dev libpam0g-dev
version: 1.0
- name: Creating work-folder
run: |
mkdir -pv ${{env.O3}}
mkdir -pv ${{env.DEP_DIR}}
mkdir -pv ${{env.DL}}
- name: 'Get openvpn'
uses: actions/checkout@v3
with:
repository: amnezia-vpn/openvpn3
ref: win-amezia
path: ${{env.O3}}/core
- name: 'Build dependencies'
working-directory: ${{env.O3}}
run: |
export MTLS=0
cd core/scripts/linux/
./build-all
- name: Build OpenSSL
run: |
curl https://www.openssl.org/source/openssl-${OPEN_SSL_VER}.tar.gz | tar zx
cd openssl-${OPEN_SSL_VER}
./Configure no-shared no-tests linux-x86_64 enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp -static-libgcc --openssldir=/usr/local/lib
echo "************************************************"
echo "******** Compiling OpenSSL..."
echo "************************************************"
make
echo "************************************************"
echo "******** Copying OpenSSL include folder and static libraries..."
# if you want to use OS-default SHARED openssl libraries - not necessary to compile it.
# Just copy required headers of OpenSSL (include folder)
sudo make install
- name: 'Build the OpenVPN 3 client wrapper'
working-directory: ${{env.O3}}
run: |
cd ${{env.O3}}/core
cp -rf openvpn/plugin/linux/ck-ovpn-plugin.h openvpn/transport/client/pluggable/ck-ovpn-plugin.h
mkdir build && cd build
cmake -DOPENSSL_ROOT_DIR=${{ github.workspace }}/openssl-${OPEN_SSL_VER} -DCMAKE_EXE_LINKER_FLAGS="-ldl -static-libgcc -static " ..
cmake --build . --config Release --target ovpncli
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: openvpn3-linux
path: ${{env.O3}}/core/build/test
github-release:
name: GitHub Release
needs: Build-OpenVPN-Linux
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Artifacts
uses: actions/download-artifact@v2
- name: Setup | Checksums
run: for file in $(find ./ -name 'o*' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Zip ALL
run: for file in *; do zip -r ${file%.*}.zip $file; done
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: openvpn-linux.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
ovpn3-release:
name: GitHub Release
needs: Build-OpenVPN3-Linux
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Artifacts
uses: actions/download-artifact@v2
- name: Setup | Checksums
run: for file in $(find ./ -name 'o*' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Zip ALL
run: for file in *; do zip -r ${file%.*}.zip $file; done
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: openvpn3-linux.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true