Hello monks,
I've got the following script running in SUID-mode => taint-mode and I get the following msg when trying to start it: Insecure dependency in connect while running setuid at /usr/local/lib/perl5/5.6.1/386/AT-svr4/IO/Socket.pm line 108.

I don't really need it 100% secure because all incoming data is from me and I'm the only one using it.
Is it possible to turn off taint-mode for SUID-Scripts? But it would be much more nice to know WHY it doesn't work, so here's the code:


#!/usr/local/bin/perl -w use strict; use Net::FTP; use Net::Ping; my $serverfile = '/home/someuser/etc/checkftp/servers'; my @serverfile = (); open(FILE, "< $serverfile") || die "Couldn't open $serverfile: $!"; @serverfile = <FILE>; close(FILE); foreach(@serverfile) { chomp; my ($type, $host, $user, $pw) = split(/:/, $_); if ($type eq "ftp") { &ftpcheck($host,$user,$pw); } elsif ($type eq "ping") { &pingcheck($host); } else { print "Unknown Check: $type\n"; } } sub ftpcheck { my $ftperror = 0; my ($host, $user, $pw) = @_; my $ftp = Net::FTP->new("$host", Timeout => 6, Debug => 0) || eval { print "FTP-CHECK:\t[$host]\t\t=>\tCouldn't connect: $!\n" +; ++$ftperror; }; return; if ($ftperror eq "0") { $ftp->login($user, $pw) || eval { print "FTP-CHECK:\t[$host]\t\t=>\tCouldn't login: $!\n +"; ++$ftperror; }; } if ($ftperror eq "0") { $ftp->quit || eval { print "FTP-CHECK:\t[$host]\t\t=>\tCouldn't quit: $!\n" +; ++$ftperror; }; } if ($ftperror eq "0") { print "FTP-CHECK:\t[$host]\t\t=>\tOK.\n"; } $ftp->quit(); } sub pingcheck { my $pingerror = 0; my $host = $_[0]; my $ping = Net::Ping->new("icmp"); $ping->ping($host) || eval { print "PING-CHECK:\t[$host]\t\t=>\tCouldn't ping: $!\n"; +++$pingerror; }; if ($pingerror eq "0") { print "PING-CHECK:\t[$host]\t\t=>\tOK.\n"; } $ping->close(); }

Edit kudra, 2002-04-24 Added a readmore tag


In reply to SUID-Taint-Problem?! by kodo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.