diff --git a/bash_completion b/bash_completion index f4139abcc6bc3cd17ca5037812875e926655e679..77fb678440b68d9fe6e54542860712cc91301f34 100644 --- a/bash_completion +++ b/bash_completion @@ -11,7 +11,8 @@ _certcheck() { if [[ $COMP_CWORD -gt 1 && "${COMP_WORDS[1]}" =~ 'check'|'text'|'txt' ]] then - COMPREPLY=($(compgen -f -- "$cur"|grep -v -f <(compgen -d --|sed -e 's/^/^/;s/$/\$/;'); compgen -d -S / -- "$cur")) + #COMPREPLY=($(compgen -f -o default -X '!*.@(pem|crt)' -- "$cur"|grep -v -f <(compgen -d -- "$cur"|sed -e 's/^/^/;s/$/\$/;'); compgen -S "/" -d -- "${cur}")) ; compopt -o nospace; + compopt -o default; COMPREPLY=() elif [[ $COMP_CWORD -eq 1 ]] then COMPREPLY=($(compgen -W "$(/usr/bin/certcheck help | grep '^ certcheck' | awk '{print $2}' | xargs echo -n)" -- "$cur")) diff --git a/certcheck b/certcheck index 9462fefd4200a2a8eef3057728bdf4377f6dc45c..275e49c475551ccb60e89862c5241651371c2990 100755 --- a/certcheck +++ b/certcheck @@ -5,7 +5,7 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin export LANG=C -export VERSION=0.3.4 +export VERSION=0.3.5 function usage() { cat <<END_USAGE @@ -107,6 +107,8 @@ case "${action}" in text|txt) [ -s "${CRT}" ] || say_warning "missing ${CRT}" + grep -q -- '-----BEGIN PRIVATE KEY-----' && say_warning "give the public and not the private key!" + grep -q -- '-----BEGIN CERTIFICATE-----' || say_warning "your key is not in PEM format!" openssl x509 -noout -text -in "${CRT}" \ | egrep '(Subject|Not Before|Not After[[:space:]]|DNS|Issuer):' \ | sed -e 's/^\s*//g;' \