Browse Source

Changes n' stuff.

Matthew Clark 6 years ago
parent
commit
b9fc95ce3e
4 changed files with 23 additions and 6 deletions
  1. 5 0
      .dfme
  2. 6 1
      README.md
  3. 0 3
      dfconfig
  4. 12 2
      dfshell

+ 5 - 0
.dfme

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+TO="mrclark32493@gmail.com"
+
+SHELL="/bin/bash"

+ 6 - 1
README.md

@@ -1,3 +1,8 @@
-Dual Factor Shell
+#Dual Factor Shell ( DFShell )
+
+---
 
 Add dual factor authentication to your shell.
+
+---
+

+ 0 - 3
dfconfig

@@ -1,12 +1,9 @@
 #!/bin/bash
 
 FROM="dfshell@nclarkdev.com"
-TO="mrclark32493@gmail.com"
 
 TOKEN_LENGTH=5
 
-SHELL="/bin/bash"
-
 SMTP_SERV="vmail.nclarkdev.com:587"
 SMTP_USER="ping@ping.ping"
 SMTP_PASS="ping"

+ 12 - 2
dfshell

@@ -5,16 +5,26 @@ echo ""
 echo "Dual Factor Auth Shell"
 echo ""
 
-# Load the configuration
+# Load the default config
 source $( dirname $0 )/dfconfig
 
+# Load the user config
+if [[ -e "~/.dfme" ]]; then
+
+	source ~/.dfme
+else
+
+	echo "No user config."
+fi
+
 # Generate the token
 TOKEN=$( cat /dev/urandom | tr -cd '0-9' | head -c $TOKEN_LENGTH )
 
 # Send the token
 echo -n "Sending token... "
-echo "Your token is [ $TOKEN ]" | mailx -r "$FROM" -s "DFShell Token" -S smtp="$SMTP_SERV" -S smtp-use-starttls -S smtp-auth=plain -S smtp-auth-user="$SMTP_USER" -S smtp-auth-password="$SMTP_PASS" -S ssl-verify=ignore -S nss-config-dir=/etc/pki/nssdb/ $TO 2> /dev/null
+echo "Your token is [ $TOKEN ]." | mailx -r "$FROM (DFShell Tokens)" -s "DFShell Token" -S smtp="$SMTP_SERV" -S smtp-use-starttls -S smtp-auth=plain -S smtp-auth-user="$SMTP_USER" -S smtp-auth-password="$SMTP_PASS" -S ssl-verify=ignore -S nss-config-dir=/etc/pki/nssdb/ $TO 2> /dev/null
 
+# Check that the token was sent successfully
 if [ "$?" = "0" ]; then
 
 	echo "done"