Cleaning wtmp entries when SIGTERM is received.
Senthil Kumar
senthilkumar_sen at hotpop.com
Thu Apr 28 01:44:59 EST 2005
> I also tried passing signal SIGTERM to the privileged sshd process once
> the session is obtained. This leaves impurities in wtmp entries and I
> think there is no SIGTERM handler for sshd. This shows the user as "still
> logged in" even after logout. What will be the effect if we have the
> handler for this signal? Will it break anywhere?
>
Also in HP-UX When SIGTERM is passed to the user process, the privileged
process receives the SIGCHLD and opens up the wtmp file but not cleaning it
completely.
The Tusc output in hpux when SIGCHLD is received by the privileged process
is given below:
[8248] read(10, 0x7f7f11e0, 4)
.......................................................... = 0
debug1: do_cleanup
[8248] Received signal 18, SIGCLD, in write(), [SIG_DFL], no siginfo
[8248] write(2, "d e b u g 1 : d o _ c l e a n ".., 20)
............................... = 20
debug1: PAM: cleanup
[8248] write(2, "d e b u g 1 : P A M : c l e ".., 22)
............................... = 22
[8248] time(0x7f7f2384)
................................................................. =
1114647377
[8248] sigaction(SIGPIPE, 0x7f7f24a4, 0x7f7f24cc)
....................................... = 0
[8248] sigaction(SIGPIPE, 0x7f7f24cc, NULL)
............................................. = 0
[8248] write(5, "< 3 9 > A p r 2 7 1 7 : 1 6 ".., 2048)
............................. = 2048
[8248] lseek(8, 0, SEEK_SET)
............................................................ = 0
[8248] read(8, "m s g c a t 0 1 \0\0\0( \002\001".., 1212)
.............................. = 1212
[8248] lseek(8, 492, SEEK_SET)
.......................................................... = 492
[8248] read(8, "S u c c e s s ", 7)
..................................................... = 7
[8248] time(0x7f7f23c4)
................................................................. =
1114647377
[8248] sigaction(SIGPIPE, 0x7f7f24e4, 0x7f7f250c)
....................................... = 0
[8248] sigaction(SIGPIPE, 0x7f7f250c, NULL)
............................................. = 0
[8248] write(5, "< 3 9 > A p r 2 7 1 7 : 1 6 ".., 2048)
............................. = 2048
[8248] close(9)
......................................................................... =
0
[8248] close(8)
......................................................................... =
0
[8248] close(5)
......................................................................... =
0
debug1: session_pty_cleanup: session 0 release /dev/pts/0
[8248] write(2, "d e b u g 1 : s e s s i o n _ ".., 59)
............................... = 59
[8248] time(NULL)
....................................................................... =
1114647377
[8248] getpid()
......................................................................... =
8248 (8247)
[8248] open("/etc/passwd", O_RDONLY, 0666)
.............................................. = 5
[8248] ioctl(5, TCGETA, 0x7f7f2498)
..................................................... ERR#25 ENOTTY
[8248] read(5, "r o o t : W m H B Z k z 8 Z O X ".., 8192)
.............................. = 2189
[8248] lseek(5, 4294967201, SEEK_CUR)
................................................... = 2094
[8248] close(5)
......................................................................... =
0
[8248] getuid()
......................................................................... =
0 (0)
[8248] gettimeofday(0x7f7f13e8, NULL)
................................................... = 0
[8248] open("/var/adm/wtmp", O_WRONLY|O_APPEND|O_LARGEFILE, 0)
.......................... = 5
[8248] fstat64(5, 0x7f7f14b0)
........................................................... = 0
[8248] write(5, "\0\0\0\0\0\0\0\0t s / 0 p t s / ".., 60)
............................... = 60
[8248] close(5)
......................................................................... =
0
[8248] open("/etc/utmpx", O_RDWR|O_CREAT, 0644)
......................................... = 5
[8248] read(5, "\0\0\0\0\0\0\0\0\0- h t t y 0 ".., 140)
............................... = 140
[8248] read(5, "\0\0\0\0\0\0\0\0\0- h t t y 0 ".., 140)
............................... = 140
[8248] read(5, "v x e n a b l e \0- h t t y 0 ".., 140)
............................... = 140
[8248] read(5, "b c h e c k r c \0- h t t y 0 ".., 140)
............................... = 140
[8248] read(5, "c a t \0\0\0\0\0\0- h t t y 0 ".., 140)
............................... = 140
[8248] read(5, "r m \0\0\0\0\0\0\0- h t t y 0 ".., 140)
............................... = 140
[8248] read(5, "c a t \0\0\0\0\0\0- h t t y 0 ".., 140)
............................... = 140
[8248] read(5, "s h \0\0\0\0\0\0\001\bb8@ 01\t\0".., 140)
............................... = 140
[8248] read(5, "r c \0\0\0\0\0\0\001\bb8@ 01\t\0".., 140)
............................... = 140
[8248] read(5, "g e t t y \0\0\0\001\bb8@ 01\t\0".., 140)
............................... = 140
[8248] read(5, "k r s d \0\0\0\0\0\004eb\005\0\0".., 140)
............................... = 140
[8248] read(5, "s f d \0\0\0\0\0\0\004ec\005\0\0".., 140)
............................... = 140
[8248] read(5, "s a m d \0\0\0\0\0\004ed\005\0\0".., 140)
............................... = 140
[8248] read(5, "s h \0\0\0\0\0\0\0\004ee\005\0\0".., 140)
............................... = 140
[8248] read(5, "p _ c l i e n t \0\004ee\005\0\0".., 140)
............................... = 140
[8248] read(5, "s e n t h i l \0\0\0\0\0\0\0\0\0".., 140)
............................... = 140
[8248] lseek(5, 2100, SEEK_SET)
......................................................... = 2100
[8248] write(5, "s e n t h i l \0\0\0\0\0\0\0\0\0".., 140)
.............................. = 140
[8248] open("/etc/utmp", O_RDWR|O_CREAT, 0644)
.......................................... = 8
[8248] read(8, "\0\0\0\0\0\0\0\0\0\0\0\0s y s t ".., 60)
................................ = 60
[8248] read(8, "\0\0\0\0\0\0\0\0\0\0\0\0r u n - ".., 60)
................................ = 60
[8248] read(8, "v x e n a b l e v x e n \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "b c h e c k r c b r c 1 \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "c a t \0\0\0\0\0c p r t \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "r m \0\0\0\0\0\0e m s 1 \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "c a t \0\0\0\0\0e m s 2 \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "s h \0\0\0\0\0\0l i n k \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "r c \0\0\0\0\0\0s q n c \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "L O G I N \0\0\0c o n s c o n s ".., 60)
................................ = 60
[8248] read(8, "k r s d \0\0\0\0k r s d \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "s f d \0\0\0\0\0s f d \0\0\0\0\0".., 60)
................................ = 60
[8248] read(8, "s a m d \0\0\0\0s a m d \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "s h \0\0\0\0\0\0e m s 3 \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "p _ c l i e n t e m s 4 \0\0\0\0".., 60)
................................ = 60
[8248] read(8, "a s l \0\0\0\0\0t a \0\0p t s / ".., 60)
................................ = 60
[8248] read(8, "s e n t h i l \0t s / 0 p t s / ".., 60)
................................ = 60
[8248] lseek(8, 960, SEEK_SET)
.......................................................... = 960
[8248] write(8, "s e n t h i l \0t s / 0 p t s / ".., 60)
............................... = 60
[8248] close(5)
......................................................................... =
0
[8248] close(8)
......................................................................... =
0
[8248] getuid()
......................................................................... =
0 (0)
[8248] chown("/dev/pts/0", 0, 0)
........................................................ = 0
[8248] chmod("/dev/pts/0", 0666)
........................................................ = 0
[8248] close(6)
......................................................................... =
0
[8248] exit(255)
........................................................................
WIFEXITED(255)
Thanks for any help,
Senthil Kumar.
More information about the openssh-unix-dev
mailing list