Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jun 1997 02:12:16 -0400 (EDT)
From:      Nick Seraphin <nick@homer.eaglequest.com>
To:        "Tom T. Thai" <tomthai@future.net>
Cc:        freebsd-isp@FreeBSD.ORG, linuxisp@friendly.jeffnet.org
Subject:   Re: system passwd to RADIUS
Message-ID:  <Pine.LNX.3.95.970626020151.30452A-100000@homer.eaglequest.com>
In-Reply-To: <Pine.BSD.3.91.970626001250.4854A-100000@dream.future.net>

next in thread | previous in thread | raw e-mail | index | archive | help

No guarantees that it will work for you or that it won't screw up/crash
your system.  Use at your own risk.  (blah blah.. standard legal
disclaimers, etc).

May need some editing for your version of RADIUS.

It's attached below my .signature.

-- Nick

On Thu, 26 Jun 1997, Tom T. Thai wrote:

> Can I have your perl script.. would save me some time.
> 

------------------------------------------------------------------------------
Nick Seraphin					nick@eaglequest.com
President					http://www.eaglequest.com/
EagleQuest, Inc.				(810) 650-4700
Internet Access Services			Rochester, Michigan
------------------------------------------------------------------------------


#!/usr/bin/perl

# parse.pl
#
# script to parse unix passwd file and create radius users file
#
# Configuration
#
# You may need to change the names/syntax of the RADIUS fields below to
# match your dictionary file.
#
# This script creates a new file from scratch each time it is run.  It
# also ignores users with "suspended" passwords (users with *'s)
#
# Change these filenames to match your system.
#

$passwdfile = "/etc/passwd";
$outputfile = "/etc/raddb/users";

# End of Configuration
#

open(PASSWD,"$passwdfile") || die "Can't open $passwdfile!\n";
open(USERS,">$outputfile") || die "Can't open $outputfile!\n";

foreach $line (<PASSWD>)
{
	chop($line);
	@arr = split(":",$line);
	if ($arr[1] ne "*")
	{
		if (length($arr[0]) == 8)
		{
			print USERS "$arr[0]\tEncrypted-Password=\"$arr[1]\"\n";
		} else
		{
			print USERS "$arr[0]\t\tEncrypted-Password=\"$arr[1]\"\n";
		};
		print USERS "\t\tService-Type = Framed,\n";
		print USERS "\t\tFramed-Protocol = PPP,\n";
		print USERS "\t\tFramed-IP-Netmask = 255.255.255.255,\n";
		print USERS "\t\tFramed-Routing = None,\n";
		print USERS "\t\tFramed-Compression = Van-Jacobson-TCP-IP,\n";
		print USERS "\t\tFramed-MTU =1500\n";
		print USERS "\n";
	}
}

close(PASSWD);
close(USERS);





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.3.95.970626020151.30452A-100000>