Module: kamailio
Branch: master
Commit: 1483ddb735c3fa3ea77b6e2d54ec67584e56e15b
URL:
https://github.com/kamailio/kamailio/commit/1483ddb735c3fa3ea77b6e2d54ec675…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-10-20T20:39:17+02:00
kamclt: subcommand tls gen-certs
- generate self signed certificate in current directory
---
Modified: utils/kamctl/kamctl
Modified: utils/kamctl/kamctl.base
---
Diff:
https://github.com/kamailio/kamailio/commit/1483ddb735c3fa3ea77b6e2d54ec675…
Patch:
https://github.com/kamailio/kamailio/commit/1483ddb735c3fa3ea77b6e2d54ec675…
---
diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index a2d839b50b..f629dfd41e 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -2881,6 +2881,16 @@ tls_ca() {
minfo "Certificate is locate at $USER_DIR/$USER-cert.pem "
minfo "CA-List is locate at $USER_DIR/$USER-calist.pem "
+ elif [ "$1" = "gen-certs" ] ; then
+ mecho "Generating self signed certificates"
+ if [ -z "$CERTDAYS" ] ; then
+ CERTDAYS=365
+ fi
+ if [ -n "$2" ] ; then
+ openssl req -x509 -newkey rsa:4096 -nodes -subj "/CN=${2}" -keyout
kamailio-selfsigned.key -out kamailio-selfsigned.pem -days ${CERTDAYS}
+ else
+ openssl req -x509 -newkey rsa:4096 -nodes -keyout kamailio-selfsigned.key -out
kamailio-selfsigned.pem -days ${CERTDAYS}
+ fi
else
merr "unknown TLS command $1"
usage_tls
diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base
index b088565069..47747be85a 100644
--- a/utils/kamctl/kamctl.base
+++ b/utils/kamctl/kamctl.base
@@ -381,9 +381,10 @@ usage_tls() {
mecho " -- command 'tls'"
echo
cat <<EOF
- tls rootCA [<etcdir>] .......... creates new rootCA
+ tls rootCA [<etcdir>] ............ creates new rootCA
tls userCERT <user> [<etcdir>] ... creates user certificate
- default <etcdir> is $ETCDIR/tls
+ * default <etcdir> is $ETCDIR/tls
+ tls gen-certs [<domain>] ......... generate self signed certificate
EOF
}