forked from EvilFreelancer/openvpn-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.php
41 lines (38 loc) · 1.26 KB
/
server.php
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
<?php
require_once __DIR__ . '/../vendor/autoload.php';
// Config object
$config = new \OpenVPN\Config();
// Set server options
$config
->set('dev', 'tun')
->set('proto', 'tcp')
->set('port', '1194')
->set('resolv-retry', 'infinite')
->set('cipher', 'AES-256-CBC')
->set('redirect-gateway', 'true')
->set('server', '10.8.0.0 255.255.255.0')
->set('keepalive', '10 120')
->set('reneg-sec', 18000)
->set('user', 'nobody')
->set('group', 'nogroup')
->set('persist-key', true)
->set('persist-tun', true)
->set('compLzo', true)
->set('verb', 3)
->set('mute', 20)
->set('status', '/var/log/openvpn/status.log')
->set('log-append', '/var/log/openvpn/openvpn.log')
->set('client-config-dir', 'ccd')
->set('script-security', 3)
->set('username-as-common-name', true)
->set('verify-client-cert', 'none')
->setCert('ca', '/etc/openvpn/ca.crt')
->setCert('cert', '/etc/openvpn/server.crt')
->setCert('key', '/etc/openvpn/server.key')
->setCert('dh', '/etc/openvpn/dh')
->setCert('tls-auth', '/etc/openvpn/ta.key 0')
->setPush('redirect-gateway def1')
->setPush('dhcp-option DNS 8.8.8.8')
->setPush('dhcp-option DNS 8.8.4.4');
// Generate config by options
echo $config->generate();