I some external Gateway through which the ssh requests come and need to log the sessionID in the linux when the connection happens. I can send the sessionID (some string) along with the username while connecting through SSH
i.e when making a ssh connection I can send username@sessionID
I want the authentication to happen with username and sessionID be stored in some log file /var/log/sessionlog.txt
How do I achieve that ?
what have I tried: Using PAM to change the username using the pam_sm_authenticate function of custom authentication pam_set_user (this will set the username@username to just username) but the ssh logs are:
- can't find username 'someusername@axvb123'
- disabling the keyboard-interactive for the non-existent user
- the authentication succeeded when it should have failed)