Merge branch 'master' into patch-1

This commit is contained in:
Km 2019-07-12 21:36:34 +02:00 committed by GitHub
commit d770c70218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 18 deletions

View File

@ -106,7 +106,7 @@ class m_admin {
);
$obj['links'][] = array(
'txt' => _("PhpMyAdmin"),
'url' => '/alternc-sql/',
'url' => 'sql_pma_sso.php',
'class' => 'adminmenu',
'target' => '_blank',
);

View File

@ -1928,7 +1928,7 @@ class m_dom {
}
if ($onedom["dns_action"]=="DELETE") {
$db->query("DELETE FROM domaines WHERE domaine=?;",array($onedom));
$db->query("DELETE FROM domaines WHERE domaine=?;",array($onedom['domaine']));
} else {
// we keep the highest result returned by hooks...
rsort($ret,SORT_NUMERIC); $returncode=$ret[0];

View File

@ -157,9 +157,15 @@ class m_mysql {
function php_myadmin_connect() {
global $db, $cuid, $msg;
$msg->log("mysql", "php_myadmin_connect");
$db->query("SELECT count(0) as count from db where uid = ?;", array($cuid));
$db->next_record();
if ($db->f('count') == 0) {
$msg->raise("ERROR", "mysql", _("Cannot connect to PhpMyAdmin, no databases for user {$cuid}"));
return false;
}
$db->query("SELECT dbu.name,dbu.password, dbs.host FROM dbusers dbu, db_servers dbs, membres m WHERE dbu.uid= ? and enable='ADMIN' and dbs.id=m.db_server_id and m.uid= ? ;", array($cuid, $cuid));
if (!$db->num_rows()) {
$msg->raise("ERROR", "mysql", _("Cannot connect to PhpMyAdmin"));
$msg->raise("ERROR", "mysql", _("Cannot connect to PhpMyAdmin, no admin user for uid {$cuid}"));
return false;
}
$db->next_record();

View File

@ -511,11 +511,13 @@ INSTR(CONCAT(sd.sub,IF(sd.sub!='','.',''),sd.domaine),'.')+1))=?
$altnames = $this->parseAltNames($crtdata["extensions"]["subjectAltName"]);
// Everything is PERFECT and has been thoroughly checked, let's insert those in the DB !
// The sslcsr column is required as it has no default value, giving it an empty value.
$db->query(
"INSERT INTO certificates SET uid=?, status=?, fqdn=?, altnames=?, validstart=FROM_UNIXTIME(?), validend=FROM_UNIXTIME(?), sslkey=?, sslcrt=?, sslchain=?, provider=?;",
"INSERT INTO certificates SET uid=?, status=?, fqdn=?, altnames=?, validstart=FROM_UNIXTIME(?), validend=FROM_UNIXTIME(?), sslkey=?, sslcrt=?, sslchain=?, provider=?, sslcsr = '';",
array($cuid, self::STATUS_OK, $fqdn, $altnames, intval($validstart), intval($validend), $key, $crt, $chain, $provider)
);
if (!($id = $db->lastid())) {
$msg->log('ssl', 'impoert_cert', 'insert query failed (' . print_r($db->last_error(), TRUE) . ')');
$msg->raise("ERROR","ssl", _("Can't save the Key/Crt/Chain now. Please try later."));
return false;
}

View File

@ -11,7 +11,7 @@
php_admin_value sendmail_path '/usr/lib/alternc/sendmail "%%mail_account%%" '
php_admin_flag mail.add_x_header on
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Limit Options Indexes
AllowOverride AuthConfig FileInfo Limit Options Indexes Options=All,MultiViews
</Directory>
</VirtualHost>
@ -29,7 +29,7 @@
php_admin_value sendmail_path '/usr/lib/alternc/sendmail "%%mail_account%%" '
php_admin_flag mail.add_x_header on
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Limit Options Indexes
AllowOverride AuthConfig FileInfo Limit Options Indexes Options=All,MultiViews
</Directory>
SSLEngine On

View File

@ -30,7 +30,7 @@
php_admin_value sendmail_path '/usr/lib/alternc/sendmail "%%mail_account%%" '
php_admin_flag mail.add_x_header on
Options -MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Limit Options Indexes
AllowOverride AuthConfig FileInfo Limit Options Indexes Options=All,MultiViews
Order allow,deny
Allow from all
Require all granted

View File

@ -24,7 +24,7 @@
php_admin_value sendmail_path '/usr/lib/alternc/sendmail "%%mail_account%%" '
php_admin_flag mail.add_x_header on
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride AuthConfig FileInfo Limit Options Indexes
AllowOverride AuthConfig FileInfo Limit Options Indexes Options=All,MultiViews
</Directory>
SSLEngine On

View File

@ -90,6 +90,23 @@ lock_jobs
# hook
run-parts --arg=startup /usr/lib/alternc/install.d
#######################################################################
# Enter the initial database configuration if needed
#
# Creating admin user if needed
# This is done before any templating, since it adds the default database server.
# User feedback is provided near the end of the script.
HAS_ROOT=`mysql --defaults-file=/etc/alternc/my.cnf -e "SELECT COUNT(*) FROM membres WHERE login = 'admin' OR login = 'root' and su = 1" | tail -1`
if [ "$HAS_ROOT" != "1" ] ; then
echo "Creating admin user..."
echo ""
su - alterncpanel -s /bin/bash -c /usr/share/alternc/install/newone.php
NEWONE_RETVAL=$?
fi
#######################################################################
# Script configuration
#
@ -240,7 +257,7 @@ fi
PUBLIC_IP_BEGIN=$(echo $PUBLIC_IP|cut -c 1)
# Secret for PhpMyAdmin sessions
PHPMYADMIN_BLOWFISH="$(generate_string 24)"
PHPMYADMIN_BLOWFISH="$(generate_string 32)"
# XXX: I assume this is secure if /tmp is sticky (+t)
# we should have a better way to deal with templating, of course.
@ -606,15 +623,8 @@ chown alterncpanel:adm /var/log/alternc/bureau.log /var/log/alternc/update_domai
# Launch a script that will populate AlternC variables as needed
su - alterncpanel -s /bin/bash -c /usr/share/alternc/install/variables.php
# Creating admin user if needed
HAS_ROOT=`mysql --defaults-file=/etc/alternc/my.cnf -e "SELECT COUNT(*) FROM membres WHERE login = 'admin' OR login = 'root' and su = 1" | tail -1`
if [ "$HAS_ROOT" != "1" ]; then
echo "Creating admin user..."
echo ""
if su - alterncpanel -s /bin/bash -c /usr/share/alternc/install/newone.php
then
if [ "$NEWONE_RETVAL" ] ; then
echo "*******************************************"
echo "* *"
echo "* Admin account *"
@ -626,7 +636,7 @@ if [ "$HAS_ROOT" != "1" ]; then
echo "* *"
echo "*******************************************"
else
echo "Unable to create the first AlternC account (named 'admin'). newone.php returned $?. Check your MySQL database, PHP, and the /etc/alternc/local.sh file. Also check for any error above during install."
echo "Unable to create the first AlternC account (named 'admin'). newone.php returned $NEWONE_RETVAL. Check your MySQL database, PHP, and the /etc/alternc/local.sh file. Also check for any error above during install."
fi
else
##UPDATE default db_server following /etc/alternc/my.cnf values
@ -714,6 +724,8 @@ done
# Fix phpmyadmin import trac#1557
test -d "/var/lib/phpmyadmin/tmp" && dpkg-statoverride --update --add www-data alterncpanel 0775 "/var/lib/phpmyadmin/tmp" 2>/dev/null || true
test -f "/etc/phpmyadmin/config-db.php" && dpkg-statoverride --update --add www-data alterncpanel 0644 "/etc/phpmyadmin/config-db.php" 2>/dev/null || true
test -f "/var/lib/phpmyadmin/blowfish_secret.inc.php" && dpkg-statoverride --update --add www-data alterncpanel 0660 "/var/lib/phpmyadmin/blowfish_secret.inc.php" 2> /dev/null || true
test -f "/var/lib/phpmyadmin/config.inc.php" && dpkg-statoverride --update --add www-data alterncpanel 0660 "/var/lib/phpmyadmin/config.inc.php" 2> /dev/null || true
# hook
run-parts --arg=end /usr/lib/alternc/install.d