Re: Beacon code feedback
Hi, John -- Thanks for the feedback and the code additions!
* I'll be adding the "run as user X" code as soon as I can.
* The hostname stuff has already been fixed -- The current version at the
time you sent this was slightly newer than the version you had. (And I'm
getting ready to release another version on probably Tuesday, July 13th.)
* I'll have a look at the Solaris stuff you supplied here and see about
incorporating it, too, if possible.
Thanks again!
Mitch
>Date: Thu, 8 Jul 2004 11:47:43 -0500
>From: John Kristoff <jtk@northwestern.edu>
>To: beacon@dast.nlanr.net
>Subject: Beacon code feedback
>
>I have a few comments on my recent experience setting up a Beacon client
>on a Solaris 2.6 box (which you'll now find on the beacon page).
>
>Be forewarned, I don't know Perl, I know combat Perl. :-)
>
>I wanted to run the client via a start-up script and as another user so
>I added the following lines to the src/beacon.conf:
>
> RUNASUSER = userid
> RUNASGROUP = groupid
>
>Where userid/groupid are non-privileged user/group ids. Then in the
>src/beacon script, I added declartions as such:
>
> my $RUNASUSER;
> my $RUNASGROUP;
> my $userid;
> my $groupid;
>
>In the foreach loop that processes options and just before the last else {}
>I added the following:
>
> } elsif ($var eq "RUNASUSER") {
> $userid = $opts{$var};
> $< = $> = getpwnam($userid) || die "Unable to get $userid: $!\n";
> } elsif ($var eq "RUNASGROUP) {
> $groupid = $opts{$var};
> $( = $) = getgrnam($groupid) || die "Unable to get $groupid: $!\n";
>
>Then much further along in the script where there was the following:
>
> $user = $ENV{'USER'} || `who am i`;
>
>I changed that to:
>
> my $user;
> if ($userid) {
> $user = $userid;
> } else {
> $user = $ENV{'USER'} || `who am i`;
> }
>
>The system I was running on was also one of those where the fully
>qualified domain name of the host wasn't being retrieved by this line:
>
> my $host = $ENV{'HOSTNAME'} || `hostname`;
>
>So after that line I added the following:
>
> if ($host !~ /\./) {
> require Net::Domain;
> $host = $Net::Domain::hostfqdn() || die "Unable to get fqdn: $!\n";
> }
>
>Another problem I had was that during the runtime of the script I was
>getting an error in reference to the inet_pton() call. With the help of
>Andy Elble, it turns out that Solaris 2.6 needed a couple of additional
>libraries to be linked into the resulting Beacon.so.
>
>In Net-Multicast-Beacon/Makefile.PL.in I changed:
>
> 'LIBS' => [' -L../librtp -lrtp -L../libbeacon -lbeacon'],
>
>to:
>
> 'LIBS' => ['-L../librtp -lrtp -L../libbeacon -lbeacon -lnsl -lresolv'],
>
>I also noticed that Sys::Hostname does not every appear to be referenced
>in the beacon script. Unless I'm missing something, perhaps that should
>be removed from the code.
>
>John
>
>
--
Mitch Kutzko | mitch@dast.nlanr.net | mitch@ncsa.uiuc.edu | 217-333-1199
Project: http://dast.nlanr.net/ | Personal: http://hobbes.ncsa.uiuc.edu/