137 foreach ($def_remaining_queries as $query) { |
145 foreach ($def_remaining_queries as $query) { |
138 $db->query($query); |
146 $db->query($query); |
139 } |
147 } |
140 echo _('done!') . "</p>"; |
148 echo _('done!') . "</p>"; |
141 |
149 |
142 echo "<p>" . _('We have now updated the PowerDNS database to work with Poweradmin. You now want to give limited rights to Poweradmin so it can update the data in the tables. To do this, you should create a new user and give it rights to select, delete, insert and update records in the PowerDNS database.') . " "; |
150 echo "<p>" . _('Now we will gather all details for the configuration itself.') . "</p>\n"; |
143 if ($db_type=='mysql') { |
151 echo "<form method=\"post\">"; |
|
152 echo " <table>"; |
|
153 echo " <tr>"; |
|
154 echo " <td>" . _('Username') . "</td>\n"; |
|
155 echo " <td><input type=\"text\" name=\"db_user\" value=\"\"></td>\n"; |
|
156 echo " <td>" . _('The username for Poweradmin. This new user will have limited rights only.') . "</td>\n"; |
|
157 echo " </tr>\n"; |
|
158 echo " <tr>\n"; |
|
159 echo " <td>" . _('Password') . "</td>\n"; |
|
160 echo " <td><input type=\"text\" name=\"db_pass\" value=\"\"></td>\n"; |
|
161 echo " <td>" . _('The password for this username.') . "</td>\n"; |
|
162 echo " </tr>\n"; |
|
163 echo " <tr>\n"; |
|
164 echo " <td>" . _('Hostmaster') . "</td>\n"; |
|
165 echo " <td><input type=\"text\" name=\"dns_hostmaster\" value=\"\"></td>\n"; |
|
166 echo " <td>" . _('When creating SOA records and no hostmaster is provided, this value here will be used. Should be in the form "hostmaster.example.net".') . "</td>\n"; |
|
167 echo " </tr>\n"; |
|
168 echo " <tr>\n"; |
|
169 echo " <td>" . _('Primary nameserver') . "</td>\n"; |
|
170 echo " <td><input type=\"text\" name=\"dns_ns1\" value=\"\"></td>\n"; |
|
171 echo " <td>" . _('When creating new zones using the template, this value will be used as primary nameserver. Should be like "ns1.example.net".') . "</td>\n"; |
|
172 echo " </tr>\n"; |
|
173 echo " <tr>\n"; |
|
174 echo " <td>" . _('Secondary nameserver') . "</td>\n";; |
|
175 echo " <td><input type=\"text\" name=\"dns_ns2\" value=\"\"></td>\n"; |
|
176 echo " <td>" . _('When creating new zones using the template, this value will be used as secondary nameserver. Should be like "ns2.example.net".') . "</td>\n"; |
|
177 echo " </tr>\n"; |
|
178 echo "</table>"; |
|
179 echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">"; |
|
180 echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">"; |
|
181 echo "<input type=\"hidden\" name=\"db_type\" value=\"" . $db_type . "\">"; |
|
182 echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">"; |
|
183 echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">"; |
|
184 echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">"; |
|
185 echo "</form>"; |
|
186 break; |
|
187 |
|
188 case 5: |
|
189 $step++; |
|
190 $db_user = $_POST['db_user']; |
|
191 $db_pass = $_POST['db_pass']; |
|
192 $db_host = $_POST['db_host']; |
|
193 $db_name = $_POST['db_name']; |
|
194 $db_type = $_POST['db_type']; |
|
195 $dns_hostmaster = $_POST['dns_hostmaster']; |
|
196 $dns_ns1 = $_POST['dns_ns1']; |
|
197 $dns_ns2 = $_POST['dns_ns2']; |
|
198 |
|
199 echo "<p>" . _('You now want to give limited rights to Poweradmin so it can update the data in the tables. To do this, you should create a new user and give it rights to select, delete, insert and update records in the PowerDNS database.') . " "; |
|
200 if ($db_type == 'mysql') { |
144 echo _('In MySQL you should now perform the following command:') . "</p>"; |
201 echo _('In MySQL you should now perform the following command:') . "</p>"; |
145 echo "<p><tt>GRANT SELECT, INSERT, UPDATE, DELETE<BR>ON powerdns-database.*<br>TO 'poweradmin-user'@'localhost'<br>IDENTIFIED BY 'poweradmin-password';</tt></p>"; |
202 echo "<p><tt>GRANT SELECT, INSERT, UPDATE, DELETE<BR>ON " . $db_name . ".*<br>TO '" . $db_user . "'@'" . $db_host . "'<br>IDENTIFIED BY '" . $db_pass . "';</tt></p>"; |
146 } elseif ($db_type == 'pgsql') { |
203 } elseif ($db_type == 'pgsql') { |
147 echo _('On PgSQL you would use:') . "</p>"; |
204 echo _('On PgSQL you would use:') . "</p>"; |
148 echo "<p><tt>$ createuser poweradmin-user<br>" . |
205 echo "<p><tt>$ createuser " . $db_user . "<br>" . |
149 "Shall the new role be a superuser? (y/n) n<br>" . |
206 "Shall the new role be a superuser? (y/n) n<br>" . |
150 "Shall the new user be allowed to create databases? (y/n) n<br>" . |
207 "Shall the new user be allowed to create databases? (y/n) n<br>" . |
151 "Shall the new user be allowed to create more new users? (y/n) n<br>" . |
208 "Shall the new user be allowed to create more new users? (y/n) n<br>" . |
152 "CREATE USER<br>" . |
209 "CREATE USER<br>" . |
153 "$ psql powerdns-database<br>" . |
210 "$ psql " . $db_name . "<br>" . |
154 "psql> GRANT SELECT, INSERT, DELETE, UPDATE<br>" . |
211 "psql> GRANT SELECT, INSERT, DELETE, UPDATE<br>" . |
155 "ON powerdns-database<br>" . |
212 "ON " . $db_name . "<br>" . |
156 "TO poweradmin-user;</tt></p>\n"; |
213 "TO " . $db_user . ";</tt></p>\n"; |
157 } |
214 } |
158 echo "<p>" . _('After you have added the new user, proceed with this installation procedure.') . "</p>\n"; |
215 echo "<p>" . _('After you have added the new user, proceed with this installation procedure.') . "</p>\n"; |
159 echo "<form method=\"post\">"; |
216 echo "<form method=\"post\">"; |
160 echo "<input type=\"hidden\" name=\"host\" value=\"" . $db_host . "\">"; |
|
161 echo "<input type=\"hidden\" name=\"name\" value=\"" . $db_name . "\">"; |
|
162 echo "<input type=\"hidden\" name=\"type\" value=\"" . $db_type . "\">"; |
|
163 echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">"; |
|
164 echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">"; |
|
165 echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">"; |
|
166 echo "</form>"; |
|
167 break; |
|
168 |
|
169 case 5: |
|
170 $step++; |
|
171 $db_host = $_POST['host']; |
|
172 $db_name = $_POST['name']; |
|
173 $db_type = $_POST['type']; |
|
174 echo "<p>" . _('Now we will put together the configuration. To do so, the installer needs some details:') . "</p>\n"; |
|
175 echo "<form method=\"post\">"; |
|
176 echo " <table>"; |
|
177 echo " <tr>"; |
|
178 echo " <td>" . _('Username') . "</td>\n"; |
|
179 echo " <td><input type=\"text\" name=\"db_user\" value=\"\"></td>\n"; |
|
180 echo " <td>" . _('The username as created in the previous step.') . "</td>\n"; |
|
181 echo " </tr>\n"; |
|
182 echo " <tr>\n"; |
|
183 echo " <td>" . _('Password') . "</td>\n"; |
|
184 echo " <td><input type=\"text\" name=\"db_pass\" value=\"\"></td>\n"; |
|
185 echo " <td>" . _('The password for this username.') . "</td>\n"; |
|
186 echo " </tr>\n"; |
|
187 echo " <tr>\n"; |
|
188 echo " <td>" . _('Hostmaster') . "</td>\n"; |
|
189 echo " <td><input type=\"text\" name=\"dns_hostmaster\" value=\"\"></td>\n"; |
|
190 echo " <td>" . _('When creating SOA records and no hostmaster is provided, this value here will be used. Should be in the form "hostmaster.example.net".') . "</td>\n"; |
|
191 echo " </tr>\n"; |
|
192 echo " <tr>\n"; |
|
193 echo " <td>" . _('Primary nameserver') . "</td>\n"; |
|
194 echo " <td><input type=\"text\" name=\"dns_ns1\" value=\"\"></td>\n"; |
|
195 echo " <td>" . _('When creating new zones using the template, this value will be used as primary nameserver. Should be like "ns1.example.net".') . "</td>\n"; |
|
196 echo " </tr>\n"; |
|
197 echo " <tr>\n"; |
|
198 echo " <td>" . _('Secondary nameserver') . "</td>\n";; |
|
199 echo " <td><input type=\"text\" name=\"dns_ns2\" value=\"\"></td>\n"; |
|
200 echo " <td>" . _('When creating new zones using the template, this value will be used as secondary nameserver. Should be like "ns2.example.net".') . "</td>\n"; |
|
201 echo " </tr>\n"; |
|
202 echo "</table>"; |
|
203 echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">"; |
217 echo "<input type=\"hidden\" name=\"db_host\" value=\"" . $db_host . "\">"; |
204 echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">"; |
218 echo "<input type=\"hidden\" name=\"db_name\" value=\"" . $db_name . "\">"; |
205 echo "<input type=\"hidden\" name=\"db_type\" value=\"" . $db_type . "\">"; |
219 echo "<input type=\"hidden\" name=\"db_type\" value=\"" . $db_type . "\">"; |
206 echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">"; |
220 echo "<input type=\"hidden\" name=\"db_user\" value=\"" . $db_user . "\">"; |
207 echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">"; |
221 echo "<input type=\"hidden\" name=\"db_pass\" value=\"" . $db_pass . "\">"; |
208 echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">"; |
222 echo "<input type=\"hidden\" name=\"dns_hostmaster\" value=\"" . $dns_hostmaster . "\">"; |
209 echo "</form>"; |
223 echo "<input type=\"hidden\" name=\"dns_ns1\" value=\"" . $dns_ns1 . "\">"; |
210 break; |
224 echo "<input type=\"hidden\" name=\"dns_ns2\" value=\"" . $dns_ns2 . "\">"; |
211 |
225 echo "<input type=\"hidden\" name=\"step\" value=\"" . $step . "\">"; |
|
226 echo "<input type=\"hidden\" name=\"language\" value=\"" . $language . "\">"; |
|
227 echo "<input type=\"submit\" name=\"submit\" value=\"" . _('Go to step') . " " . $step . "\">"; |
|
228 echo "</form>"; |
|
229 break; |
|
230 |
212 case 6: |
231 case 6: |
213 $step++; |
232 $step++; |
214 $config = "<?php\n\n" . |
233 $config = "<?php\n\n" . |
215 "\$db_host\t\t= \"" . $_POST['db_host'] . "\";\n" . |
234 "\$db_host\t\t= \"" . $_POST['db_host'] . "\";\n" . |
216 "\$db_user\t\t= \"" . $_POST['db_user'] . "\";\n" . |
235 "\$db_user\t\t= \"" . $_POST['db_user'] . "\";\n" . |