Re: Compiling HostSentry

2001-06-26 Thread Marc-Christian Petersen

Hi all,

as of some ppl are trying to use hostsentry i was interessted in do it too 
:-) ... i have installed python with module support for utmp and dbm. I have 
changed hostsentry.conf according to the readme and of some mails i have read 
here. And now, if i want to use hostsentry, i get the following:

root@codeman:/usr/local/hostsentry# ./hostsentry.py 
from: can't read /var/mail/hostSentryCore
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: POLL_DELAY: command not found
./hostsentry.py: VERSION: command not found
./hostsentry.py: line 59: syntax error near unexpected token `hostSentry(h'
./hostsentry.py: line 59: `class hostSentry(hostSentryCore):'

I use Debian SID!

Thanks for your help.

Kind regards,
Marc


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Compiling Hostsentry

2001-06-26 Thread Marc-Christian Petersen

Hi all,

here is a little c++ program which u can use to determine your utmp/wtmp 
format to use it correctly with hostsentry. It works fine for me and maybe it 
can be added to future releases of hostsentry cause it may be usefull for 
some ppl. :-)

I have attached an C++ and C Version!

Kind regards,
Marc

// to compile: gcc -o showwtmp showwtmp.c
#include stdio.h
#include utmp.h

main() {
  int
  	s_utmp,
	s_ut_type,
	s_pid_t,
	o_tty_name,
	s_tty_name,
	o_username,
	s_username,
	o_hostname,
	s_hostname;
  s_utmp= sizeof(struct utmp);
  s_ut_type = sizeof(short);
  s_pid_t   = sizeof(pid_t);
  o_tty_name = s_pid_t + s_ut_type;
  s_tty_name = UT_LINESIZE;
  o_username = o_tty_name + s_tty_name + 4; //4=sizeof(abbrev. ttyname)
  s_username = UT_NAMESIZE;
  o_hostname = o_username + s_username;
  s_hostname = UT_HOSTSIZE;
  printf(size of utmp struct: %d\n, s_utmp);
  printf(size of ut_type: %d\n, s_ut_type);
  printf(size of pid_t:   %d\n, s_pid_t);
  printf(offset of tty name:  %d\n, o_tty_name);
  printf(size of tty name:%d\n, s_tty_name);
  printf(offset of username:  %d\n, o_username);
  printf(size of username:%d\n, s_username);
  printf(offset of hostname:  %d\n, o_hostname);
  printf(size of hostname:%d\n, s_hostname);
  printf(\nformat:\n);
  printf(\%d/%d:%d/%d:%d/%d:%d\\n, s_utmp, o_tty_name, s_tty_name, o_username, s_username, o_hostname, s_hostname);
  return 0;
}


// to compile: g++ -o showwtmp showwtmp.cpp
#include stdio.h
#include utmp.h

int main(int argc, char **argv) {
  int
  	s_utmp= sizeof(struct utmp),
	s_ut_type = sizeof(short),
	s_pid_t   = sizeof(pid_t),
	o_tty_name = s_pid_t + s_ut_type,
	s_tty_name = UT_LINESIZE,
	o_username = o_tty_name + s_tty_name + 4, //4=sizeof(abbrev. ttyname)
	s_username = UT_NAMESIZE,
	o_hostname = o_username + s_username,
	s_hostname = UT_HOSTSIZE;
  printf(size of utmp struct: %d\n, s_utmp);
  printf(size of ut_type: %d\n, s_ut_type);
  printf(size of pid_t:   %d\n, s_pid_t);
  printf(offset of tty name:  %d\n, o_tty_name);
  printf(size of tty name:%d\n, s_tty_name);
  printf(offset of username:  %d\n, o_username);
  printf(size of username:%d\n, s_username);
  printf(offset of hostname:  %d\n, o_hostname);
  printf(size of hostname:%d\n, s_hostname);
  printf(\nformat:\n);
  printf(\%d/%d:%d/%d:%d/%d:%d\\n, s_utmp, o_tty_name, s_tty_name, o_username, s_username, o_hostname, s_hostname);
  return 0;
}



Re: Compiling Hostsentry

2001-06-26 Thread Stefan Srdic

Marc-Christian Petersen wrote:

 Hi all,

 here is a little c++ program which u can use to determine your utmp/wtmp
 format to use it correctly with hostsentry. It works fine for me and maybe it
 can be added to future releases of hostsentry cause it may be usefull for
 some ppl. :-)

 I have attached an C++ and C Version!

 Kind regards,
 Marc


Thanks a lot!! I compiled your showwtmp.c file and it executed perfectly. Nice
work!!

I'll be Ded'ing HostSentry this week end and I will make sure that your C script
makes it into the package. Perhaps it could be used in a Debconf script during
the initial HostSentry installation :-D

If your having problems with Hostsentry, remember that it is Alpha grade
software, you should be directing your problems and error reports to the Abacus
mailling list.

Thanks for all of your help guys, I'll keep you all posted when HostSentry deb's
become available.

Stef


--  
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Compiling HostSentry

2001-06-26 Thread Benoît Sibaud
Hi,

 printf(offset of username:
Wrong copy paste. I don't know how to complete it.

Linux X 2.2.19 #1 Wed May 16 07:41:58 EST 2001 i686 unknown
size of utmp struct: 384
size of ut_type: 2
size of pid_t: 4
offset of tty name: 6
size of tty name: 32

Linux Y 2.2.19 #1 Mon Apr 2 13:29:46 EDT 2001 sparc unknown
size of utmp struct: 384
size of ut_type: 2
size of pid_t: 4
offset of tty name: 6
size of tty name: 32

--
Benoît Sibaud
RD Engineer - France Telecom



Re: Compiling HostSentry

2001-06-26 Thread Marc-Christian Petersen
Hi all,

as of some ppl are trying to use hostsentry i was interessted in do it too 
:-) ... i have installed python with module support for utmp and dbm. I have 
changed hostsentry.conf according to the readme and of some mails i have read 
here. And now, if i want to use hostsentry, i get the following:

[EMAIL PROTECTED]:/usr/local/hostsentry# ./hostsentry.py 
from: can't read /var/mail/hostSentryCore
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: import: command not found
./hostsentry.py: POLL_DELAY: command not found
./hostsentry.py: VERSION: command not found
./hostsentry.py: line 59: syntax error near unexpected token `hostSentry(h'
./hostsentry.py: line 59: `class hostSentry(hostSentryCore):'

I use Debian SID!

Thanks for your help.

Kind regards,
Marc



Re: Compiling HostSentry

2001-06-26 Thread Marc-Christian Petersen

On Dienstag, 26. Juni 2001 11:20 you wrote:

Hi Berend,

i have tried your hint and it works fine. Shame on me that i did not 
recognize it myself :-)

But now i have the following failure when i log in to my system: 

Jun 26 11:38:43 codeman login[1213]: ROOT LOGIN on `pts/9' 
Jun 26 11:38:43 codeman hostSentry[1174]: adminalert: Error reading/writing 
to TTY state database during logout processing.

Thanks for your help.

Kind regards,
   Marc



Re: Compiling Hostsentry

2001-06-26 Thread Marc-Christian Petersen
Hi all,

here is a little c++ program which u can use to determine your utmp/wtmp
format to use it correctly with hostsentry. It works fine for me and maybe it
can be added to future releases of hostsentry cause it may be usefull for
some ppl. :-)

I have attached an C++ and C Version!

Kind regards,
Marc// to compile: gcc -o showwtmp showwtmp.c
#include stdio.h
#include utmp.h

main() {
  int
  	s_utmp,
	s_ut_type,
	s_pid_t,
	o_tty_name,
	s_tty_name,
	o_username,
	s_username,
	o_hostname,
	s_hostname;
  s_utmp= sizeof(struct utmp);
  s_ut_type = sizeof(short);
  s_pid_t   = sizeof(pid_t);
  o_tty_name = s_pid_t + s_ut_type;
  s_tty_name = UT_LINESIZE;
  o_username = o_tty_name + s_tty_name + 4; //4=sizeof(abbrev. ttyname)
  s_username = UT_NAMESIZE;
  o_hostname = o_username + s_username;
  s_hostname = UT_HOSTSIZE;
  printf(size of utmp struct: %d\n, s_utmp);
  printf(size of ut_type: %d\n, s_ut_type);
  printf(size of pid_t:   %d\n, s_pid_t);
  printf(offset of tty name:  %d\n, o_tty_name);
  printf(size of tty name:%d\n, s_tty_name);
  printf(offset of username:  %d\n, o_username);
  printf(size of username:%d\n, s_username);
  printf(offset of hostname:  %d\n, o_hostname);
  printf(size of hostname:%d\n, s_hostname);
  printf(\nformat:\n);
  printf(\%d/%d:%d/%d:%d/%d:%d\\n, s_utmp, o_tty_name, s_tty_name, o_username, s_username, o_hostname, s_hostname);
  return 0;
}
// to compile: g++ -o showwtmp showwtmp.cpp
#include stdio.h
#include utmp.h

int main(int argc, char **argv) {
  int
  	s_utmp= sizeof(struct utmp),
	s_ut_type = sizeof(short),
	s_pid_t   = sizeof(pid_t),
	o_tty_name = s_pid_t + s_ut_type,
	s_tty_name = UT_LINESIZE,
	o_username = o_tty_name + s_tty_name + 4, //4=sizeof(abbrev. ttyname)
	s_username = UT_NAMESIZE,
	o_hostname = o_username + s_username,
	s_hostname = UT_HOSTSIZE;
  printf(size of utmp struct: %d\n, s_utmp);
  printf(size of ut_type: %d\n, s_ut_type);
  printf(size of pid_t:   %d\n, s_pid_t);
  printf(offset of tty name:  %d\n, o_tty_name);
  printf(size of tty name:%d\n, s_tty_name);
  printf(offset of username:  %d\n, o_username);
  printf(size of username:%d\n, s_username);
  printf(offset of hostname:  %d\n, o_hostname);
  printf(size of hostname:%d\n, s_hostname);
  printf(\nformat:\n);
  printf(\%d/%d:%d/%d:%d/%d:%d\\n, s_utmp, o_tty_name, s_tty_name, o_username, s_username, o_hostname, s_hostname);
  return 0;
}


Re: Compiling Hostsentry

2001-06-26 Thread Stefan Srdic
Marc-Christian Petersen wrote:

 Hi all,

 here is a little c++ program which u can use to determine your utmp/wtmp
 format to use it correctly with hostsentry. It works fine for me and maybe it
 can be added to future releases of hostsentry cause it may be usefull for
 some ppl. :-)

 I have attached an C++ and C Version!

 Kind regards,
 Marc


Thanks a lot!! I compiled your showwtmp.c file and it executed perfectly. Nice
work!!

I'll be Ded'ing HostSentry this week end and I will make sure that your C script
makes it into the package. Perhaps it could be used in a Debconf script during
the initial HostSentry installation :-D

If your having problems with Hostsentry, remember that it is Alpha grade
software, you should be directing your problems and error reports to the Abacus
mailling list.

Thanks for all of your help guys, I'll keep you all posted when HostSentry deb's
become available.

Stef



Re: Compiling HostSentry

2001-06-25 Thread Gregoire Welraeds

According to man utmp on potato I386, PII:

 # a) Size of utmp record (sizeof(struct utmp)) for your host.
384
 # b) Offset to tty field from beginning of record.
6
 # c) Length of tty field.
32
 # d) Offset to username field from beginning of record.
42
 # e) Length of username field.
32
 # f) Offset to hostname field from beginning of record.
74
 # g) Length of hostname field.
256

If you have the same config as me, then, I think you can use these values.
Otherwise, you just have to write some C code to get the right answer. Like in:

quote

#include utmp.h

int main()
{
printf(size of utmp struct: %d\n, sizeof(struct utmp));
printf(size of ut_type: %d\n, sizeof(short));
printf(size of pid_t: %d\n, sizeof(pid_t));
printf(offset of tty name: %d\n, sizeof(pid_t)+ sizeof(short));
printf(size of tty name: %d\n, UT_LINESIZE);
printf(offset of username: 
return 0;
}

/quote

signature
Grégoire Welraeds
gregoire (at) welraeds (dot) be
/signature

On Sun, 24 Jun 2001, Stefan Srdic wrote:

 Hey, I've compiled and installed HostSentry on my Patato box. I
 installed it under the /etc/hostsentry directory. I was editing the
 configuration file and got stumped over a setting.
 
 HostSentry needs to know the format of wtmp.
 
 Here's a snip from the conf file:
 
 # The basic things needed are:
 #
 # a) Size of utmp record (sizeof(struct utmp)) for your host.
 # b) Offset to tty field from beginning of record.
 # c) Length of tty field.
 # d) Offset to username field from beginning of record.
 # e) Length of username field.
 # f) Offset to hostname field from beginning of record.
 # g) Length of hostname field.
 #
 # The format is formed like this:
 #
 #
 
utmpRecordLength/ttyOffset:ttyLen/usernameOffset:usernameLen/hostnameOffset:hostnameLen
 
 #
 # For example on RedHat:
 #
 # utmp record size is: 384 bytes
 # tty entry offset is: 8 bytes
 # tty entry size from offset is: 32 bytes
 # username entry offet is: 44 bytes
 # username entry size from offset is: 32 bytes
 # hostname entry offset is: 76 bytes
 # hostname entry size from offset: 256 bytes
 #
 # This would be formed as 384/8:32/44:32/76:256
 #
 # NOTE: All of this garbage will hopefully go away on a future update
 when
 # I wrap native getutent() functions for Python.
 #
 # RedHat
 WTMP_FORMAT = 384/8:32/44:32/76:256
 # Slackware
 #WTMP_FORMAT = 56/8:12/28:8/36:16
 # BSD variants
 #WTMP_FORMAT = 36/0:8/8:8/16:16
 
 Where can I find this information? I've compiled this program before on
 Mandrake. The configuration was easy since I only had to follow the
 RedHat settings.
 
 I would like to get this program up and running. I want to learn how it
 works and then attemp to compile it into a deb package for unstable.
 
 I have this idea that if we can get logcheck, portsentry and hostsentry
 all compiled into deb packes that we could create an apt- script that
 would install the Abacus project all in one shot. It would very usefull
 for Debian sysadmins, and all apps could be launched via the same rc
 script.
 
 I would like to hear some of your awnsers and opinions please :-D
 
 Stef
 
 
 
 --  
 To UNSUBSCRIBE, email to [EMAIL PROTECTED]
 with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
 
 



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Compiling HostSentry

2001-06-25 Thread Gregoire Welraeds
According to man utmp on potato I386, PII:

 # a) Size of utmp record (sizeof(struct utmp)) for your host.
384
 # b) Offset to tty field from beginning of record.
6
 # c) Length of tty field.
32
 # d) Offset to username field from beginning of record.
42
 # e) Length of username field.
32
 # f) Offset to hostname field from beginning of record.
74
 # g) Length of hostname field.
256

If you have the same config as me, then, I think you can use these values.
Otherwise, you just have to write some C code to get the right answer. Like in:

quote

#include utmp.h

int main()
{
printf(size of utmp struct: %d\n, sizeof(struct utmp));
printf(size of ut_type: %d\n, sizeof(short));
printf(size of pid_t: %d\n, sizeof(pid_t));
printf(offset of tty name: %d\n, sizeof(pid_t)+ sizeof(short));
printf(size of tty name: %d\n, UT_LINESIZE);
printf(offset of username: 
return 0;
}

/quote

signature
Grégoire Welraeds
gregoire (at) welraeds (dot) be
/signature

On Sun, 24 Jun 2001, Stefan Srdic wrote:

 Hey, I've compiled and installed HostSentry on my Patato box. I
 installed it under the /etc/hostsentry directory. I was editing the
 configuration file and got stumped over a setting.
 
 HostSentry needs to know the format of wtmp.
 
 Here's a snip from the conf file:
 
 # The basic things needed are:
 #
 # a) Size of utmp record (sizeof(struct utmp)) for your host.
 # b) Offset to tty field from beginning of record.
 # c) Length of tty field.
 # d) Offset to username field from beginning of record.
 # e) Length of username field.
 # f) Offset to hostname field from beginning of record.
 # g) Length of hostname field.
 #
 # The format is formed like this:
 #
 #
 utmpRecordLength/ttyOffset:ttyLen/usernameOffset:usernameLen/hostnameOffset:hostnameLen
 
 #
 # For example on RedHat:
 #
 # utmp record size is: 384 bytes
 # tty entry offset is: 8 bytes
 # tty entry size from offset is: 32 bytes
 # username entry offet is: 44 bytes
 # username entry size from offset is: 32 bytes
 # hostname entry offset is: 76 bytes
 # hostname entry size from offset: 256 bytes
 #
 # This would be formed as 384/8:32/44:32/76:256
 #
 # NOTE: All of this garbage will hopefully go away on a future update
 when
 # I wrap native getutent() functions for Python.
 #
 # RedHat
 WTMP_FORMAT = 384/8:32/44:32/76:256
 # Slackware
 #WTMP_FORMAT = 56/8:12/28:8/36:16
 # BSD variants
 #WTMP_FORMAT = 36/0:8/8:8/16:16
 
 Where can I find this information? I've compiled this program before on
 Mandrake. The configuration was easy since I only had to follow the
 RedHat settings.
 
 I would like to get this program up and running. I want to learn how it
 works and then attemp to compile it into a deb package for unstable.
 
 I have this idea that if we can get logcheck, portsentry and hostsentry
 all compiled into deb packes that we could create an apt- script that
 would install the Abacus project all in one shot. It would very usefull
 for Debian sysadmins, and all apps could be launched via the same rc
 script.
 
 I would like to hear some of your awnsers and opinions please :-D
 
 Stef
 
 
 
 --  
 To UNSUBSCRIBE, email to [EMAIL PROTECTED]
 with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
 
 




Compiling HostSentry

2001-06-24 Thread Stefan Srdic

Hey, I've compiled and installed HostSentry on my Patato box. I
installed it under the /etc/hostsentry directory. I was editing the
configuration file and got stumped over a setting.

HostSentry needs to know the format of wtmp.

Here's a snip from the conf file:

# The basic things needed are:
#
# a) Size of utmp record (sizeof(struct utmp)) for your host.
# b) Offset to tty field from beginning of record.
# c) Length of tty field.
# d) Offset to username field from beginning of record.
# e) Length of username field.
# f) Offset to hostname field from beginning of record.
# g) Length of hostname field.
#
# The format is formed like this:
#
#
utmpRecordLength/ttyOffset:ttyLen/usernameOffset:usernameLen/hostnameOffset:hostnameLen

#
# For example on RedHat:
#
# utmp record size is: 384 bytes
# tty entry offset is: 8 bytes
# tty entry size from offset is: 32 bytes
# username entry offet is: 44 bytes
# username entry size from offset is: 32 bytes
# hostname entry offset is: 76 bytes
# hostname entry size from offset: 256 bytes
#
# This would be formed as 384/8:32/44:32/76:256
#
# NOTE: All of this garbage will hopefully go away on a future update
when
# I wrap native getutent() functions for Python.
#
# RedHat
WTMP_FORMAT = 384/8:32/44:32/76:256
# Slackware
#WTMP_FORMAT = 56/8:12/28:8/36:16
# BSD variants
#WTMP_FORMAT = 36/0:8/8:8/16:16

Where can I find this information? I've compiled this program before on
Mandrake. The configuration was easy since I only had to follow the
RedHat settings.

I would like to get this program up and running. I want to learn how it
works and then attemp to compile it into a deb package for unstable.

I have this idea that if we can get logcheck, portsentry and hostsentry
all compiled into deb packes that we could create an apt- script that
would install the Abacus project all in one shot. It would very usefull
for Debian sysadmins, and all apps could be launched via the same rc
script.

I would like to hear some of your awnsers and opinions please :-D

Stef



--  
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Compiling HostSentry

2001-06-24 Thread yoros

About your question, the wtmp file is changed by the login/logout
process. I think that the login program in Debian is quite similar to
that in Slackware.
You can try to configure the HostSentry in Debian like in Slackwere.

( Sorry for my English )
-- 
yoros

 PGP signature


Re: Compiling HostSentry

2001-06-24 Thread Stefan Srdic

[EMAIL PROTECTED] wrote:

 About your question, the wtmp file is changed by the login/logout
 process. I think that the login program in Debian is quite similar to
 that in Slackware.
 You can try to configure the HostSentry in Debian like in Slackwere.

 ( Sorry for my English )
 --
 yoros



Thanks, I figured Debian would be more SLackWare then RedHat. I'll try using
the Slackware defined settings and see if anythings turns up in my logs.

As for the real Debian wtmp format, I'm anylizing the
/usr/include/bits/utmp.h and /usr/include/bits/utmpx.h files and trying to
determine the exact Debian wtmp format string to use along with HostSentry.

It might take some time, but I'll get it.

Stef



--  
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Compiling HostSentry

2001-06-24 Thread yoros
About your question, the wtmp file is changed by the login/logout
process. I think that the login program in Debian is quite similar to
that in Slackware.
You can try to configure the HostSentry in Debian like in Slackwere.

( Sorry for my English )
-- 
yoros


pgpXlAt5TZj6s.pgp
Description: PGP signature


Re: Compiling HostSentry

2001-06-24 Thread Stefan Srdic
[EMAIL PROTECTED] wrote:

 About your question, the wtmp file is changed by the login/logout
 process. I think that the login program in Debian is quite similar to
 that in Slackware.
 You can try to configure the HostSentry in Debian like in Slackwere.

 ( Sorry for my English )
 --
 yoros



Thanks, I figured Debian would be more SLackWare then RedHat. I'll try using
the Slackware defined settings and see if anythings turns up in my logs.

As for the real Debian wtmp format, I'm anylizing the
/usr/include/bits/utmp.h and /usr/include/bits/utmpx.h files and trying to
determine the exact Debian wtmp format string to use along with HostSentry.

It might take some time, but I'll get it.

Stef