Project

General

Profile

Download (1.9 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php-cgi -f
2
<?php
3
/*
4
 * rc.newipsecdns
5
 *
6
 * part of pfSense (https://www.pfsense.org)
7
 * Copyright (c) 2009 Seth Mos <seth.mos@dds.nl>.
8
 * Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * Originally part of m0n0wall (http://m0n0.ch/wall)
12
 * Copyright (c) 2007 Manuel Kasper <mk@neon1.net>.
13
 * All rights reserved.
14
 *
15
 * Licensed under the Apache License, Version 2.0 (the "License");
16
 * you may not use this file except in compliance with the License.
17
 * You may obtain a copy of the License at
18
 *
19
 * http://www.apache.org/licenses/LICENSE-2.0
20
 *
21
 * Unless required by applicable law or agreed to in writing, software
22
 * distributed under the License is distributed on an "AS IS" BASIS,
23
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
 * See the License for the specific language governing permissions and
25
 * limitations under the License.
26
 */
27

    
28
require_once("util.inc");
29
require_once("globals.inc");
30

    
31
/* make sure to wait until the boot scripts have finished */
32
if (file_exists("{$g['varrun_path']}/booting")) {
33
	return;
34
}
35

    
36
$ipseclck_pending = try_lock('ipsecdns_pending', 0);
37
if (!$ipseclck_pending) {
38
	/* if a vpn_ipsec_configure() is still pending no need to stack up another one */
39
	return;
40
}
41

    
42
/* parse the configuration and include all functions used below */
43
require_once("config.inc");
44
require_once("gwlb.inc");
45
require_once("functions.inc");
46
require_once("filter.inc");
47
require_once("shaper.inc");
48
require_once("auth.inc");
49
require_once("ipsec.inc");
50
require_once("vpn.inc");
51

    
52
if (!ipsec_enabled()) {
53
	unlock($ipseclck_pending);
54
	return;
55
}
56

    
57
$ipseclck = lock('ipsecdns', LOCK_EX);
58
sleep(12);
59
unlock($ipseclck_pending);
60
sleep(3);
61
log_error("IPSEC: One or more IPsec tunnel endpoints has changed its IP. Refreshing.");
62

    
63
/* make sure we have the latest configuration changes loaded. */
64
$config = parse_config();
65

    
66
vpn_ipsec_configure();
67

    
68
unlock($ipseclck);
(55-55/83)