Merge pull request #206 from edneville/123_log_ssh_original_command_in_nologin
Adding logging of SSH_ORIGINAL_COMMAND to nologin.
This commit is contained in:
commit
ef095ceef1
@ -72,6 +72,9 @@
|
|||||||
<citerefentry><refentrytitle>nologin</refentrytitle><manvolnum>5</manvolnum>
|
<citerefentry><refentrytitle>nologin</refentrytitle><manvolnum>5</manvolnum>
|
||||||
</citerefentry>.
|
</citerefentry>.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
If <command>SSH_ORIGINAL_COMMAND</command> is populated it will be logged.
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1 id='see_also'>
|
<refsect1 id='see_also'>
|
||||||
|
@ -45,9 +45,14 @@ int main (void)
|
|||||||
if (NULL == user) {
|
if (NULL == user) {
|
||||||
user = "UNKNOWN";
|
user = "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *ssh_origcmd = getenv("SSH_ORIGINAL_COMMAND");
|
||||||
uid = getuid (); /* getuid() is always successful */
|
uid = getuid (); /* getuid() is always successful */
|
||||||
openlog ("nologin", LOG_CONS, LOG_AUTH);
|
openlog ("nologin", LOG_CONS, LOG_AUTH);
|
||||||
syslog (LOG_CRIT, "Attempted login by %s (UID: %d) on %s", user, uid, tty);
|
syslog (LOG_CRIT, "Attempted login by %s (UID: %d) on %s%s%s",
|
||||||
|
user, uid, tty,
|
||||||
|
(ssh_origcmd ? " SSH_ORIGINAL_COMMAND=" : ""),
|
||||||
|
(ssh_origcmd ? ssh_origcmd : ""));
|
||||||
closelog ();
|
closelog ();
|
||||||
|
|
||||||
printf ("%s", "This account is currently not available.\n");
|
printf ("%s", "This account is currently not available.\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user