From cf37f5bd6652835a8a8c6b2331d5b01d5379ba2e Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Thu, 4 Sep 2025 12:13:12 +0530 Subject: [PATCH 1/2] feat(nginx-proxy): add self-signed certificate generation --- src/helper/service-utils.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/helper/service-utils.php b/src/helper/service-utils.php index 23cd403..0baf284 100644 --- a/src/helper/service-utils.php +++ b/src/helper/service-utils.php @@ -51,6 +51,21 @@ function nginx_proxy_check() { if ( ! \EE_DOCKER::docker_compose_up( EE_SERVICE_DIR . '', [ 'global-nginx-proxy' ] ) ) { EE::error( "There was some error in starting $proxy_type container. Please check logs." ); } + + $this->certs_dir = EE_ROOT_DIR . '/services/nginx-proxy/certs'; + $this->key_path = $this->certs_dir . '/default.key'; + $this->crt_path = $this->certs_dir . '/default.crt'; + + if ( $this->fs->exists( $this->key_path ) && $this->fs->exists( $this->crt_path ) ) { + EE::debug( 'Default self-signed cert already exists. Skipping generation.' ); + + return; + } + EE::debug( 'Generating default self-signed cert (default.key, default.crt) with CN=default using internal logic' ); + $self_signed = new \EE\Site\Type\Site_Self_signed(); + $self_signed->create_certificate( 'default' ); + EE::debug( 'Self-signed cert generation completed.' ); + set_nginx_proxy_version_conf(); } From 1a592d7fb4adf241f70c628c3e5686d2b289adeb Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Thu, 4 Sep 2025 12:25:57 +0530 Subject: [PATCH 2/2] refactor(service-utils): update variable scope for cert paths --- src/helper/service-utils.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helper/service-utils.php b/src/helper/service-utils.php index 0baf284..89bfe4d 100644 --- a/src/helper/service-utils.php +++ b/src/helper/service-utils.php @@ -52,11 +52,11 @@ function nginx_proxy_check() { EE::error( "There was some error in starting $proxy_type container. Please check logs." ); } - $this->certs_dir = EE_ROOT_DIR . '/services/nginx-proxy/certs'; - $this->key_path = $this->certs_dir . '/default.key'; - $this->crt_path = $this->certs_dir . '/default.crt'; + $certs_dir = EE_ROOT_DIR . '/services/nginx-proxy/certs'; + $key_path = $certs_dir . '/default.key'; + $crt_path = $certs_dir . '/default.crt'; - if ( $this->fs->exists( $this->key_path ) && $this->fs->exists( $this->crt_path ) ) { + if ( $fs->exists( $key_path ) && $fs->exists( $crt_path ) ) { EE::debug( 'Default self-signed cert already exists. Skipping generation.' ); return;