Adding the htpasswd_line function to ekeca.

After the previous post Basic Authentication for (nginx) Kubernetes Ingress, it just made sense to add a function in ekeca-post to generate .htpasswd-compatible lines:

cmd_htpasswd_line() {
#H - htpasswd_line
#H       generate a htpasswd-compatible username/password line
   printf '%s:%s\n' "$1" "$(openssl passwd -apr1 "$2")"

Note that I’m being very crude here, requiring that the password is provided as a positional argument, with the possibility that the password can leave visible traces. After all, anyway, ekeca is mostly meant as a quick’n’dirty study tool, so you have to use it with a grain of salt.