From a967990be7d878e0456ac65b961322101a1878ff Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 19:35:04 -0700 Subject: [PATCH 1/3] chore: remove unnecessary cd in certs:add This was used before we started using `plugn` for triggering subshell calls to dokku. --- plugins/certs/subcommands/add | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/certs/subcommands/add b/plugins/certs/subcommands/add index 07601378c..c705d1cde 100755 --- a/plugins/certs/subcommands/add +++ b/plugins/certs/subcommands/add @@ -72,7 +72,6 @@ certs_set() { cp "$KEY_FILE" "$APP_SSL_PATH/server.key" chmod 750 "$APP_SSL_PATH" chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.key" - cd "$DOKKU_ROOT" plugn trigger post-certs-update "$APP" plugn trigger post-domains-update "$APP" } From 82c11a2b2c0ab5cab998e2650a7c6d4276ca6a66 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 19:35:49 -0700 Subject: [PATCH 2/3] fix: call post-certs-update on the application before updating domains This ensures that we set the proper ssl ports. Closes #2480 Closes #2528 --- plugins/certs/subcommands/generate | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/certs/subcommands/generate b/plugins/certs/subcommands/generate index daa2caed8..6cc75beee 100755 --- a/plugins/certs/subcommands/generate +++ b/plugins/certs/subcommands/generate @@ -25,6 +25,7 @@ certs_generate_cmd() { mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$APP_SSL_PATH" chmod 750 "$APP_SSL_PATH" chmod 640 "$APP_SSL_PATH/server.key" "$APP_SSL_PATH/server.crt" + plugn trigger post-certs-update "$APP" [[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP") dokku_log_info1 "The following is a certificate signing request that can be used" dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN" From bcfa60ae9800859798356b2d446d0615d413dad2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 19:36:17 -0700 Subject: [PATCH 3/3] feat: save the ssl certificate to the APP_SSL_PATH This allows later retrieval of the csr in cases where the developer forgot to save it locally. --- plugins/certs/subcommands/generate | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/certs/subcommands/generate b/plugins/certs/subcommands/generate index 6cc75beee..10349e9f9 100755 --- a/plugins/certs/subcommands/generate +++ b/plugins/certs/subcommands/generate @@ -22,15 +22,15 @@ certs_generate_cmd() { mkdir -p "$APP_SSL_PATH" dokku_log_info1 "Installing certificate and key..." - mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$APP_SSL_PATH" + mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$CERTS_GENERATE_TMP_WORK_DIR/server.csr" "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$APP_SSL_PATH" chmod 750 "$APP_SSL_PATH" - chmod 640 "$APP_SSL_PATH/server.key" "$APP_SSL_PATH/server.crt" + chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.csr" "$APP_SSL_PATH/server.key" plugn trigger post-certs-update "$APP" [[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP") dokku_log_info1 "The following is a certificate signing request that can be used" dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN" dokku_log_info1 "by a CA of your choosing." - cat server.csr + cat "$APP_SSL_PATH/server.csr" else dokku_log_info1 "$APP has an SSL endpoint already defined" fi