embeddedcross-compilingopenwrtfreeradiuslinksys

Freeradius acct_unique module package not available on OpenWrt CC-15.05.1


I'm running Openwrt CHAOS CALMER (15.05.1, r48532) on my linksys WRT1900AC V1 (mamba - mvebu platform).

I have installed freeradius server version 2.2.8, i'm facing troubles with the acct unique session id which is all the time empty:

rlm_sql_mysql: MYSQL check_error: 1062 received
[sql] Couldn't insert SQL accounting STOP record - Duplicate entry '' for 
key 'acctuniqueid'
rlm_sql_mysql: MYSQL check_error: 1062 received
rlm_sql_mysql: Cannot store result
rlm_sql_mysql: MySQL error 'Duplicate entry '' for key 'acctuniqueid''
rlm_sql (sql): Released sql socket id: 9
++[sql] = fail
+} # group accounting = fail
Finished request 21.
Cleaning up request 21 ID 5 with timestamp +1271
Going to the next request
Ready to process requests.

Reading the freeradius mailing list it seems that the only solution is to use the "acct_unique" module which is not available for download using the opkg install tool from OpenWrt console. I beg any one who have this package (ipk already compiled for the mvebu platform) or he have the OpenWrt build system and he can cross compile this module to help me sort my issue by helping me to get this module for my platform.

Any other alternative solutions to sort out this problem using shell scripting call from the freeradius daemon are welcome.

Here is the list of packages available for freeradius :

root@OpenWrt:~# opkg find '*freeradius*' freeradius2 - 2.2.8-2 - A flexible RADIUS server (version 2) freeradius2-common - 2.2.8-2 - common files freeradius2-democerts - 2.2.8-2 - Demo certificates to test the server freeradius2-mod-always - 2.2.8-2 - Always module freeradius2-mod-attr-filter - 2.2.8-2 - ATTR filter module freeradius2-mod-attr-rewrite - 2.2.8-2 - ATTR rewrite module freeradius2-mod-chap - 2.2.8-2 - CHAP module freeradius2-mod-detail - 2.2.8-2 - Detailed accounting module freeradius2-mod-eap - 2.2.8-2 - Base EAP module freeradius2-mod-eap-gtc - 2.2.8-2 - EAP/GTC module freeradius2-mod-eap-md5 - 2.2.8-2 - EAP/MD5 module freeradius2-mod-eap-mschapv2 - 2.2.8-2 - EAP/MS-CHAPv2 module freeradius2-mod-eap-peap - 2.2.8-2 - EAP/PEAP module freeradius2-mod-eap-tls - 2.2.8-2 - EAP/TLS module freeradius2-mod-eap-ttls - 2.2.8-2 - EAP/TTLS module freeradius2-mod-exec - 2.2.8-2 - EXEC module freeradius2-mod-expiration - 2.2.8-2 - Expiration module freeradius2-mod-expr - 2.2.8-2 - EXPR module freeradius2-mod-files - 2.2.8-2 - Module using local files for authorization freeradius2-mod-ldap - 2.2.8-2 - LDAP module freeradius2-mod-logintime - 2.2.8-2 - Logintime module freeradius2-mod-mschap - 2.2.8-2 - MS-CHAP and MS-CHAPv2 module freeradius2-mod-pap - 2.2.8-2 - PAP module freeradius2-mod-passwd - 2.2.8-2 - Rlm passwd module freeradius2-mod-preprocess - 2.2.8-2 - Request pre-processing module freeradius2-mod-radutmp - 2.2.8-2 - Radius UTMP module freeradius2-mod-realm - 2.2.8-2 - Realms handling module freeradius2-mod-sql - 2.2.8-2 - Base SQL module freeradius2-mod-sql-mysql - 2.2.8-2 - MySQL module freeradius2-mod-sql-pgsql - 2.2.8-2 - PostgreSQL module freeradius2-mod-sql-sqlite - 2.2.8-2 - SQLite module freeradius2-mod-sqlcounter - 2.2.8-2 - Generic SQL Counter module freeradius2-mod-sqllog - 2.2.8-2 - SQL Logging module freeradius2-utils - 2.2.8-2 - Misc. client utilities

Kind regards


Solution

  • Edit raddb/policy.conf

    Add

    acct_unique {
        update request {
                Acct-Unique-Session-Id := "%{md5:%{User-Name},%{Acct-Session-ID},%{NAS-IP-Address},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}"
        }
    }
    

    You can then add a call to acct_unique in raddb/sites-available/default at the top of the preacct {} section, to generate the Acct-Unique-Session-ID attribute.