Code Monkey home page Code Monkey logo

Comments (4)

Jnchi avatar Jnchi commented on August 29, 2024
pamtester -v sshd jnchi authenticate
pamtester: invoking pam_start(sshd, jnchi, ...)
pamtester: performing operation - authenticate
Connected
Enter the following code at https://aka.ms/devicelogin : BDNKF8HDY
Please hit enter after you have logged in.
Connected
no upn?
Segmentation fault (core dumped)

printf("no upn?\n");

See #6 for more info.

from pam_aad.

Jnchi avatar Jnchi commented on August 29, 2024
strace pamtester -v sshd jnchi authenticate
openat(AT_FDCWD, "/home/cyberninjas/Documents/C_aad/pam_aad/src/key.pem", O_RDONLY) = -1 ENOENT (No such file or directory)

- const unsigned char *key = load_file("/home/cyberninjas/Documents/C_aad/pam_aad/src/key.pem");

from pam_aad.

Jnchi avatar Jnchi commented on August 29, 2024
pamtester: invoking pam_start(sshd, jnchi, ...)
pamtester: performing operation - authenticate
Connected
Enter the following code at https://aka.ms/devicelogin : B8TNPJ8LE
Please hit enter after you have logged in.
Connected
parsed
parsed
Connected
Segmentation fault (core dumped)

printf("Connected\n");

Function Debug Trace

Note: By temporarily disabling required_group_id, the module no longer segmentation faults:

src/aad.c

      //if (azure_user_in_group(token_buf, params.required_group_id, params.tenant) == 0){
          rc = PAM_SUCCESS;
      //}
pamtester -v sshd jnchi authenticate
pamtester: invoking pam_start(sshd, jnchi, ...)
pamtester: performing operation - authenticate
Connected
Enter the following code at https://aka.ms/devicelogin : BT9KQQNPU
Please hit enter after you have logged in.
Connected
parsed
parsed
Password:
pamtester: Authentication failure

PAM Functions

  • pam_sm_authenticate()
  • pam_sm_setcred()
  • pam_sm_acct_mgmt() (missing)
PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc, const char **argv) {
	return PAM_SUCCESS;
}
auth [success=2 default=ok] pam_debug.so auth=success cred=success
auth [success=2 default=ok] pam_debug.so cred=success

pamtester -v sshd jnchi authenticate
pamtester: invoking pam_start(sshd, jnchi, ...)
pamtester: performing operation - authenticate
Connected
Enter the following code at https://aka.ms/devicelogin : B9EKNA4BD
Please hit enter after you have logged in.
Connected
parsed
parsed
auth=success
pamtester: successfully authenticated

Note: Commented out aad.so line in /etc/pam.d/sshd and authentication still failed.

Nov 29 16:05:52 pam_aad pamtester: pam_unix(sshd:auth): authentication failure; logname= uid=1000 euid=1000 tty= ruser= rhost=  user=jnchi

PAM: Authentication failure, with valid password
Switch on PAM debugging to Syslog

Nov 29 18:30:55 pam_aad unix_chkpwd[32649]: check pass; user unknown
Nov 29 18:30:55 pam_aad unix_chkpwd[32649]: password check failed for user (jnchi)
Nov 29 18:30:55 pam_aad pamtester: pam_unix(sshd:auth): authentication failure; logname= uid=1000 euid=1000 tty= ruser= rhost=  user=jnchi

Note: pamtester only works if testing from the same user account i.e. the user being authenticated; still cannot login via ssh.

from pam_aad.

Jnchi avatar Jnchi commented on August 29, 2024

/etc/ssh/sshd_config

PasswordAuthentication yes
ChallengeResponseAuthentication yes
UsePAM yes

from pam_aad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.