"Arthur Emerson III" <[email protected]> wrote:
>
>You may have to script something with:
>
>/usr/local/pf/bin/pfcmd person add [pid]
>
>to populate the person table from the PID column of
>your CSV file as the first step, and then script the
>node addition with a second call to pfcmd to create
>the node.  It really isn't more than a few lines of
>BASH shell script to do this from the command line,
>if somebody else doesn't have a cleaner solution...

I just looked at the web interface's bulk import
screen this morning, and saw that the file format
it accepts is only a list of MAC addresses, not a
CSV file. :-(

Assuming that you only want to run this as a one-time
import, the script below will do the job albeit slowly.

Format the input file as below, and stick it in
/tmp/file.csv:

01:11:22:33:44:55,user1,
01:23:45:67:89:01,user2,


(If you can create the file as a Unix/Linux text file
with LF line terminators instead of CR/LF, you can omit
the ending comma.)

With the CSV file in place, type this at a root shell
prompt:

cat /tmp/file.csv | while read line
do
  mac=`echo $line | cut -f1 -d,`
  pid=`echo $line | cut -f2 -d,`
  /usr/local/pf/bin/pfcmd person add $pid
  /usr/local/pf/bin/pfcmd node add $mac status=\"reg\",pid=$pid
  echo "Registered $mac to user $pid..."
done

It added about one MAC address per second when I just
ran it on our live PF server.  If you just want to do
an initial one-time import and nobody has a better
solution, this will work as a last resort...

-Arthur

-------------------------------------------------------------------------
Arthur Emerson III                 Email:      [email protected]
Network Administrator              InterNIC:   AE81
Mount Saint Mary College           MaBell:     (845) 561-0800 Ext. 3109
330 Powell Ave.                    Fax:        (845) 562-6762
Newburgh, NY  12550                SneakerNet: Aquinas Hall Room 11


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to