Create a self signed cert for the local domain

This commit is contained in:
Bob Mottram 2018-05-26 15:29:13 +01:00
parent 22436fbf55
commit b45b94cd5e
1 changed files with 28 additions and 3 deletions

View File

@ -1149,7 +1149,7 @@ function install_web_local_user_interface {
{ echo '<html>';
echo ' <body>';
echo " This is a test on $local_hostname";
echo " This is a test on ${local_hostname}";
echo ' </body>';
echo '</html>'; } > "/var/www/${local_hostname}/htdocs/index.html"
@ -1160,8 +1160,33 @@ function install_web_local_user_interface {
echo " server_name ${local_hostname};";
echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.html;';
echo '}'; } > "$nginx_file"
nginx_ensite "$local_hostname"
echo '';
echo ' access_log /dev/null;';
echo ' error_log /dev/null;';
echo '}';
echo '';
echo 'server {';
echo ' listen 443 ssl;';
echo ' #listen [::]:443 ssl;';
echo " server_name ${local_hostname};";
echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.html;';
echo '';
echo ' access_log /dev/null;';
echo ' error_log /dev/null;';
echo ''; } >> "$nginx_file"
nginx_ssl "${local_hostname}"
nginx_security_options "${local_hostname}"
{ echo ' add_header Strict-Transport-Security max-age=0;';
echo '}'; } >> "$nginx_file"
if [ ! -f "/etc/ssl/certs/${local_hostname}.crt" ]; then
"${PROJECT_NAME}-addcert" -h "${local_hostname}" --dhkey "${DH_KEYLENGTH}"
fi
nginx_ensite "${local_hostname}"
# Compatibility with FreedomBox android app
# The installed apps get published to a json file called "1"