Project

General

Profile

Download (2 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-2013 BSD Perimeter
9
 * Copyright (c) 2013-2016 Electric Sheep Fencing
10
 * Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
11
 * All rights reserved.
12
 *
13
 * Originally part of m0n0wall (http://m0n0.ch/wall)
14
 * Copyright (c) 2007 Manuel Kasper <mk@neon1.net>.
15
 * All rights reserved.
16
 *
17
 * Licensed under the Apache License, Version 2.0 (the "License");
18
 * you may not use this file except in compliance with the License.
19
 * You may obtain a copy of the License at
20
 *
21
 * http://www.apache.org/licenses/LICENSE-2.0
22
 *
23
 * Unless required by applicable law or agreed to in writing, software
24
 * distributed under the License is distributed on an "AS IS" BASIS,
25
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
 * See the License for the specific language governing permissions and
27
 * limitations under the License.
28
 */
29

    
30
require_once("util.inc");
31
require_once("globals.inc");
32

    
33
/* make sure to wait until the boot scripts have finished */
34
if (is_platform_booting()) {
35
	return;
36
}
37

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

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

    
54
if (!ipsec_enabled()) {
55
	unlock($ipseclck_pending);
56
	return;
57
}
58

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

    
65
/* make sure we have the latest configuration changes loaded. */
66
config_read_file(true, true);
67

    
68
ipsec_configure();
69

    
70
unlock($ipseclck);
71

    
72
ipsec_reload_package_hook();
(55-55/85)