Make SSL certs in INIT mode if any part doesn't exist

pull/1/head
Jason Kendall 2020-01-29 14:47:26 -05:00
parent e8a1dc0c06
commit e5937ecdb8
3 changed files with 15 additions and 13 deletions

8
.gitignore vendored
View File

@ -1,12 +1,8 @@
logs/
ssl/cert.pem
ssl/chain.pem
ssl/dhparams.pem
ssl/key.pem
files/
ssl/
server-configs/database.php
server-configs/config.php
server-configs/bootstrap.php
server-configs/core.php
server-configs/config.php.bk
files/INIT
files/[0-9]*

View File

@ -45,6 +45,18 @@ init_misp_files(){
fi
}
init_ssl() {
if [[ (! -f /etc/apache2/ssl/dhparams.pem) ||
(! -f /etc/apache2/ssl/cert.pem) ||
(! -f /etc/apache2/ssl/key.pem) ||
(! -f /etc/apache2/ssl/chain.pem) ]]; then
cd /etc/apache2/ssl
openssl dhparam -out dhparams.pem 2048
openssl req -x509 -subj '/CN=localhost' -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
cp cert.pem chain.pem
fi
}
init_mysql(){
# Test when MySQL is ready....
# wait for Database come ready
@ -78,6 +90,7 @@ start_apache() {
if [[ "$INIT" == true ]]; then
echo "Import MySQL scheme..." && init_mysql
echo "Setup MISP files dir..." && init_misp_files
echo "Ensure SSL certs exist..." && init_ssl
fi
# Things we should do if we're configuring MISP via ENV

View File

@ -1,7 +0,0 @@
#!/bin/bash
echo "Seriously, don't use this"
openssl dhparam -out dhparams.pem 2048
openssl req -x509 -subj '/CN=localhost' -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
cp cert.pem chain.pem