[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Monitoring sshd
From: |
Jan-Henrik Haukeland |
Subject: |
Re: Monitoring sshd |
Date: |
Fri, 14 Nov 2003 18:50:06 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux) |
David Fletcher <address@hidden> writes:
> Looking at the file "protocols/ssh.c" in the Monit distribution reveals
> that whatever identification string the server sends out, Monit sends
> the same thing back.
Hmm, not quite, chomp() strips the ending CRLF. Since it works with
the predefined string (with CRLF) it is a strong indication that the
problem is the missing CRLF in the string sent back to the server.
Does the following (untested) change fix the problem?
int check_ssh(Socket_T s) {
int n;
char buf[STRLEN];
ASSERT(s);
if((n= socket_read(s, buf, sizeof(buf))) <= 0) {
log("SSH: error receiving identification string -- %s\n", STRERROR);
return FALSE;
}
if(strncmp(buf, "SSH-", 4) != 0) {
log("SSH: protocol error %s\n", buf);
return FALSE;
}
/* send identification string back to server */
if(socket_write(s, buf, n) <= 0) {
log("SSH: error sending identification string -- %s\n", STRERROR);
return FALSE;
}
return TRUE;
}
--
Jan-Henrik Haukeland
- Monitoring sshd, David Fletcher, 2003/11/14
- Re: Monitoring sshd,
Jan-Henrik Haukeland <=