Skip to content
Snippets Groups Projects
Select Git revision
  • 805f64d0627d10835d2607d8889bd68fd724b5e9
  • master default
  • init_facts_module
3 results

dhparams

Blame
  • dhparams 468 B
    #!/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/[a-zA-Z#0-9 \-]*Parameters: (\([0-9]*\) bit)/\1/p')"
    
    echo "{ \"changed\": false, \"path\": \"$path\", \"bits\": $bits }"