From 0f142f319248479a102b4d04c4f57d2530d3bbb7 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Tue, 1 Dec 2015 12:27:20 +0200
Subject: [PATCH] Implementation.

---
 ssl/dhparams | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/ssl/dhparams b/ssl/dhparams
index f6eb068..78e857b 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\" }"
-- 
GitLab