diff --git a/ssl/dhparams b/ssl/dhparams index f6eb0686602ee29eda315ff7ad27d9169f56c3b3..78e857b99c3d69c1b55f4e579246ceeb02548669 100755 --- a/ssl/dhparams +++ b/ssl/dhparams @@ -1,2 +1,25 @@ #!/bin/sh -e +. "$1" +if [ -z "$path" ] +then + echo "failed=True msg=Path not set." + exit +fi + +if [ ! -r $path ] +then + echo "failed=True msg=Can\'t access path." + exit +fi + +if [ ! -f $path ] +then + echo "failed=True msg=Path doesn't exist or is not a file." + exit +fi + +bits="$(openssl dhparam -in $path -text -noout \ + | sed -n 's/Diffie-Hellman-Parameters: (\([0-9]*\) bit)/\1/p')" + +echo "{ \"changed\": False, \"bits\": \"$bits\" }"