Why can't I use pam_echo.so in the sudo pam stack?
I ran sudo and used GDB to do a back-trace. I followed the bread crumbs and found that preventing PAM output is hard coded into sudo.
The backtrace:
#13 0x00007f9879eba7e0 in pam_authenticate (pamh=0x56373c553960, flags=flags@entry=32768) at pam_auth.c:34 #14 0x00007f987a3510de in sudo_pam_verify (pw=, prompt=0x56373c553d00 "[sudo] password for steve: ", auth=, callback=0x7ffea8406880) at auth/pam.c:182 #15 0x00007f987a35052c in verify_user (pw=0x56373c54ce98, prompt=prompt@entry=0x56373c553d00 "[sudo] password for steve: ", validated=validated@entry=2, callback=callback@entry=0x7ffea8406880) at auth/sudo_auth.c:294 #16 0x00007f987a3520e5 in check_user (auth_pw=0x56373c54ce98, mode=, validated=2) at ./check.c:149 #17 0x00007f987a3520e5 in check_user (validated=validated@entry=2, mode=) at ./check.c:212 #18 0x00007f987a36506d in sudoers_policy_main (argc=argc@entry=1, argv=argv@entry=0x7ffea8406cf0, pwflag=pwflag@entry=0, env_add=env_add@entry=0x56373c5414f0, closure=closure@entry=0x7ffea84069f0) at ./sudoers.c:423 #19 0x00007f987a35eca4 in sudoers_policy_check (argc=1, argv=0x7ffea8406cf0, env_add=0x56373c5414f0, command_infop=0x7ffea8406a80, argv_out=0x7ffea8406a88, user_env_out=0x7ffea8406a90) at ./policy.c:758 #20 0x000056373aee448f in main (plugin=0x56373b102480 , user_env_out=0x7ffea8406a90, argv_out=0x7ffea8406a88, command_info=0x7ffea8406a80, env_add=0x56373c5414f0, argv=0x7ffea8406cf0, argc=1) at ./sudo.c:1342 #21 0x000056373aee448f in main (argc=, argv=, envp=) at ./sudo.c:261
On lines 181-182 of auth/pam.c, I found that pam_authenticate is called with the PAM_SILENT flag to prevent any output.
/* PAM_SILENT prevents the authentication service from generating output. */ *pam_status = pam_authenticate(pamh, PAM_SILENT);