CyberNinjas / pam_aad

Azure Active Directory PAM Module
GNU General Public License v3.0
55 stars 19 forks source link

Send device code in email #24

Closed Jnchi closed 5 years ago

Jnchi commented 5 years ago

Resources:

Depends on: https://github.com/CyberNinjas/pam_aad/pull/25

Jnchi commented 5 years ago

Converse

An email with a one-time passcode was sent to your email.

Email

Hi {{username}}@{{domain}},

Please use this one-time passcode (OTP) to sign in to your account: {{device_code}.

This OTP expires in {{expiration}} minutes.

Please do not REPLY to this email address, it does not support receiving messages.
Jnchi commented 5 years ago
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@"
  "rfcpedant.example.org>\r\n",

Source: https://curl.haxx.se/libcurl/c/smtp-mail.html

Resources:

Jnchi commented 5 years ago

https://github.com/somnisoft/smtp-client

Jnchi commented 5 years ago
(gdb) print msg->data[3]
$8 = 0x600000000 <error: Cannot access memory at address 0x600000000>
Jnchi commented 5 years ago
Mar 18 09:11:23 debian sshd[27230]: Connection reset by 192.168.1.120 port 50252 [preauth]
Mar 18 09:11:44 debian sshd[27251]: error: PAM: User account has expired for jnchi from 192.168.1.120
Mar 18 09:11:44 debian sshd[27251]: Failed keyboard-interactive/pam for jnchi from 192.168.1.120 port 50340 ssh2
Jnchi commented 5 years ago

Notify user to check their email

/etc/pam.d/sshd

# Notify user to check their email.
password required pam_echo.so file=/usr/share/doc/aad.txt

/usr/share/doc/aad.txt

An email with a one-time passcode was sent to your email.

http://linux-pam.org/Linux-PAM-html/sag-pam_echo.html

Jnchi commented 5 years ago

PAM_TEXT_INFO (See: https://github.com/linux-pam/linux-pam/blob/master/modules/pam_nologin/pam_nologin.c#L93)

http://www.linux-pam.org/Linux-PAM-html/mwg-expected-by-module-item.html#mwg-pam_conv