tools.func - Add function to create self-signed certificates (#4562)

This commit is contained in:
Slaviša Arežina 2025-05-18 09:27:55 +02:00 committed by GitHub
parent 8a481e1423
commit 8f647b9abe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1180,3 +1180,22 @@ setup_rbenv_stack() {
rm -rf "$TMP_DIR" rm -rf "$TMP_DIR"
msg_ok "rbenv stack ready (Ruby $RUBY_VERSION)" msg_ok "rbenv stack ready (Ruby $RUBY_VERSION)"
} }
# ------------------------------------------------------------------------------
# Creates and installs self-signed certificates.
#
# Description:
# - Create a self-signed certificate with option to override application name
#
# Variables:
# APP - Application name (default: $APPLICATION variable)
# ------------------------------------------------------------------------------
create_selfsigned_certs() {
local app=${APP:-$(echo "${APPLICATION,,}" | tr -d ' ')}
$STD msg_info "Creating Self-Signed Certificate"
$STD openssl req -x509 -nodes -days 365 -newkey rsa:4096 \
-keyout /etc/ssl/private/"$app"-selfsigned.key \
-out /etc/ssl/certs/"$app"-selfsigned.crt \
-subj "/C=US/O=$app/OU=Domain Control Validated/CN=localhost"
$STD msg_ok "Created Self-Signed Certificate"
}