Alternc  latest
Alternc logiel libre pour l'hébergement
adm_slavedns.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18  */
19 
20 /**
21  * Manage the list of SLAVE DNS machines account and IPs
22  * used for the transfer of zones in Bind and the list of domains in domlist.php
23  *
24  * @copyright AlternC-Team 2000-2017 https://alternc.com/
25  */
26 
27 require_once("../class/config.php");
28 
29 if (!$admin->enabled) {
30  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
31  echo $msg->msg_html_all();
32  exit();
33 }
34 
35 $fields = array (
36  "delaccount" => array ("request", "string", ""),
37  "newlogin" => array ("post", "string", ""),
38  "newpass" => array ("post", "string", ""),
39 
40  "delip" => array ("request", "string", ""),
41  "newip" => array ("post", "string", ""),
42  "newclass" => array ("post", "string", "32"),
43  );
45 
46 if ($delaccount) {
47  // Delete an account
48  if ($dom->del_slave_account($delaccount)) {
49  $msg->raise("INFO", "admin", _("The requested account has been deleted. It is now denied."));
50  }
51 }
52 if ($newlogin) {
53  // Add an account
54  if ($dom->add_slave_account($newlogin,$newpass)) {
55  $msg->raise("INFO", "admin", _("The requested account address has been created. It is now allowed."));
56  unset($newlogin); unset($newpass);
57  }
58 }
59 
60 if ($delip) {
61  // Delete an ip address/class
62  if ($dom->del_slave_ip($delip)) {
63  $msg->raise("INFO", "admin", _("The requested ip address has been deleted. It will be denied in one hour."));
64  }
65 }
66 if ($newip) {
67  // Add an ip address/class
68  if ($dom->add_slave_ip($newip,$newclass)) {
69  $msg->raise("INFO", "admin", _("The requested ip address has been added to the list. It will be allowed in one hour."));
70  unset($newip); unset($newclass);
71  }
72 }
73 
74 include_once("head.php");
75 
76 $c=$admin->listPasswordPolicies();
77 $passwd_classcount = $c['adm']['classcount'];
78 
79 ?>
80 <h3><?php __("Manage allowed ip for slave zone transfers"); ?></h3>
81 <hr id="topbar" />
82 <?php
83 
84 $c=$dom->enum_slave_ip();
85 
86 echo $msg->msg_html_all();
87 
88 if (is_array($c)) { ?>
89  <p>
90  <?php __("Here is the list of the allowed ip or ip class for slave dns zone transfer requests (AXFR). You must add the ip address of all the slave DNS you have so that those slaves will be allowed to transfer the zone files. There is also some defaults ip from DNS checks made by some third-party technical offices such as afnic (for .fr domains)"); ?>
91  </p>
92 
93  <table border="0" cellpadding="4" cellspacing="0" class='tlist'>
94  <tr><th><?php __("Action"); ?></th><th><?php __("IP Address"); ?></th></tr>
95  <?php
96  for($i=0;$i<count($c);$i++) {
97  ?>
98 
99  <tr class="lst">
100  <td class="center"><div class="ina delete"><a href="adm_slavedns.php?delip=<?php echo urlencode($c[$i]['ip']); ?>"><?php __("Delete"); ?></a></div></td>
101  <td><?php echo $c[$i]["ip"]."/".$c[$i]["class"]; ?></td>
102  </tr>
103  <?php
104  } //for
105  ?>
106  </table>
107 <?php } // is_array ($c) ?>
108 
109 <p><?php __("If you want to allow an ip address or class to connect to your dns server, enter it here. Choose 32 as a prefix for single ip address."); ?></p>
110 
111 <form method="post" action="adm_slavedns.php" name="main" id="main">
112  <?php csrf_get(); ?>
113  <table class="tedit">
114  <tr><th><label for="newip"><?php __("IP Address"); ?></label></th><th><label for="newclass"><?php __("Prefix"); ?></label></th></tr>
115  <tr>
116  <td style="text-align: right"><input type="text" class="int" value="<?php ehe( (isset($newip)?$newip:'') ); ?>" id="newip" name="newip" maxlength="15" size="20" style="text-align:right" /> / </td>
117  <td><input type="text" class="int" value="<?php ehe( (isset($newclass)?$newclass:'') ); ?>" id="newclass" name="newclass" maxlength="2" size="3" /></td>
118  </tr>
119  <tr>
120  <td colspan="2"><input type="submit" value="<?php __("Add this ip to the slave list"); ?>" class="inb" /></td>
121  </tr>
122  </table>
123 </form>
124 
125 <br/>
126 <br/>
127 <hr/>
128 
129 <h3><?php __("Manage allowed accounts for slave zone transfers"); ?></h3>
130 <hr id="topbar"/>
131 <br />
132 
133 <?php
134 $c=$dom->enum_slave_account();
135 
136 if (is_array($c)) { ?>
137  <p><?php __("Here is the list of the allowed accounts for slave dns synchronization. You can configure the alternc-slavedns package on your slave server and give him the login/pass that will grant him access to your server's domain list. "); ?></p>
138 
139  <table class="tlist">
140  <tr><th><?php __("Action"); ?></th><th><?php __("Login"); ?></th><th><?php __("Password"); ?></th></tr>
141  <?php
142  for($i=0;$i<count($c);$i++) { ?>
143 
144  <tr class="lst">
145  <td class="center"><div class="ina delete"><a href="adm_slavedns.php?delaccount=<?php echo urlencode($c[$i]["login"]); ?>"><?php __("Delete"); ?></a></div></td>
146  <td><?php ehe($c[$i]["login"]); ?></td>
147  <td><?php ehe($c[$i]["pass"]); ?></td>
148  </tr>
149  <?php
150  } // for ?>
151 </table>
152 <?php } // is_array ?>
153 
154 <p><?php __("If you want to allow a new server to access your domain list, give him an account."); ?></p>
155 
156 <form method="post" action="adm_slavedns.php" name="main" id="main" autocomplete="off">
157  <?php csrf_get(); ?>
158 <!-- honeypot fields -->
159 <input type="text" style="display: none" id="fakeUsername" name="fakeUsername" value="" />
160 <input type="password" style="display: none" id="fakePassword" name="fakePassword" value="" />
161 
162  <table class="tedit">
163  <tr><th><label for="newlogin"><?php __("Login"); ?></label></th><th><label for="newpass"><?php __("Password"); ?></label></th></tr>
164  <tr>
165  <td><input type="text" class="int" value="<?php ehe( isset($newlogin)?$newlogin:'') ; ?>" id="newlogin" name="newlogin" maxlength="64" size="32" /><br/><br/></td>
166  <td><input type="password" class="int" autocomplete="off" value="<?php ehe( (isset($newpass)?$newpass:'') ) ; ?>" id="newpass" name="newpass" maxlength="64" size="32" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#newpass","",$passwd_classcount); ?></td>
167  </tr>
168  <tr class="trbtn"><td colspan="2"><input type="submit" value="<?php __("Add this account to the allowed list"); ?>" class="inb" /></td></tr>
169  </table>
170 </form>
171 
172 <script type="text/javascript">
173  document.forms['main'].newip.focus();
174 $(function(){
175  $(".toggle-next").on("click",function(){
176 
177  var next = $(this).next();
178  next.toggle();
179  })
180 
181 });
182 </script>
183 
184 <style>
185 
186 .info {
187  background: none repeat scroll 0 0 white;
188  border: 1px solid #CCCCCC;
189  border-radius: 15px 15px 15px 15px;
190  margin: 16px 0;
191  padding: 0 16px;
192 }
193 .info-hide{
194 display:none;
195 }
196 </style>
197 <div class="info">
198 <h4 class="toggle toggle-next"><a href="javascript:void(0)" class="btn"> <?php __("Need open DNS Slave servers?"); ?> &#9660;</a></h4>
199 <div class="info-hide">
200 <p><?php __("We offer free of charge DNS servers for alternc users."); ?></p>
201 <h2><?php __("How does it work?"); ?> </h2>
202 <ol>
203  <li><?php printf(_("<strong>Give access to the alternc.net servers.</strong> Follow the instructions on <a href='%s' target='blank'>this page</a>. They will help you to configure this page and configure your alternc.net account."),"http://aide-alternc.org/go.php?hid=400"); ?></li>
204  <li><?php printf(_("<strong>Subscribe to alternc.net.</strong> Go to <a href='%s' target='_blank' class='btn btn-inline btn-link'>the alternc.net site</a> to use the DNS servers provided for free by the AlternC association and enter the required informations for each server you want to connect to the service."),"http://alternc.net/"); ?> </li>
205 </ol>
206 <br />
207 <p><?php __("The alternc.net servers will take care of transfering and distributing to the world your domains zones."); ?> </p>
208 </div><!-- info-hide -->
209 </div><!-- info -->
210 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
if(! $admin->enabled) $fields
Manage the list of SLAVE DNS machines account and IPs used for the transfer of zones in Bind and the ...
$c
$passwd_classcount
$msg
Definition: bootstrap.php:75
const DEFAULT_PASS_SIZE
Define constants from vars of /etc/alternc/local.sh The you can't choose where is the AlternC Panel.
Definition: config.php:81
display_div_generate_password($pass_size=DEFAULT_PASS_SIZE, $fields_to_fill1="", $fields_to_fill2="", $classcount=3)
Show a button to set a random password for a password field.
Definition: functions.php:922
ehe($str, $display=TRUE)
Echo the HTMLSpecialChars version of a value.
Definition: functions.php:647
__($str)
Definition: functions.php:404
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
Definition: functions.php:1159
$i
$dom
Definition: whois_test.php:10