mirror of
https://github.com/tips-of-mine/gestion-certificats2.git
synced 2025-06-28 06:58:43 +02:00
This commit addresses several issues:
1. **`intermediate_cert_name` unique constraint violation**: When creating a perimeter, the intermediate certificate name (`intermediate_cert_name`) stored in the `functional_perimeters` table was always `"intermediate.cert.pem"`. This caused a duplicate error if a unique constraint existed on this column. * Fixed in `PerimeterController.php` by using `$perimeterName . "_intermediate.cert.pem"` as the value for `intermediate_cert_name`, ensuring uniqueness. The physical file name remains `intermediate.cert.pem` in the perimeter's subdirectory. 2. **`Undefined variable $userRole` warning**: On the page listing perimeters (`app/src/Views/perimeters/index.php`), the `$userRole` variable was not defined by the controller. * Fixed in `PerimeterController.php` (method `index()`) by initializing `$userRole = $this->authService->getUserRole();`. 3. **SQL error `Unknown column 'common_name'` during initialization**: During the application initialization process (if no user or root certificate exists), an attempt to insert into the `certificates` table included a `common_name` column that does not exist. * Fixed in `app/public/index.php` by removing the `common_name` column and its value from the insert query for the root certificate. These corrections improve the robustness of perimeter creation and make the application initialization process more reliable.
This commit is contained in:
@ -25,6 +25,13 @@ fi
|
||||
|
||||
ROOT_CA_DIR="/opt/tls/root"
|
||||
INTERMEDIATE_CA_DIR="/opt/tls/intermediate/$FUNCTIONAL_PERIMETER_NAME"
|
||||
|
||||
# Vérifier si le répertoire de la CA intermédiaire existe déjà
|
||||
if [ -d "$INTERMEDIATE_CA_DIR" ]; then
|
||||
echo "Erreur : Le répertoire pour le périmètre '$FUNCTIONAL_PERIMETER_NAME' existe déjà. Veuillez le supprimer ou choisir un autre nom."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
INTERMEDIATE_KEY="$INTERMEDIATE_CA_DIR/private/intermediate.key.pem"
|
||||
INTERMEDIATE_CSR="$INTERMEDIATE_CA_DIR/csr/intermediate.csr.pem"
|
||||
INTERMEDIATE_CERT="$INTERMEDIATE_CA_DIR/certs/intermediate.cert.pem"
|
||||
|
@ -31,8 +31,10 @@ cp /opt/scripts/configs/root-openssl.conf "$ROOT_CNF"
|
||||
|
||||
# Initialiser les fichiers requis par OpenSSL pour une CA
|
||||
touch "$ROOT_CA_DIR/index.txt"
|
||||
chmod 666 "$ROOT_CA_DIR/index.txt"
|
||||
|
||||
echo 1000 > "$ROOT_CA_DIR/serial" # Numéro de série initial pour les certificats
|
||||
chmod 666 "$ROOT_CA_DIR/serial"
|
||||
echo 1000 > "$ROOT_CA_DIR/crlnumber" # Numéro de série initial pour la CRL
|
||||
|
||||
# Générer la clé privée du Root CA (2048 bits, sans passphrase pour la simplicité)
|
||||
|
Reference in New Issue
Block a user