check for FQDN before creating db, etc.
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -172,6 +172,11 @@ class FroxlorInstall {
|
||||
$this->_data['mysql_access_host'] = $this->_data['serverip'];
|
||||
}
|
||||
|
||||
// check system-hostname to be a FQDN
|
||||
if ($this->_validate_ip($this->_data['servername'], true) !== false) {
|
||||
$this->_data['servername'] = '';
|
||||
}
|
||||
|
||||
if (isset($_POST['installstep'])
|
||||
&& $_POST['installstep'] == '1'
|
||||
&& $this->_data['admin_pass1'] == $this->_data['admin_pass2']
|
||||
@@ -199,16 +204,9 @@ class FroxlorInstall {
|
||||
|
||||
$content = "<table class=\"noborder\">";
|
||||
|
||||
// check system-hostname to be a FQDN
|
||||
$content .= $this->_status_message('begin', $this->_lng['install']['system_servername']);
|
||||
if ($this->_validate_ip($_SERVER['SERVER_NAME'], true) !== false) {
|
||||
$content .= $this->_status_message('red', $this->_lng['install']['servername_should_be_fqdn']);
|
||||
} else {
|
||||
$content .= $this->_status_message('green', 'OK');
|
||||
}
|
||||
|
||||
// check for mysql-root-connection
|
||||
$content .= $this->_status_message('begin', $this->_lng['install']['testing_mysql']);
|
||||
|
||||
$db_root = new db(
|
||||
$this->_data['mysql_host'],
|
||||
$this->_data['mysql_root_user'],
|
||||
@@ -218,7 +216,6 @@ class FroxlorInstall {
|
||||
// ok, if we are here, the database class is build up
|
||||
// (otherwise it would have already die'd this script)
|
||||
$content .= $this->_status_message('green', "OK");
|
||||
|
||||
// check for existing db
|
||||
$content .= $this->_backupExistingDatabase($db_root);
|
||||
// create unprivileged user and the database itself
|
||||
@@ -512,7 +509,7 @@ class FroxlorInstall {
|
||||
|
||||
// check for existing of former database
|
||||
$tables_exist = false;
|
||||
$sql = "SHOW TABLES FROM `".$this->_data['mysql_database']."`";
|
||||
$sql = "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '".$this->_data['mysql_database']."'";
|
||||
$result = $db_root->query($sql);
|
||||
|
||||
// check result
|
||||
|
||||
@@ -54,7 +54,7 @@ $lng['install']['admin_user'] = 'Administrator Username';
|
||||
$lng['install']['admin_pass1'] = 'Administrator Password';
|
||||
$lng['install']['admin_pass2'] = 'Administrator-Password (confirm)';
|
||||
$lng['install']['serversettings'] = 'Server settings';
|
||||
$lng['install']['servername'] = 'Server name (FQDN)';
|
||||
$lng['install']['servername'] = 'Server name (FQDN, no ip-address)';
|
||||
$lng['install']['serverip'] = 'Server IP';
|
||||
$lng['install']['webserver'] = 'Webserver';
|
||||
$lng['install']['apache2'] = 'Apache 2';
|
||||
@@ -63,8 +63,6 @@ $lng['install']['nginx'] = 'NGINX';
|
||||
$lng['install']['httpuser'] = 'HTTP username';
|
||||
$lng['install']['httpgroup'] = 'HTTP groupname';
|
||||
|
||||
$lng['install']['system_servername'] = 'System ServerName';
|
||||
$lng['install']['servername_should_be_fqdn'] = 'The servername should be a FQDN and not an IP address';
|
||||
$lng['install']['testing_mysql'] = 'Checking MySQL-root access...';
|
||||
$lng['install']['backup_old_db'] = 'Creating backup of old database...';
|
||||
$lng['install']['backup_binary_missing'] = 'Could not find mysqldump';
|
||||
|
||||
@@ -54,7 +54,7 @@ $lng['install']['admin_user'] = 'Administrator-Benutzername';
|
||||
$lng['install']['admin_pass1'] = 'Administrator-Passwort';
|
||||
$lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)';
|
||||
$lng['install']['serversettings'] = 'Servereinstellungen';
|
||||
$lng['install']['servername'] = 'Servername (FQDN)';
|
||||
$lng['install']['servername'] = 'Servername (FQDN, keine IP-Adresse)';
|
||||
$lng['install']['serverip'] = 'Server-IP';
|
||||
$lng['install']['webserver'] = 'Webserver';
|
||||
$lng['install']['apache2'] = 'Apache 2';
|
||||
@@ -63,8 +63,6 @@ $lng['install']['nginx'] = 'NGINX';
|
||||
$lng['install']['httpuser'] = 'HTTP Username';
|
||||
$lng['install']['httpgroup'] = 'HTTP Gruppenname';
|
||||
|
||||
$lng['install']['system_servername'] = 'System ServerName';
|
||||
$lng['install']['servername_should_be_fqdn'] = 'Der Servername sollte ein vollqualifizierter Domainname sein und keine IP Adresse.';
|
||||
$lng['install']['testing_mysql'] = 'Teste MySQL-Root Zugang...';
|
||||
$lng['install']['backup_old_db'] = 'Sicherung vorheriger Datenbank...';
|
||||
$lng['install']['backup_binary_missing'] = 'Konnte mysqldump nicht finden';
|
||||
|
||||
Reference in New Issue
Block a user