Fix script & test
This commit is contained in:
parent
6bd208b9d8
commit
b3a4ec2085
18
.travis.yml
18
.travis.yml
|
@ -14,8 +14,18 @@ env:
|
||||||
POSTGRES_DB: mydb
|
POSTGRES_DB: mydb
|
||||||
POSTGRES_USER: myuser
|
POSTGRES_USER: myuser
|
||||||
|
|
||||||
# certificates
|
# no certificates
|
||||||
- config: certs.yml
|
- config: certs.yml
|
||||||
|
ssl: false
|
||||||
|
|
||||||
|
# certificates (default tls if onlyoffice not exists)
|
||||||
|
- config: certs.yml
|
||||||
|
|
||||||
|
# old certificates path (default onlyoffice if exists)
|
||||||
|
- config: certs.yml
|
||||||
|
private_key: onlyoffice.key
|
||||||
|
certificate_request: onlyoffice.csr
|
||||||
|
certificate: onlyoffice.crt
|
||||||
|
|
||||||
# custom certificates path
|
# custom certificates path
|
||||||
- config: certs.yml
|
- config: certs.yml
|
||||||
|
@ -25,12 +35,6 @@ env:
|
||||||
SSL_CERTIFICATE_PATH: /var/www/onlyoffice/Data/certs/mycert.crt
|
SSL_CERTIFICATE_PATH: /var/www/onlyoffice/Data/certs/mycert.crt
|
||||||
SSL_KEY_PATH: /var/www/onlyoffice/Data/certs/mycert.key
|
SSL_KEY_PATH: /var/www/onlyoffice/Data/certs/mycert.key
|
||||||
|
|
||||||
# old certificates path
|
|
||||||
- config: certs.yml
|
|
||||||
private_key: onlyoffice.key
|
|
||||||
certificate_request: onlyoffice.csr
|
|
||||||
certificate: onlyoffice.crt
|
|
||||||
|
|
||||||
# deprecated variables
|
# deprecated variables
|
||||||
- config: postgres-old.yml
|
- config: postgres-old.yml
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
url=${url:-"https://localhost"}
|
ssl=${ssl:-true}
|
||||||
private_key=tls.key
|
private_key=${private_key:-tls.key}
|
||||||
certificate_request=tls.csr
|
certificate_request=${certificate_request:-tls.csr}
|
||||||
certificate=tls.crt
|
certificate=${certificate:-tls.crt}
|
||||||
|
|
||||||
# Generate certificate
|
# Generate certificate
|
||||||
openssl genrsa -out ${private_key} 2048
|
if [[ $ssl == "true" ]]; then
|
||||||
openssl req \
|
url=${url:-"https://localhost"}
|
||||||
-new \
|
|
||||||
-subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=backendserver-address" \
|
|
||||||
-key ${private_key} \
|
|
||||||
-out ${certificate_request}
|
|
||||||
openssl x509 \
|
|
||||||
-req \
|
|
||||||
-days 365 \
|
|
||||||
-in ${certificate_request} \
|
|
||||||
-signkey ${private_key} \
|
|
||||||
-out ${certificate}
|
|
||||||
|
|
||||||
# Strengthening the server security
|
mkdir -p data/certs
|
||||||
openssl dhparam -out dhparam.pem 2048
|
pushd data/certs
|
||||||
|
|
||||||
mkdir -p data/certs
|
openssl genrsa -out ${private_key} 2048
|
||||||
cp $private_key data/certs/
|
openssl req \
|
||||||
cp $certificate data/certs/
|
-new \
|
||||||
cp dhparam.pem data/certs/
|
-subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" \
|
||||||
chmod 400 data/certs/$private_key
|
-key ${private_key} \
|
||||||
|
-out ${certificate_request}
|
||||||
|
openssl x509 -req -days 365 -in ${certificate_request} -signkey ${private_key} -out ${certificate}
|
||||||
|
openssl dhparam -out dhparam.pem 2048
|
||||||
|
chmod 400 ${private_key}
|
||||||
|
|
||||||
|
popd
|
||||||
|
else
|
||||||
|
url=${url:-"http://localhost"}
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if the yml exists
|
# Check if the yml exists
|
||||||
if [[ ! -f $config ]]; then
|
if [[ ! -f $config ]]; then
|
||||||
|
|
Loading…
Reference in a new issue