I don't know if anybody is interested in this, but here is included a
function for checkrad to verify the RedBack SMS500 NAS.
Caution, this is my first perl script (python fits my brain)


sub redback_telnet {
        #Localize all variables first.
        my ($terminalserver, $login, $password);
        my ($user, $context, $operprompt, $adminprompt, $t);
        return 2 unless (check_net_telnet());
        $terminalserver = $ARGV[1];
        ($user, $context) = split /@/, $ARGV[3];
        if (not $user) {
                print LOG " Error: No user defined\n" if ($debug);
                return 2;
        }
        if (not $context) {
                print LOG " Error: No context defined\n" if ($debug);
                return 2;
        }

        # Get loggin information
        ($root, $password) = naspasswd($terminalserver, 1);
        return 2 if ($password eq "");

        $operprompt = '/\[.*\].*>$/';
        $adminprompt = '/\[.*\].*#$/';

        # Logging to the RedBack NAS
        $t = new Net::Telnet (Timeout => 5, Prompt => $operprompt);
        $t->input_log("./debug");
        $t->open($terminalserver);
        $t->login($root, $password);

        #Enable us
        $t->print('ena');
        $t->waitfor('/Password/');
        $t->print($password);
        $t->waitfor($adminprompt);
        $t->prompt($adminprompt);

        #Switch context
        $t->cmd(String => "context $context");

        #Ask the question
        @lines = $t->cmd(String => "show subscribers active
$user\@$context");
        if ($lines[0] =~ /subscriber $user\@$context/ ) {
                return 1;
        }
        else {
                return 0;
        }
}




- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to