Compare commits
4 commits
master
...
ci-enablem
Author | SHA1 | Date | |
---|---|---|---|
Mathieu Trossevin | 7ecfa19d85 | ||
Mathieu Trossevin | 7b29422730 | ||
Mathieu Trossevin | af94efde45 | ||
Mathieu Trossevin | 293ea73b6b |
23
.Jenkinsfile
Normal file
23
.Jenkinsfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
pipeline {
|
||||
agent none
|
||||
stages {
|
||||
stage('PHPStan (static analysis)') {
|
||||
agent {
|
||||
docker {
|
||||
image 'php:8.2-cli'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
sh 'curl -fsSL https://github.com/phpstan/phpstan/releases/download/1.10.41/phpstan.phar -o phpstan.phar'
|
||||
sh 'php ./phpstan.phar analyse --configuration=phpstan.neon --memory-limit=512M --error-format=junit > phpstan-results.junit.xml'
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit 'phpstan-results.junit.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -12,20 +12,6 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
|||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Removed
|
||||
|
||||
### Security
|
||||
|
||||
|
||||
|
||||
## [24.04]
|
||||
|
||||
### Added
|
||||
|
||||
* Prevent op_del to fail and able to remove web account when part of it is already removed
|
||||
|
||||
### Changed
|
||||
|
@ -34,9 +20,6 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
|||
|
||||
### Fixed
|
||||
|
||||
* letsencrypt: Add required check when retrieving certificate. (Avoid TypeError.)
|
||||
* web-add.sh: Fix ssh group membership (#94)
|
||||
|
||||
### Removed
|
||||
|
||||
### Security
|
||||
|
|
|
@ -263,6 +263,8 @@ class FormField {
|
|||
protected $read_only = null;
|
||||
protected $disabled = null;
|
||||
private $storage = NULL;
|
||||
protected $mandatory = null;
|
||||
protected $hidden = null;
|
||||
|
||||
protected function __construct($label) {
|
||||
$this->storage = & $_SESSION;
|
||||
|
@ -638,7 +640,7 @@ class EmailInputFormField extends TextInputFormField {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if(!empty($this->value) && !eregi('^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$',$this->value)){
|
||||
if(!empty($this->value) && !preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i', $this->value)){
|
||||
if($set_error) $this->error = 'Adresse email invalide';
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -794,7 +796,7 @@ class MultipleCheckBoxInputFormField extends FormField {
|
|||
protected $mandatory = NULL;
|
||||
protected $list = array();
|
||||
|
||||
public function __construct($label, $mandatory=TRUE, $list) {
|
||||
public function __construct($label, $list, $mandatory=TRUE) {
|
||||
parent::__construct($label);
|
||||
$this->mandatory = $mandatory;
|
||||
$this->list = $list;
|
||||
|
@ -877,7 +879,7 @@ class SelectFormField extends FormField {
|
|||
protected $mandatory = NULL;
|
||||
protected $list = array();
|
||||
|
||||
public function __construct($label, $mandatory=TRUE, $list) {
|
||||
public function __construct($label, $list, $mandatory=TRUE) {
|
||||
parent::__construct($label);
|
||||
$this->mandatory = $mandatory;
|
||||
$this->list = $list;
|
||||
|
@ -933,7 +935,7 @@ class RadioFormField extends FormField {
|
|||
protected $mandatory = NULL;
|
||||
protected $list = array();
|
||||
|
||||
public function __construct($label, $mandatory=TRUE, $list, $default = null) {
|
||||
public function __construct($label, $list, $mandatory=TRUE, $default = null) {
|
||||
parent::__construct($label);
|
||||
$this->mandatory = $mandatory;
|
||||
$this->list = $list;
|
||||
|
@ -995,7 +997,7 @@ class ButtonInputFormField extends FormField {
|
|||
protected $event = NULL;
|
||||
protected $action = NULL;
|
||||
|
||||
public function __construct($label,$mandatory=FALSE, $event, $action) {
|
||||
public function __construct($label, $event, $action, $mandatory=FALSE) {
|
||||
parent::__construct($label);
|
||||
$this->mandatory = $mandatory;
|
||||
$this->event = $event;
|
||||
|
|
|
@ -74,8 +74,8 @@ function web_add($form, $admin_mail) {
|
|||
foreach ( $domain_alias as $domain ) {
|
||||
$exec_cmd = 'web-add.sh add-alias '.escapeshellarg($form->getField('username')->getValue()).' ';
|
||||
$domain = trim($domain);
|
||||
$exec_cmd .= $domain.' '. $server_list;
|
||||
sudoexec($exec_cmd, $exec_output, $exec_return);
|
||||
$exec_cmd .= $domain;
|
||||
sudoexec($exec_cmd, $exec_output2, $exec_return2);
|
||||
}
|
||||
$exec_return |= $exec_return2; // $exec_return == 0 if $exec_return == 0 && $exec_return2 == 0
|
||||
array_push($exec_output, $exec_output2);
|
||||
|
@ -254,19 +254,19 @@ $form->addField('username', new AlphaNumericalTextInputFormField("Nom d'utilisat
|
|||
$form->addField('domain', new DomainInputFormField("Nom de domaine", TRUE));
|
||||
$form->addField('domain_alias', new DomainListInputFormField("Alias (séparés par une virgule, sans espaces)", FALSE));
|
||||
$form->addField('password_random',
|
||||
new CheckboxInputFormField("Mot de passe aléatoire ?", FALSE));
|
||||
new CheckBoxInputFormField("Mot de passe aléatoire ?", FALSE));
|
||||
$form->getField('password_random')->setValue(TRUE);
|
||||
$form->addField('password', new PasswordInputFormField('Mot de passe', FALSE));
|
||||
$form->getField('password')->setDisabled();
|
||||
$form->addField('mysql_db',
|
||||
new CheckboxInputFormField("Créer une base de données MySQL ?",
|
||||
new CheckBoxInputFormField("Créer une base de données MySQL ?",
|
||||
FALSE));
|
||||
$form->getField('mysql_db')->setValue(TRUE);
|
||||
$form->addField('mysql_dbname',
|
||||
new AlphaNumericalTextInputFormField("Nom de la base MySQL", FALSE, array(20,16)));
|
||||
|
||||
$form->addField('mysql_password_random',
|
||||
new CheckboxInputFormField("Mot de passe MySQL aléatoire ?",
|
||||
new CheckBoxInputFormField("Mot de passe MySQL aléatoire ?",
|
||||
FALSE));
|
||||
$form->getField('mysql_password_random')->setValue(TRUE);
|
||||
|
||||
|
@ -344,7 +344,7 @@ if ($conf['cluster']) {
|
|||
|
||||
if ($conf['bindadmin']) {
|
||||
/* Quai13 specific: allow to switch between Gmail MX/Quai13 MX */
|
||||
$form->addField('use_gmail_mxs', new CheckboxInputFormField("Utilisation des serveurs Gmail en MX ?", FALSE));
|
||||
$form->addField('use_gmail_mxs', new CheckBoxInputFormField("Utilisation des serveurs Gmail en MX ?", FALSE));
|
||||
}
|
||||
|
||||
if (array_key_exists('php_versions', $conf) && is_array($conf['php_versions'])) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST)) {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST)) {
|
||||
$input_username = $_POST['login'];
|
||||
$input_password = $_POST['passw'];
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ function is_mcluster_mode() {
|
|||
function load_config_cluster($cluster) {
|
||||
global $conf;
|
||||
$configfile = '../conf/config.'.$cluster.'.php';
|
||||
$clusterconf = array(); // Fix static analysis. It's fully defined by config file.
|
||||
test_exist($configfile);
|
||||
require_once($configfile);
|
||||
$conf = array_merge($conf, $clusterconf);
|
||||
|
|
|
@ -157,9 +157,6 @@ class LetsEncrypt
|
|||
{
|
||||
$stream = stream_context_create(array("ssl" => array("capture_peer_cert" => true)));
|
||||
$read = stream_socket_client("ssl://" . $domain . ":443", $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $stream);
|
||||
if ($read === false) {
|
||||
return false;
|
||||
}
|
||||
$cont = stream_context_get_params($read);
|
||||
|
||||
return $cont;
|
||||
|
|
6
phpstan-baseline.neon
Normal file
6
phpstan-baseline.neon
Normal file
|
@ -0,0 +1,6 @@
|
|||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Undefined variable\\: \\$error$#"
|
||||
count: 3
|
||||
path: lib/bdd.php
|
13
phpstan.neon
Normal file
13
phpstan.neon
Normal file
|
@ -0,0 +1,13 @@
|
|||
includes:
|
||||
- phpstan-baseline.neon
|
||||
|
||||
parameters:
|
||||
level: 0
|
||||
paths:
|
||||
- htdocs
|
||||
- lib
|
||||
- evolibs
|
||||
- inc
|
||||
- tpl
|
||||
- conf
|
||||
- bin
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
VERSION="24.04"
|
||||
VERSION="23.02"
|
||||
HOME="/root"
|
||||
CONTACT_MAIL="jdoe@example.org"
|
||||
WWWBOUNCE_MAIL="jdoe@example.org"
|
||||
|
@ -363,12 +363,14 @@ create_www_account() {
|
|||
lxc-attach -n php"${php_version}" -- /usr/sbin/adduser --disabled-password --home "$HOME_DIR_USER"/www --no-create-home --shell /bin/false --gecos "WWW $in_login" www-"$in_login" --uid "$www_uid" --ingroup "$in_login" --force-badname >/dev/null
|
||||
done
|
||||
|
||||
if grep -qE '^AllowUsers' /etc/ssh/sshd_config; then
|
||||
if grep -qE '^AllowGroups' /etc/ssh/sshd_config; then
|
||||
if ! grep -qE "^AllowGroups(\\s+\\S+)*(\\s+$SSH_GROUP)" /etc/ssh/sshd_config; then
|
||||
sed -i "s/^AllowGroups .*/& $SSH_GROUP/" /etc/ssh/sshd_config
|
||||
groupadd --force $SSH_GROUP
|
||||
fi
|
||||
usermod -a -G $SSH_GROUP "$in_login"
|
||||
elif grep -qE '^AllowUsers' /etc/ssh/sshd_config; then
|
||||
sed -i "s/^AllowUsers .*/& $in_login/" /etc/ssh/sshd_config
|
||||
else
|
||||
if getent group "$SSH_GROUP" 1>/dev/null 2>&1; then
|
||||
usermod --append --groups "$SSH_GROUP" "$in_login"
|
||||
fi
|
||||
fi
|
||||
/etc/init.d/ssh reload
|
||||
|
||||
|
@ -764,7 +766,7 @@ op_del() {
|
|||
|
||||
# Deactivate web vhost (apache or nginx)
|
||||
if [ "$WEB_SERVER" == "apache" ]; then
|
||||
if a2query -s "${login}" >/dev/null 2&>1; then
|
||||
if a2query -s test12 >/dev/null 2&>1; then
|
||||
a2dissite "${login}.conf"
|
||||
fi
|
||||
rm -f /etc/apache2/sites-available/"$login.conf"
|
||||
|
|
|
@ -31,5 +31,3 @@ else {
|
|||
echo '<p>Bienvenue, utilisez le menu ci-dessus pour administrer votre compte.</p>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
for ( $i=0; $i < count($alias_list); ++$i ) {
|
||||
print '<tr>';
|
||||
printf('<td>%s</td>',
|
||||
$alias_list[$i]['alias'], $alias_list[$i]['alias']);
|
||||
$alias_list[$i]['alias']);
|
||||
if (is_superadmin())
|
||||
printf('<td><a href="/webadmin/%s/alias/delete/%s/">Supprimer</a></td>',
|
||||
$domain, $alias_list[$i]['alias']);
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
printf('<td>%s</td>', $vhost_info['owner']);
|
||||
}
|
||||
printf('<td>%s</td>',
|
||||
$vhost_info['server_name'], $vhost_info['server_name']);
|
||||
$vhost_info['server_name']);
|
||||
|
||||
if ($conf['cluster']) {
|
||||
if (empty($vhost_info['bdd']))
|
||||
|
|
Loading…
Reference in a new issue