On Apr 24, 2018, at 9:48 AM, Jeremy Tribby <jeremy@tribby.com> wrote:
Hello,
I've recently been using the v4 branch of FreeRADIUS (compiled from Github source) to take advantage of PBKDF2 support. I have OpenVPN connections hitting RADIUS and I'm not sure that an event timestamp is being sent, so I'm getting the following error:
(1) sql - EXPAND INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start,connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress) VALUES ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{%{NAS-Port-ID}:-%{NAS-Port}}', '%{NAS-Port-Type}', FROM_UNIXTIME(%{integer:Event-Timestamp}), FROM_UNIXTIME(%{integer:Event-Timestamp}), NULL, '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}')
(1) sql - --> INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start,connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress) VALUES ('D3832A451A13ECAA9A3A2075A14A00A8', '7d5e5e76b4d65da7fedea40618fd435a', 'testuser', '', '127.0.0.1', '1', 'Virtual', FROM_UNIXTIME(), FROM_UNIXTIME(), NULL, '0', '', '', '', '0', '0', '', '73.92.174.103', '', 'Outbound-User', 'PPP', '10.8.0.2')
(1) sql - Executing query: INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress) VALUES ('D3832A451A13ECAA9A3A2075A14A00A8', '7d5e5e76b4d65da7fedea40618fd435a', 'testuser', '', '127.0.0.1', '1', 'Virtual', FROM_UNIXTIME(), FROM_UNIXTIME(), NULL, '0', '', '', '', '0', '0', '', '73.92.174.103', '', 'Outbound-User', 'PPP', '10.8.0.2')
(1) sql - ERROR: rlm_sql_mysql: ERROR 1582 (Incorrect parameter count in the call to native function 'FROM_UNIXTIME'): 42000
I saw an answer to a similar question a few years ago on the mailing list -- http://lists.freeradius.org/pipermail/freeradius-users/2015-September/079524...
But the `preprocess` plugin is not available for v4 as far as I can tell, and I'm not sure where I would put this bit of code referenced, if it's even still compatible with v4 (I've tried a few places):
if (!Event-Timestamp) { update request { Event-Timestamp := "%l" } }
That should still work, and you'd put that config snippet it at the top of recv Accounting-Request. We should probably add something to proto_radius to set that automatically, maybe with a toggle to disable it if people really don't want it. -Arran