Executing an external program

Muhammad Usman muhd.usman87 at gmail.com
Wed Apr 16 14:33:49 CEST 2014


Hi,
I am using Freeradius version 2.2.4, I want to execute an external Java
program, whenever I receive an Accounting Stop packet, I have added the
below code in the "Accounting" section of  /etc/raddb/sites-enabled/default

accounting {
        #
        #  Create a 'detail'ed log of the packets.
        #  Note that accounting requests which are proxied
        #  are also logged in the detail file.
        detail
#       daily

        #  Update the wtmp file
        #
        #  If you don't use "radlast", you can delete this line.
        unix

        #
        #  For Simultaneous-Use tracking.
        #
        #  Due to packet losses in the network, the data here
        #  may be incorrect.  There is little we can do about it.
        radutmp
#       sradutmp

        #  Return an address to the IP Pool when we see a stop record.
#       main_pool

        #
        #  Log traffic to an SQL database.
        #
        #  See "Accounting queries" in sql.conf
        sql

        #
        #  If you receive stop packets with zero session length,
        #  they will NOT be logged in the database.  The SQL module
        #  will print a message (only in debugging mode), and will
        #  return "noop".
        #
        #  You can ignore these packets by uncommenting the following
        #  three lines.  Otherwise, the server will not respond to the
        #  accounting request, and the NAS will retransmit.
        #
#       if (noop) {
#               ok
#       }

        #
        #  Instead of sending the query to the SQL server,
        #  write it into a log file.
        #
#       sql_log

        #  Cisco VoIP specific bulk accounting
#       pgsql-voip

        # For Exec-Program and Exec-Program-Wait
        exec

        #  Filter attributes from the accounting response.
        attr_filter.accounting_response


        update reply {
                Tmp-String-0 = "%{exec:/usr/bin/java -jar
"/var/AccountingProcessor.jar" arg1 arg2 >> /home/user/capture.log}"
        }

        #
        #  See "Autz-Type Status-Server" for how this works.
        #
#       Acct-Type Status-Server {
#
#       }
}


where arg1 and arg2 will be the radius accounting stop packet attributes. i
will add the IF condition for checking stop packets later

Currently I am receiving error in logs, error is mentioned below

++[exec] returns noop
[attr_filter.accounting_response]       expand: %{User-Name} ->
muhd.usman at hotmail.com
attr_filter: Matched entry DEFAULT at line 12
++[attr_filter.accounting_response] returns updated
ERROR: Badly formatted variable: %{exec:/usr/bin/java -jar
++[reply] returns updated
Sending Accounting-Response of id 14 to 192.168.6.121 port 55006
Finished request 1.






Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140416/5fe944b6/attachment-0001.html>


More information about the Freeradius-Users mailing list