diff --git a/modules/mail/mail_test b/modules/mail/mail_test index e02c89b78..90fe38dea 100755 --- a/modules/mail/mail_test +++ b/modules/mail/mail_test @@ -21,7 +21,7 @@ body=$3 -(echo "From: nettemp device <$address> "; echo "To: <$reci>"; echo "Subject: $subject"; echo ""; echo -e "$body"; uuencode $4 $4 ) | msmtp \ +(echo "From: nettemp device <$address> "; echo "To: <$reci>"; echo "Subject: $subject"; echo ""; echo -e "$body"; uuencode $4 $4 && uuencode $5 $5) | msmtp \ -f $address \ --host=$host --port=$port --auth=$auth --user=$user \ --passwordeval="sqlite3 $dir/dbf/nettemp.db 'SELECT password FROM mail_settings'" \ diff --git a/modules/security/radius/EAP_TLS_client b/modules/security/radius/EAP_TLS_client index d3ad72ac8..0ee7a93d5 100755 --- a/modules/security/radius/EAP_TLS_client +++ b/modules/security/radius/EAP_TLS_client @@ -2,11 +2,12 @@ user="$1" mail="$2" -days="$3" +method="$3" +days="$4" -if [[ ! -n "$user" || ! -n "$mail" ]]; then - echo "No user or email or days" - echo "ex. client test test@test.com 365" +if [[ ! -n "$user" || ! -n "$mail" || ! -n "$method" ]]; then + echo "No user or email or days or method" + echo "ex. client test test@test.com p12 365" exit 0 fi @@ -33,16 +34,28 @@ sudo openssl pkcs12 -export -in client.crt -inkey client.key -out client.p12 -p sudo mv client.p12 users/$user/export.p12 -sudo mv client.pem users/$user/$user.pem +sudo mv client.pem users/$user/export.pem +sudo mv client.key users/$user/export.key +sudo mv client.crt users/$user/export.crt sudo rm $mail.pem sudo touch users/$user/pass.txt sudo chmod g+w users/$user/pass.txt sudo echo "$pass" > users/$user/pass.txt -if [ -s users/$user/export.p12 ]; then - /var/www/nettemp/modules/mail/mail_test $mail "WiFi certificate from RADIUS " "This is Your certificate file and export password, valid $days days: $pass" users/$user/export.p12 -else - echo "empty export" + +if [ "$method" == "pem" ]; then + if [[ -s users/$user/export.pem && -s users/$user/export.key ]]; then + /var/www/nettemp/modules/mail/mail_test $mail "WiFi certificate from RADIUS " "This is Your certificate file and export password, valid $days days: $pass" "users/$user/export.pem" "users/$user/export.key" + else + echo "No pem or key file" + fi +fi +if [ "$method" == "p12" ]; then + if [ -s users/$user/export.p12 ]; then + /var/www/nettemp/modules/mail/mail_test $mail "WiFi certificate from RADIUS " "This is Your certificate file and export password, valid $days days: $pass" "users/$user/export.p12" + else + echo "No p12 file" + fi fi sudo pkill radiusd diff --git a/modules/security/radius/html/certs.php b/modules/security/radius/html/certs.php index a3edaec52..01bad5974 100755 --- a/modules/security/radius/html/certs.php +++ b/modules/security/radius/html/certs.php @@ -15,9 +15,10 @@ $mail = isset($_POST['mail']) ? $_POST['mail'] : ''; $days = isset($_POST['days']) ? $_POST['days'] : ''; $add = isset($_POST['add']) ? $_POST['add'] : ''; +$method = isset($_POST['method']) ? $_POST['method'] : ''; if ($add == "add"){ - shell_exec("modules/security/radius/EAP_TLS_client $username $mail $days"); + shell_exec("modules/security/radius/EAP_TLS_client $username $mail $method $days"); header("location: " . $_SERVER['REQUEST_URI']); exit(); } @@ -27,17 +28,24 @@
Name | Valid days | |||
---|---|---|---|---|
Name | Valid days | Type | ||
- + | + |