tools: create identity if not exists, obtain superuser privilege in nfd-start

refs #1570

Change-Id: I02c4c050d30d29df2b39f3b0c7dd111e6fc53a1f
diff --git a/tools/nfd-start.sh b/tools/nfd-start.sh
index ed16690..9fe9424 100755
--- a/tools/nfd-start.sh
+++ b/tools/nfd-start.sh
@@ -18,6 +18,17 @@
   exit 1
 fi
 
+if ! ndnsec-get-default &>/dev/null
+then
+  ndnsec-keygen /localhost/operator | ndnsec-install-cert -
+fi
+
+if ! sudo true
+then
+  echo 'Unable to obtain superuser privilege'
+  exit 2
+fi
+
 sudo nfd &
 sleep 2
 nrd &