1
|
<?php
|
2
|
/*
|
3
|
* services_rfc2136.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
7
|
* All rights reserved.
|
8
|
*
|
9
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
* you may not use this file except in compliance with the License.
|
11
|
* You may obtain a copy of the License at
|
12
|
*
|
13
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
*
|
15
|
* Unless required by applicable law or agreed to in writing, software
|
16
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
* See the License for the specific language governing permissions and
|
19
|
* limitations under the License.
|
20
|
*/
|
21
|
|
22
|
##|+PRIV
|
23
|
##|*IDENT=page-services-rfc2136clients
|
24
|
##|*NAME=Services: RFC 2136 Clients
|
25
|
##|*DESCR=Allow access to the 'Services: RFC 2136 Clients' page.
|
26
|
##|*MATCH=services_rfc2136.php*
|
27
|
##|-PRIV
|
28
|
|
29
|
require_once("guiconfig.inc");
|
30
|
|
31
|
if (!is_array($config['dnsupdates'])) {
|
32
|
$config['dnsupdates'] = array();
|
33
|
}
|
34
|
|
35
|
if (!is_array($config['dnsupdates']['dnsupdate'])) {
|
36
|
$config['dnsupdates']['dnsupdate'] = array();
|
37
|
}
|
38
|
|
39
|
$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
|
40
|
|
41
|
if ($_POST['act'] == "del") {
|
42
|
unset($a_rfc2136[$_POST['id']]);
|
43
|
|
44
|
write_config();
|
45
|
|
46
|
header("Location: services_rfc2136.php");
|
47
|
exit;
|
48
|
} else if ($_POST['act'] == "toggle") {
|
49
|
if ($a_rfc2136[$_POST['id']]) {
|
50
|
if (isset($a_rfc2136[$_POST['id']]['enable'])) {
|
51
|
unset($a_rfc2136[$_POST['id']]['enable']);
|
52
|
} else {
|
53
|
$a_rfc2136[$_POST['id']]['enable'] = true;
|
54
|
}
|
55
|
write_config();
|
56
|
|
57
|
header("Location: services_rfc2136.php");
|
58
|
exit;
|
59
|
}
|
60
|
}
|
61
|
|
62
|
$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("RFC 2136 Clients"));
|
63
|
$pglinks = array("", "services_dyndns.php", "@self");
|
64
|
include("head.inc");
|
65
|
|
66
|
$tab_array = array();
|
67
|
$tab_array[] = array(gettext("Dynamic DNS Clients"), false, "services_dyndns.php");
|
68
|
$tab_array[] = array(gettext("RFC 2136 Clients"), true, "services_rfc2136.php");
|
69
|
$tab_array[] = array(gettext("Check IP Services"), false, "services_checkip.php");
|
70
|
display_top_tabs($tab_array);
|
71
|
|
72
|
if ($input_errors) {
|
73
|
print_input_errors($input_errors);
|
74
|
}
|
75
|
?>
|
76
|
|
77
|
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
|
78
|
<div class="panel panel-default">
|
79
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('RFC2136 Clients')?></h2></div>
|
80
|
<div class="panel-body">
|
81
|
<div class="table-responsive">
|
82
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
83
|
<thead>
|
84
|
<tr>
|
85
|
<th><?=gettext("Interface")?></th>
|
86
|
<th><?=gettext("Server")?></th>
|
87
|
<th><?=gettext("Hostname")?></th>
|
88
|
<th><?=gettext("Cached IP")?></th>
|
89
|
<th><?=gettext("Description")?></th>
|
90
|
<th><?=gettext("Actions")?></th>
|
91
|
</tr>
|
92
|
</thead>
|
93
|
<tbody>
|
94
|
<?php
|
95
|
|
96
|
|
97
|
$iflist = get_configured_interface_with_descr();
|
98
|
$groupslist = return_gateway_groups_array();
|
99
|
|
100
|
$i = 0;
|
101
|
foreach ($a_rfc2136 as $rfc2136):
|
102
|
?>
|
103
|
<tr<?=(isset($rfc2136['enable']) ? '' : ' class="disabled"')?>>
|
104
|
<td>
|
105
|
<?php
|
106
|
foreach ($iflist as $if => $ifdesc) {
|
107
|
if ($rfc2136['interface'] == $if) {
|
108
|
print($ifdesc);
|
109
|
break;
|
110
|
}
|
111
|
}
|
112
|
foreach ($groupslist as $if => $group) {
|
113
|
if ($rfc2136['interface'] == $if) {
|
114
|
print($if);
|
115
|
break;
|
116
|
}
|
117
|
}
|
118
|
?>
|
119
|
</td>
|
120
|
<td>
|
121
|
<?=htmlspecialchars($rfc2136['server'])?>
|
122
|
</td>
|
123
|
<td>
|
124
|
<?=htmlspecialchars($rfc2136['host'])?>
|
125
|
</td>
|
126
|
<td>
|
127
|
<?php
|
128
|
$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
|
129
|
$filename_v6 = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}_v6.cache";
|
130
|
$if = get_failover_interface($rfc2136['interface']);
|
131
|
|
132
|
if (file_exists($filename)) {
|
133
|
print('IPv4: ');
|
134
|
if (isset($rfc2136['usepublicip'])) {
|
135
|
$ipaddr = dyndnsCheckIP($if);
|
136
|
} else {
|
137
|
$ipaddr = get_interface_ip($if);
|
138
|
}
|
139
|
|
140
|
$cached_ip_s = explode("|", file_get_contents($filename));
|
141
|
$cached_ip = $cached_ip_s[0];
|
142
|
|
143
|
if ($ipaddr != $cached_ip) {
|
144
|
print('<span class="text-danger">');
|
145
|
} else {
|
146
|
print('<span class="text-success">');
|
147
|
}
|
148
|
|
149
|
print(htmlspecialchars($cached_ip));
|
150
|
print('</span>');
|
151
|
} else {
|
152
|
print('IPv4: N/A');
|
153
|
}
|
154
|
|
155
|
print('<br />');
|
156
|
|
157
|
if (file_exists($filename_v6)) {
|
158
|
print('IPv6: ');
|
159
|
$ipaddr = get_interface_ipv6($if);
|
160
|
$cached_ip_s = explode("|", file_get_contents($filename_v6));
|
161
|
$cached_ip = $cached_ip_s[0];
|
162
|
|
163
|
if ($ipaddr != $cached_ip) {
|
164
|
print('<span class="text-danger">');
|
165
|
} else {
|
166
|
print('<span class="text-success">');
|
167
|
}
|
168
|
|
169
|
print(htmlspecialchars($cached_ip));
|
170
|
print('</span>');
|
171
|
} else {
|
172
|
print('IPv6: N/A');
|
173
|
}
|
174
|
|
175
|
?>
|
176
|
</td>
|
177
|
<td>
|
178
|
<?=htmlspecialchars($rfc2136['descr'])?>
|
179
|
</td>
|
180
|
<td>
|
181
|
<a class="fa fa-pencil" title="<?=gettext('Edit client')?>" href="services_rfc2136_edit.php?id=<?=$i?>"></a>
|
182
|
<?php if (isset($rfc2136['enable'])) {
|
183
|
?>
|
184
|
<a class="fa fa-ban" title="<?=gettext('Disable client')?>" href="?act=toggle&id=<?=$i?>" usepost></a>
|
185
|
<?php } else {
|
186
|
?>
|
187
|
<a class="fa fa-check-square-o" title="<?=gettext('Enable client')?>" href="?act=toggle&id=<?=$i?>" usepost></a>
|
188
|
<?php }
|
189
|
?>
|
190
|
<a class="fa fa-trash" title="<?=gettext('Delete client')?>" href="services_rfc2136.php?act=del&id=<?=$i?>" usepost></a>
|
191
|
</td>
|
192
|
</tr>
|
193
|
<?php
|
194
|
$i++;
|
195
|
endforeach; ?>
|
196
|
|
197
|
</tbody>
|
198
|
</table>
|
199
|
</div>
|
200
|
</div>
|
201
|
</div>
|
202
|
</form>
|
203
|
|
204
|
<nav class="action-buttons">
|
205
|
<a href="services_rfc2136_edit.php" class="btn btn-sm btn-success btn-sm">
|
206
|
<i class="fa fa-plus icon-embed-btn"></i>
|
207
|
<?=gettext('Add')?>
|
208
|
</a>
|
209
|
</nav>
|
210
|
|
211
|
<?php
|
212
|
include("foot.inc");
|