Converting clients to clients.conf
Hi, Is there any easy way to convert a freeradius clients file to a clients.conf file? I have several dozen entries in my clients file and if I have to convert this by hand it's going to be a lot of typing... Lisa Casey
Lisa Casey wrote:
Hi,
Is there any easy way to convert a freeradius clients file to a clients.conf file? I have several dozen entries in my clients file and if I have to convert this by hand it's going to be a lot of typing...
Lisa Casey
Attached are a couple of ugly Perl scripts I used when we migrated from Cistron to FreeRADIUS a couple of years ago. I don't know if they'll work with FreeRADIUS client files. Regards, Richard Siddall #!/usr/bin/perl -w # clients.migrate - migrate Cistron-style clients file to FreeRADIUS-style clients.conf sub write_realm { my ($realm, $type, $options) = @_; print "realm $realm {\n\ttype\t= radius\n\tauthhost\t= $type\n\taccthost\t= $type\n}\n\n" } while (<ARGV>) { if (/^\s*([\w\.]+)\s+(\w+)\s+(\w+)\s*$/) { write_realm($1, $2, $3); } } #!/usr/bin/perl -w # clients.migrate - migrate Cistron-style clients file to FreeRADIUS-style clients.conf sub write_client { my ($client, $secret) = @_; print "client $client {\n\tsecret = $secret\n\tshortname = $client\n}\n\n" } while (<ARGV>) { if (/^\s*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+(\w+)\s*$/) { write_client($1, $2); } elsif (/^\s*(\w+)\s+(\w+)\s*$/) { write_client($1, $2); } }
participants (2)
-
Lisa Casey -
Richard Siddall