Skip to content

Commit 5befb59

Browse files
committed
Added ability to generate self-signed certificate
1 parent d895558 commit 5befb59

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎plugins/ssl/commands‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ case "$1" in
3838
[[ ! -f "$APP_DIR/ssl/server.crt" ]] || dokku deploy "$APP"
3939
;;
4040

41+
ssl:selfsigned)
42+
verify_app_name "$2"
43+
verify_max_args 2 "$@"
44+
45+
mkdir -p "$APP_DIR/ssl"
46+
47+
[[ -f "$APP_DIR/ssl/server.crt" ]] && fail "$APP: There's certificate already"
48+
[[ -f "$APP_DIR/ssl/server.key" ]] || openssl genrsa -out "$APP_DIR/ssl/server.key" 2048
49+
openssl req -new -x509 -key "$APP_DIR/ssl/server.key" -out "$APP_DIR/ssl/server.crt" -days 3650
50+
dokku deploy "$APP"
51+
;;
52+
4153
ssl:info)
4254
verify_app_name "$2"
4355
verify_max_args 2 "$@"
@@ -60,6 +72,7 @@ case "$1" in
6072
help)
6173
cat && cat<<EOF
6274
ssl:generate <app> Generate certificate signing request for an APP
75+
ssl:selfsigned <app> Generate self-signed certificate an APP
6376
ssl:certificate <app> Pipe signed certifcate with all intermediates for an APP
6477
ssl:key <app> Pipe private key for an APP
6578
ssl:info <app> Show info about certifcate and certificate request

0 commit comments

Comments
 (0)