How to make a profile script to send Alert Email after three failed login attempts.
You can use the system() function (p112 of the A-Z Reference Guide) to interface with an external command or script to send email alerts. For example, this could be as simple as passing the user and host information of the failed authentication attempt directly to the sendmail command, or for greater flexibility you may wish to pass the information to a Perl script to handle the email alerts.
Here is an example of how to send an email alert via sendmail after 3 failed authentication attempts:
# Prompt the user for authentication, allowing 3 attempts
if ( getuserpasswd(user, "Password: ", 3) == true ) {
accept;
} else {
# Construct content of email alert.
email_msg = "Authentication failed for user " + user + " from host " + submithost + ".";
# Send the email using sendmail
cmd_output = system( "echo " + email_msg + " | sendmail ian@master1.pmdemo.local" );
# Check the return code to verify the command completed successfully.
if ( status == 0 ) {
print("Email alert generated for failed authentication attempt.");
}
reject;
}
© 2024 One Identity LLC. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center