1 |
f1f60c92
|
Ermal Luçi
|
<?php
|
2 |
|
|
/*
|
3 |
ce77a9c4
|
Phil Davis
|
services_rfc2136.php
|
4 |
f1f60c92
|
Ermal Luçi
|
*/
|
5 |
33f0b0d5
|
Stephen Beaver
|
/* ====================================================================
|
6 |
|
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
|
|
*
|
8 |
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
9 |
|
|
* are permitted provided that the following conditions are met:
|
10 |
|
|
*
|
11 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
12 |
|
|
* this list of conditions and the following disclaimer.
|
13 |
|
|
*
|
14 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
15 |
|
|
* notice, this list of conditions and the following disclaimer in
|
16 |
|
|
* the documentation and/or other materials provided with the
|
17 |
|
|
* distribution.
|
18 |
|
|
*
|
19 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
20 |
|
|
* must display the following acknowledgment:
|
21 |
|
|
* "This product includes software developed by the pfSense Project
|
22 |
|
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
23 |
|
|
*
|
24 |
|
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
25 |
|
|
* endorse or promote products derived from this software without
|
26 |
|
|
* prior written permission. For written permission, please contact
|
27 |
|
|
* coreteam@pfsense.org.
|
28 |
|
|
*
|
29 |
|
|
* 5. Products derived from this software may not be called "pfSense"
|
30 |
|
|
* nor may "pfSense" appear in their names without prior written
|
31 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
32 |
|
|
*
|
33 |
|
|
* 6. Redistributions of any form whatsoever must retain the following
|
34 |
|
|
* acknowledgment:
|
35 |
|
|
*
|
36 |
|
|
* "This product includes software developed by the pfSense Project
|
37 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
38 |
|
|
*
|
39 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
40 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
41 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
42 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
43 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
44 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
45 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
46 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
48 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
49 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
50 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
51 |
|
|
*
|
52 |
|
|
* ====================================================================
|
53 |
|
|
*
|
54 |
|
|
*/
|
55 |
1d333258
|
Scott Ullrich
|
/*
|
56 |
|
|
pfSense_MODULE: dnsupdate
|
57 |
|
|
*/
|
58 |
f1f60c92
|
Ermal Luçi
|
|
59 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
60 |
|
|
##|*IDENT=page-services-rfc2136clients
|
61 |
5230f468
|
jim-p
|
##|*NAME=Services: RFC 2136 Clients
|
62 |
a57d9fa2
|
jim-p
|
##|*DESCR=Allow access to the 'Services: RFC 2136 Clients' page.
|
63 |
6b07c15a
|
Matthew Grooms
|
##|*MATCH=services_rfc2136.php*
|
64 |
|
|
##|-PRIV
|
65 |
|
|
|
66 |
f1f60c92
|
Ermal Luçi
|
require("guiconfig.inc");
|
67 |
|
|
|
68 |
efdf8358
|
Phil Davis
|
if (!is_array($config['dnsupdates']['dnsupdate'])) {
|
69 |
f1f60c92
|
Ermal Luçi
|
$config['dnsupdates']['dnsupdate'] = array();
|
70 |
efdf8358
|
Phil Davis
|
}
|
71 |
f1f60c92
|
Ermal Luçi
|
|
72 |
|
|
$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
|
73 |
|
|
|
74 |
|
|
if ($_GET['act'] == "del") {
|
75 |
e766bd84
|
bcyrill
|
unset($a_rfc2136[$_GET['id']]);
|
76 |
f1f60c92
|
Ermal Luçi
|
|
77 |
e766bd84
|
bcyrill
|
write_config();
|
78 |
f1f60c92
|
Ermal Luçi
|
|
79 |
e766bd84
|
bcyrill
|
header("Location: services_rfc2136.php");
|
80 |
|
|
exit;
|
81 |
f1f60c92
|
Ermal Luçi
|
}
|
82 |
c5d81fdf
|
heper
|
else if ($_GET['act'] == "toggle") {
|
83 |
|
|
if ($a_rfc2136[$_GET['id']]) {
|
84 |
|
|
if (isset($a_rfc2136[$_GET['id']]['enable'])) {
|
85 |
|
|
unset($a_rfc2136[$_GET['id']]['enable']);
|
86 |
|
|
} else {
|
87 |
|
|
$a_rfc2136[$_GET['id']]['enable'] = true;
|
88 |
|
|
}
|
89 |
|
|
write_config();
|
90 |
919d91f9
|
Phil Davis
|
|
91 |
c5d81fdf
|
heper
|
header("Location: services_rfc2136.php");
|
92 |
|
|
exit;
|
93 |
|
|
}
|
94 |
|
|
}
|
95 |
f1f60c92
|
Ermal Luçi
|
|
96 |
a57d9fa2
|
jim-p
|
$pgtitle = array(gettext("Services"), gettext("RFC 2136 Clients"));
|
97 |
f1f60c92
|
Ermal Luçi
|
include("head.inc");
|
98 |
a5d5b1f7
|
sbeaver
|
|
99 |
|
|
$tab_array = array();
|
100 |
|
|
$tab_array[] = array(gettext("DynDns"), false, "services_dyndns.php");
|
101 |
|
|
$tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php");
|
102 |
|
|
display_top_tabs($tab_array);
|
103 |
|
|
|
104 |
|
|
if ($input_errors)
|
105 |
|
|
print_input_errors($input_errors);
|
106 |
f1f60c92
|
Ermal Luçi
|
?>
|
107 |
|
|
|
108 |
|
|
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
|
109 |
a5d5b1f7
|
sbeaver
|
<div class="table-responsive">
|
110 |
|
|
<table class="table table-striped table-hover table-condensed">
|
111 |
|
|
<thead>
|
112 |
|
|
<tr>
|
113 |
|
|
<th><?=gettext("If")?></th>
|
114 |
|
|
<th><?=gettext("Server")?></th>
|
115 |
|
|
<th><?=gettext("Hostname")?></th>
|
116 |
|
|
<th><?=gettext("Cached IP")?></th>
|
117 |
|
|
<th><?=gettext("Description")?></th>
|
118 |
|
|
<th></th>
|
119 |
|
|
</tr>
|
120 |
|
|
</thead>
|
121 |
|
|
<tbody>
|
122 |
f1f60c92
|
Ermal Luçi
|
<?php
|
123 |
30a40ca8
|
sbeaver
|
|
124 |
|
|
|
125 |
|
|
$iflist = get_configured_interface_with_descr();
|
126 |
|
|
|
127 |
a5d5b1f7
|
sbeaver
|
$i = 0;
|
128 |
|
|
foreach ($a_rfc2136 as $rfc2136):
|
129 |
f1f60c92
|
Ermal Luçi
|
?>
|
130 |
30a40ca8
|
sbeaver
|
<tr <?=(isset($rfc2136['enable']) ? '' : 'class="disabled"')?>">
|
131 |
a5d5b1f7
|
sbeaver
|
<td>
|
132 |
|
|
<?php
|
133 |
|
|
foreach ($iflist as $if => $ifdesc) {
|
134 |
|
|
if ($rfc2136['interface'] == $if) {
|
135 |
30a40ca8
|
sbeaver
|
print($ifdesc);
|
136 |
a5d5b1f7
|
sbeaver
|
break;
|
137 |
|
|
}
|
138 |
|
|
}
|
139 |
|
|
?>
|
140 |
|
|
</td>
|
141 |
|
|
<td>
|
142 |
30a40ca8
|
sbeaver
|
<?=htmlspecialchars($rfc2136['server'])?>
|
143 |
a5d5b1f7
|
sbeaver
|
</td>
|
144 |
|
|
<td>
|
145 |
30a40ca8
|
sbeaver
|
<?=htmlspecialchars($rfc2136['host'])?>
|
146 |
a5d5b1f7
|
sbeaver
|
</td>
|
147 |
|
|
<td>
|
148 |
|
|
<?php
|
149 |
|
|
$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
|
150 |
|
|
|
151 |
|
|
if (file_exists($filename)) {
|
152 |
|
|
print('IPv4: ');
|
153 |
|
|
if (isset($rfc2136['usepublicip']))
|
154 |
|
|
$ipaddr = dyndnsCheckIP($rfc2136['interface']);
|
155 |
|
|
else
|
156 |
|
|
$ipaddr = get_interface_ip($rfc2136['interface']);
|
157 |
|
|
|
158 |
|
|
$cached_ip_s = explode("|", file_get_contents($filename));
|
159 |
|
|
$cached_ip = $cached_ip_s[0];
|
160 |
|
|
|
161 |
|
|
if ($ipaddr != $cached_ip)
|
162 |
9c9617a5
|
Jared Dillard
|
print('<span class="text-danger">');
|
163 |
a5d5b1f7
|
sbeaver
|
else
|
164 |
9c9617a5
|
Jared Dillard
|
print('<span class="text-success">');
|
165 |
a5d5b1f7
|
sbeaver
|
|
166 |
67e58c2c
|
Luiz Otavio O Souza
|
print(htmlspecialchars($cached_ip));
|
167 |
9c9617a5
|
Jared Dillard
|
print('</span>');
|
168 |
a5d5b1f7
|
sbeaver
|
} else {
|
169 |
|
|
print('IPv4: N/A');
|
170 |
|
|
}
|
171 |
|
|
|
172 |
|
|
print('<br />');
|
173 |
|
|
|
174 |
|
|
if (file_exists("{$filename}.ipv6")) {
|
175 |
|
|
print('IPv6: ');
|
176 |
|
|
$ipaddr = get_interface_ipv6($rfc2136['interface']);
|
177 |
|
|
$cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));
|
178 |
|
|
$cached_ip = $cached_ip_s[0];
|
179 |
|
|
|
180 |
|
|
if ($ipaddr != $cached_ip)
|
181 |
9c9617a5
|
Jared Dillard
|
print('<span class="text-danger">');
|
182 |
a5d5b1f7
|
sbeaver
|
else
|
183 |
9c9617a5
|
Jared Dillard
|
print('<span class="text-success">');
|
184 |
a5d5b1f7
|
sbeaver
|
|
185 |
|
|
print(htmlspecialchars($cached_ip));
|
186 |
9c9617a5
|
Jared Dillard
|
print('</span>');
|
187 |
a5d5b1f7
|
sbeaver
|
} else {
|
188 |
|
|
print('IPv6: N/A');
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
?>
|
192 |
c5d81fdf
|
heper
|
</td>
|
193 |
2c59e1e6
|
heper
|
<td>
|
194 |
|
|
<?=htmlspecialchars($rfc2136['descr'])?>
|
195 |
|
|
</td>
|
196 |
|
|
<td>
|
197 |
33f0b0d5
|
Stephen Beaver
|
<a class="fa fa-pencil" title="<?=gettext('Edit client')?>" href="services_rfc2136_edit.php?id=<?=$i?>"></a>
|
198 |
2c59e1e6
|
heper
|
<?php if (isset($rfc2136['enable'])) {
|
199 |
919d91f9
|
Phil Davis
|
?>
|
200 |
33f0b0d5
|
Stephen Beaver
|
<a class="fa fa-ban" title="<?=gettext('Disable client')?>" href="?act=toggle&id=<?=$i?>"></a>
|
201 |
2c59e1e6
|
heper
|
<?php } else {
|
202 |
|
|
?>
|
203 |
33f0b0d5
|
Stephen Beaver
|
<a class="fa fa-check-square-o" title="<?=gettext('Enable client')?>" href="?act=toggle&id=<?=$i?>" ></a>
|
204 |
2c59e1e6
|
heper
|
<?php }
|
205 |
919d91f9
|
Phil Davis
|
?>
|
206 |
33f0b0d5
|
Stephen Beaver
|
<a class="fa fa-trash" title="<?=gettext('Delete client')?>" href="services_rfc2136.php?act=del&id=<?=$i?>"></a>
|
207 |
2c59e1e6
|
heper
|
</td>
|
208 |
|
|
</tr>
|
209 |
a5d5b1f7
|
sbeaver
|
<?php
|
210 |
|
|
$i++;
|
211 |
|
|
endforeach; ?>
|
212 |
|
|
|
213 |
|
|
</tbody>
|
214 |
|
|
</table>
|
215 |
|
|
</div>
|
216 |
f1f60c92
|
Ermal Luçi
|
</form>
|
217 |
a5d5b1f7
|
sbeaver
|
|
218 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
219 |
782922c2
|
Stephen Beaver
|
<a href="services_rfc2136_edit.php" class="btn btn-sm btn-success btn-sm">
|
220 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
221 |
782922c2
|
Stephen Beaver
|
<?=gettext('Add')?>
|
222 |
|
|
</a>
|
223 |
a5d5b1f7
|
sbeaver
|
</nav>
|
224 |
|
|
|
225 |
|
|
<?php
|
226 |
c5d81fdf
|
heper
|
include("foot.inc");
|