1 |
f1f60c92
|
Ermal Luçi
|
<?php
|
2 |
|
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* services_rfc2136.php
|
4 |
33f0b0d5
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
38809d47
|
Renato Botelho do Couto
|
* Copyright (c) 2004-2013 BSD Perimeter
|
7 |
|
|
* Copyright (c) 2013-2016 Electric Sheep Fencing
|
8 |
8f2f85c3
|
Luiz Otavio O Souza
|
* Copyright (c) 2014-2022 Rubicon Communications, LLC (Netgate)
|
9 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
10 |
33f0b0d5
|
Stephen Beaver
|
*
|
11 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
12 |
|
|
* you may not use this file except in compliance with the License.
|
13 |
|
|
* You may obtain a copy of the License at
|
14 |
33f0b0d5
|
Stephen Beaver
|
*
|
15 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
16 |
33f0b0d5
|
Stephen Beaver
|
*
|
17 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
18 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
19 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20 |
|
|
* See the License for the specific language governing permissions and
|
21 |
|
|
* limitations under the License.
|
22 |
33f0b0d5
|
Stephen Beaver
|
*/
|
23 |
f1f60c92
|
Ermal Luçi
|
|
24 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
25 |
|
|
##|*IDENT=page-services-rfc2136clients
|
26 |
5230f468
|
jim-p
|
##|*NAME=Services: RFC 2136 Clients
|
27 |
a57d9fa2
|
jim-p
|
##|*DESCR=Allow access to the 'Services: RFC 2136 Clients' page.
|
28 |
6b07c15a
|
Matthew Grooms
|
##|*MATCH=services_rfc2136.php*
|
29 |
|
|
##|-PRIV
|
30 |
|
|
|
31 |
c81ef6e2
|
Phil Davis
|
require_once("guiconfig.inc");
|
32 |
f1f60c92
|
Ermal Luçi
|
|
33 |
c6c398c6
|
jim-p
|
init_config_arr(array('dnsupdates', 'dnsupdate'));
|
34 |
f1f60c92
|
Ermal Luçi
|
$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
|
35 |
|
|
|
36 |
13541a81
|
Steve Beaver
|
if ($_POST['act'] == "del") {
|
37 |
|
|
unset($a_rfc2136[$_POST['id']]);
|
38 |
f1f60c92
|
Ermal Luçi
|
|
39 |
e85ae672
|
Renato Botelho do Couto
|
write_config("RFC 2136 client deleted");
|
40 |
f1f60c92
|
Ermal Luçi
|
|
41 |
e766bd84
|
bcyrill
|
header("Location: services_rfc2136.php");
|
42 |
|
|
exit;
|
43 |
13541a81
|
Steve Beaver
|
} else if ($_POST['act'] == "toggle") {
|
44 |
|
|
if ($a_rfc2136[$_POST['id']]) {
|
45 |
|
|
if (isset($a_rfc2136[$_POST['id']]['enable'])) {
|
46 |
|
|
unset($a_rfc2136[$_POST['id']]['enable']);
|
47 |
e85ae672
|
Renato Botelho do Couto
|
$action = "disabled";
|
48 |
c5d81fdf
|
heper
|
} else {
|
49 |
13541a81
|
Steve Beaver
|
$a_rfc2136[$_POST['id']]['enable'] = true;
|
50 |
e85ae672
|
Renato Botelho do Couto
|
$action = "enabled";
|
51 |
c5d81fdf
|
heper
|
}
|
52 |
e85ae672
|
Renato Botelho do Couto
|
write_config("RFC 2136 {$action}");
|
53 |
919d91f9
|
Phil Davis
|
|
54 |
c5d81fdf
|
heper
|
header("Location: services_rfc2136.php");
|
55 |
|
|
exit;
|
56 |
|
|
}
|
57 |
|
|
}
|
58 |
f1f60c92
|
Ermal Luçi
|
|
59 |
bf40071d
|
Phil Davis
|
$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("RFC 2136 Clients"));
|
60 |
edcd7535
|
Phil Davis
|
$pglinks = array("", "services_dyndns.php", "@self");
|
61 |
f1f60c92
|
Ermal Luçi
|
include("head.inc");
|
62 |
a5d5b1f7
|
sbeaver
|
|
63 |
|
|
$tab_array = array();
|
64 |
c8f6b745
|
k-paulius
|
$tab_array[] = array(gettext("Dynamic DNS Clients"), false, "services_dyndns.php");
|
65 |
|
|
$tab_array[] = array(gettext("RFC 2136 Clients"), true, "services_rfc2136.php");
|
66 |
39d2f39d
|
NOYB
|
$tab_array[] = array(gettext("Check IP Services"), false, "services_checkip.php");
|
67 |
a5d5b1f7
|
sbeaver
|
display_top_tabs($tab_array);
|
68 |
|
|
|
69 |
20db3e1a
|
Phil Davis
|
if ($input_errors) {
|
70 |
060ed238
|
Stephen Beaver
|
print_input_errors($input_errors);
|
71 |
20db3e1a
|
Phil Davis
|
}
|
72 |
f1f60c92
|
Ermal Luçi
|
?>
|
73 |
|
|
|
74 |
|
|
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
|
75 |
060ed238
|
Stephen Beaver
|
<div class="panel panel-default">
|
76 |
f0efd690
|
Phil Davis
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('RFC2136 Clients')?></h2></div>
|
77 |
060ed238
|
Stephen Beaver
|
<div class="panel-body">
|
78 |
|
|
<div class="table-responsive">
|
79 |
1c10ce97
|
PiBa-NL
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
80 |
060ed238
|
Stephen Beaver
|
<thead>
|
81 |
|
|
<tr>
|
82 |
9447acda
|
Viktor G
|
<th><?=gettext("Status")?></th>
|
83 |
f0efd690
|
Phil Davis
|
<th><?=gettext("Interface")?></th>
|
84 |
060ed238
|
Stephen Beaver
|
<th><?=gettext("Server")?></th>
|
85 |
|
|
<th><?=gettext("Hostname")?></th>
|
86 |
|
|
<th><?=gettext("Cached IP")?></th>
|
87 |
|
|
<th><?=gettext("Description")?></th>
|
88 |
f0efd690
|
Phil Davis
|
<th><?=gettext("Actions")?></th>
|
89 |
060ed238
|
Stephen Beaver
|
</tr>
|
90 |
|
|
</thead>
|
91 |
|
|
<tbody>
|
92 |
f1f60c92
|
Ermal Luçi
|
<?php
|
93 |
30a40ca8
|
sbeaver
|
|
94 |
|
|
|
95 |
|
|
$iflist = get_configured_interface_with_descr();
|
96 |
c7127a13
|
jim-p
|
$groupslist = return_gateway_groups_array();
|
97 |
30a40ca8
|
sbeaver
|
|
98 |
a5d5b1f7
|
sbeaver
|
$i = 0;
|
99 |
|
|
foreach ($a_rfc2136 as $rfc2136):
|
100 |
9447acda
|
Viktor G
|
$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
|
101 |
|
|
$filename_v6 = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}_v6.cache";
|
102 |
|
|
$if = get_failover_interface($rfc2136['interface']);
|
103 |
|
|
|
104 |
|
|
if (file_exists($filename)) {
|
105 |
|
|
if (isset($rfc2136['usepublicip'])) {
|
106 |
|
|
$ipaddr = dyndnsCheckIP($if);
|
107 |
|
|
} else {
|
108 |
|
|
$ipaddr = get_interface_ip($if);
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
$cached_ip_s = explode("|", file_get_contents($filename));
|
112 |
|
|
$cached_ip = $cached_ip_s[0];
|
113 |
|
|
|
114 |
|
|
if ($ipaddr == $cached_ip) {
|
115 |
|
|
$icon_class = "fa fa-check-circle";
|
116 |
|
|
$text_class = "text-success";
|
117 |
|
|
$icon_title = "Updated";
|
118 |
|
|
} else {
|
119 |
|
|
$icon_class = "fa fa-times-circle";
|
120 |
|
|
$text_class = "text-danger";
|
121 |
|
|
$icon_title = "Failed";
|
122 |
|
|
}
|
123 |
|
|
} elseif (file_exists($filename_v6)) {
|
124 |
|
|
$ipv6addr = get_interface_ipv6($if);
|
125 |
|
|
$cached_ipv6_s = explode("|", file_get_contents($filename_v6));
|
126 |
|
|
$cached_ipv6 = $cached_ip_s[0];
|
127 |
|
|
|
128 |
|
|
if ($ipv6addr == $cached_ipv6) {
|
129 |
|
|
$icon_class = "fa fa-check-circle";
|
130 |
|
|
$text_class = "text-success";
|
131 |
|
|
$icon_title = "Updated";
|
132 |
|
|
} else {
|
133 |
|
|
$icon_class = "fa fa-times-circle";
|
134 |
|
|
$text_class = "text-danger";
|
135 |
|
|
$icon_title = "Failed";
|
136 |
|
|
}
|
137 |
|
|
}
|
138 |
f1f60c92
|
Ermal Luçi
|
?>
|
139 |
060ed238
|
Stephen Beaver
|
<tr<?=(isset($rfc2136['enable']) ? '' : ' class="disabled"')?>>
|
140 |
|
|
<td>
|
141 |
9447acda
|
Viktor G
|
<i class="<?=$icon_class?> <?=$text_class?>" title="<?=$icon_title?>"></i>
|
142 |
|
|
</td>
|
143 |
|
|
<td>
|
144 |
a5d5b1f7
|
sbeaver
|
<?php
|
145 |
|
|
foreach ($iflist as $if => $ifdesc) {
|
146 |
060ed238
|
Stephen Beaver
|
if ($rfc2136['interface'] == $if) {
|
147 |
|
|
print($ifdesc);
|
148 |
a5d5b1f7
|
sbeaver
|
break;
|
149 |
060ed238
|
Stephen Beaver
|
}
|
150 |
a5d5b1f7
|
sbeaver
|
}
|
151 |
c7127a13
|
jim-p
|
foreach ($groupslist as $if => $group) {
|
152 |
|
|
if ($rfc2136['interface'] == $if) {
|
153 |
|
|
print($if);
|
154 |
|
|
break;
|
155 |
|
|
}
|
156 |
|
|
}
|
157 |
a5d5b1f7
|
sbeaver
|
?>
|
158 |
060ed238
|
Stephen Beaver
|
</td>
|
159 |
|
|
<td>
|
160 |
|
|
<?=htmlspecialchars($rfc2136['server'])?>
|
161 |
|
|
</td>
|
162 |
|
|
<td>
|
163 |
|
|
<?=htmlspecialchars($rfc2136['host'])?>
|
164 |
|
|
</td>
|
165 |
|
|
<td>
|
166 |
a5d5b1f7
|
sbeaver
|
<?php
|
167 |
|
|
if (file_exists($filename)) {
|
168 |
|
|
print('IPv4: ');
|
169 |
9447acda
|
Viktor G
|
print("<span class='{$text_class}'>");
|
170 |
67e58c2c
|
Luiz Otavio O Souza
|
print(htmlspecialchars($cached_ip));
|
171 |
9c9617a5
|
Jared Dillard
|
print('</span>');
|
172 |
9447acda
|
Viktor G
|
} elseif (file_exists($filename_v6)) {
|
173 |
|
|
print("<span class='{$text_class}'>");
|
174 |
|
|
print(htmlspecialchars($cached_ipv6));
|
175 |
|
|
print('</span>');
|
176 |
a5d5b1f7
|
sbeaver
|
} else {
|
177 |
|
|
print('IPv4: N/A');
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
print('<br />');
|
181 |
|
|
|
182 |
474def89
|
Renato Botelho
|
if (file_exists($filename_v6)) {
|
183 |
a5d5b1f7
|
sbeaver
|
print('IPv6: ');
|
184 |
c7127a13
|
jim-p
|
$ipaddr = get_interface_ipv6($if);
|
185 |
474def89
|
Renato Botelho
|
$cached_ip_s = explode("|", file_get_contents($filename_v6));
|
186 |
a5d5b1f7
|
sbeaver
|
$cached_ip = $cached_ip_s[0];
|
187 |
|
|
|
188 |
20db3e1a
|
Phil Davis
|
if ($ipaddr != $cached_ip) {
|
189 |
9c9617a5
|
Jared Dillard
|
print('<span class="text-danger">');
|
190 |
20db3e1a
|
Phil Davis
|
} else {
|
191 |
9c9617a5
|
Jared Dillard
|
print('<span class="text-success">');
|
192 |
20db3e1a
|
Phil Davis
|
}
|
193 |
a5d5b1f7
|
sbeaver
|
|
194 |
|
|
print(htmlspecialchars($cached_ip));
|
195 |
9c9617a5
|
Jared Dillard
|
print('</span>');
|
196 |
a5d5b1f7
|
sbeaver
|
} else {
|
197 |
|
|
print('IPv6: N/A');
|
198 |
|
|
}
|
199 |
|
|
|
200 |
|
|
?>
|
201 |
060ed238
|
Stephen Beaver
|
</td>
|
202 |
|
|
<td>
|
203 |
|
|
<?=htmlspecialchars($rfc2136['descr'])?>
|
204 |
|
|
</td>
|
205 |
|
|
<td>
|
206 |
|
|
<a class="fa fa-pencil" title="<?=gettext('Edit client')?>" href="services_rfc2136_edit.php?id=<?=$i?>"></a>
|
207 |
|
|
<?php if (isset($rfc2136['enable'])) {
|
208 |
|
|
?>
|
209 |
13541a81
|
Steve Beaver
|
<a class="fa fa-ban" title="<?=gettext('Disable client')?>" href="?act=toggle&id=<?=$i?>" usepost></a>
|
210 |
060ed238
|
Stephen Beaver
|
<?php } else {
|
211 |
|
|
?>
|
212 |
13541a81
|
Steve Beaver
|
<a class="fa fa-check-square-o" title="<?=gettext('Enable client')?>" href="?act=toggle&id=<?=$i?>" usepost></a>
|
213 |
060ed238
|
Stephen Beaver
|
<?php }
|
214 |
|
|
?>
|
215 |
08a0e055
|
Viktor G
|
<a class="fa fa-clone" title="<?=gettext('Copy client')?>" href="services_rfc2136_edit.php?dup=<?=$i?>"></a>
|
216 |
13541a81
|
Steve Beaver
|
<a class="fa fa-trash" title="<?=gettext('Delete client')?>" href="services_rfc2136.php?act=del&id=<?=$i?>" usepost></a>
|
217 |
060ed238
|
Stephen Beaver
|
</td>
|
218 |
|
|
</tr>
|
219 |
a5d5b1f7
|
sbeaver
|
<?php
|
220 |
060ed238
|
Stephen Beaver
|
$i++;
|
221 |
a5d5b1f7
|
sbeaver
|
endforeach; ?>
|
222 |
|
|
|
223 |
060ed238
|
Stephen Beaver
|
</tbody>
|
224 |
|
|
</table>
|
225 |
|
|
</div>
|
226 |
|
|
</div>
|
227 |
|
|
</div>
|
228 |
f1f60c92
|
Ermal Luçi
|
</form>
|
229 |
a5d5b1f7
|
sbeaver
|
|
230 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
231 |
782922c2
|
Stephen Beaver
|
<a href="services_rfc2136_edit.php" class="btn btn-sm btn-success btn-sm">
|
232 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
233 |
782922c2
|
Stephen Beaver
|
<?=gettext('Add')?>
|
234 |
|
|
</a>
|
235 |
a5d5b1f7
|
sbeaver
|
</nav>
|
236 |
|
|
|
237 |
a88079e0
|
jim-p
|
<div>
|
238 |
|
|
<?=sprintf(gettext('Entries with a %3$s status column icon and IP address appearing in %1$sgreen%2$s are up to date with Dynamic DNS provider. '), '<span class="text-success">', '</span>', '<i class="fa fa-check-circle text-success"></i>')?>
|
239 |
|
|
<?=gettext('An update can be forced on the edit page for an entry.')?>
|
240 |
|
|
</div>
|
241 |
|
|
|
242 |
a5d5b1f7
|
sbeaver
|
<?php
|
243 |
c5d81fdf
|
heper
|
include("foot.inc");
|