Cassandra backends for Freeradius
Hey there, I just started a project where I need to configure cassandra backends for freeradius. As i'm a newbie to both cassandra and freeradius I don't know much how to proceed. I found on github this repository <https://gist.github.com/linnaea/ef2457ae6fc6db7c2e04#file-rlm_sql_cassandra-c> which contains the schema for cassandra db, the sql conf and rlm_sql_cassandra module. Unfortunately, there is no documentation included so newbies like me would know what to do. As this mailing list is for developers I was hoping I could find someone here who could offer me some guidance, documentation or anything that might help me in my internship project. In advance, thank you for your help. B.regards, Sara
On Jun 9, 2015, at 3:40 AM, ICHIBA Sara <ichi.sara@gmail.com> wrote:
Hey there,
I just started a project where I need to configure cassandra backends for freeradius. As i'm a newbie to both cassandra and freeradius I don't know much how to proceed. I found on github this repository <https://gist.github.com/linnaea/ef2457ae6fc6db7c2e04#file-rlm_sql_cassandra-c> which contains the schema for cassandra db, the sql conf and rlm_sql_cassandra module. Unfortunately, there is no documentation included so newbies like me would know what to do. As this mailing list is for developers I was hoping I could find someone here who could offer me some guidance, documentation or anything that might help me in my internship project.
I pinged the author a message on GitHub, we'll see if we can pull it in (he needs to add a GPLv2 license header to the code). The code's not bad. Just needs some formatting changes. He actually did a pretty good job of using the internal APIs, so not a huge amount of work. Once it's in, you just use it like any other SQL driver. I have a feeling though, we'll need to fix C++ compilation for the entire server before everything works as expected, as everything will need to be compiled as C++. I looked at this a few years ago, but never found any really good references on linking to C++ libraries from C, or how it works. C++ has a runtime, C doesn't. Alan says you may just be able to use a C++ compiler to build the C code *shrug*. -Arran
From memory you can get away with compiling the 'main' as C++ and use C++ for the final linking phase.. That assumes you ensure the bits that link to "C" compiled code have the extern "C" stuff in the right place to ensure you don't get any C++ name mangling issues.
On Tue, Jun 9, 2015 at 5:50 PM, Arran Cudbard-Bell < a.cudbardb@freeradius.org> wrote:
On Jun 9, 2015, at 3:40 AM, ICHIBA Sara <ichi.sara@gmail.com> wrote:
Hey there,
I just started a project where I need to configure cassandra backends for freeradius. As i'm a newbie to both cassandra and freeradius I don't know much how to proceed. I found on github this repository < https://gist.github.com/linnaea/ef2457ae6fc6db7c2e04#file-rlm_sql_cassandra-...
which contains the schema for cassandra db, the sql conf and rlm_sql_cassandra module. Unfortunately, there is no documentation included so newbies like me would know what to do. As this mailing list is for developers I was hoping I could find someone here who could offer me some guidance, documentation or anything that might help me in my internship project.
I pinged the author a message on GitHub, we'll see if we can pull it in (he needs to add a GPLv2 license header to the code).
The code's not bad. Just needs some formatting changes. He actually did a pretty good job of using the internal APIs, so not a huge amount of work.
Once it's in, you just use it like any other SQL driver. I have a feeling though, we'll need to fix C++ compilation for the entire server before everything works as expected, as everything will need to be compiled as C++.
I looked at this a few years ago, but never found any really good references on linking to C++ libraries from C, or how it works. C++ has a runtime, C doesn't.
Alan says you may just be able to use a C++ compiler to build the C code *shrug*.
-Arran
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
On Jul 2, 2015, at 4:20 PM, Alister Winfield <alister@ticklers.org> wrote:
From memory you can get away with compiling the 'main' as C++ and use C++ for the final linking phase.. That assumes you ensure the bits that link to "C" compiled code have the extern "C" stuff in the right place to ensure you don't get any C++ name mangling issues.
It seems fairly happy linking directly to the cassandra client library. No odd crashes, memory leaks or SEGVs so far... It's actually a little confusing :) It's in the v3.1.x branch if you felt like doing some light detective work. -Arran
On Jul 13, 2015, at 10:24 AM, Arran Cudbard-Bell <a.cudbardb@freeradius.org> wrote:
On Jul 2, 2015, at 4:20 PM, Alister Winfield <alister@ticklers.org> wrote:
From memory you can get away with compiling the 'main' as C++ and use C++ for the final linking phase.. That assumes you ensure the bits that link to "C" compiled code have the extern "C" stuff in the right place to ensure you don't get any C++ name mangling issues.
It seems fairly happy linking directly to the cassandra client library.
No odd crashes, memory leaks or SEGVs so far... It's actually a little confusing :)
It's in the v3.1.x branch if you felt like doing some light detective work.
https://isocpp.org/wiki/faq/mixing-c-and-cpp If you want to call overloaded functions from C, you must provide wrappers with distinct names for the C code to use. For example: • // C++ code: • void f(int); • void f(double); • extern "C" void f_i(int i) { f(i); } • extern "C" void f_d(double d) { f(d); } Maybe that's what's provided by the cassandra headers, they do advertise it as a C/C++ library. -Arran
Updates: I got some answers from the developer on how to build cassandra backends for freeradius using the gist here <https://gist.github.com/linnaea/ef2457ae6fc6db7c2e04>. But still, I have some questions I hope you could answer. Here is his reply and inline my questions: I do understand that this mailing list is for developers with a certain level of knowledge on linux (building, compiling...) and on freeradius develpt which I don't have actually as I'm still newbie to all this (I haven't graduated yet). So please excuse my questions if they seem to you too basic and/or irrelevant. =============================================== The last revision of the source code on GitHub targets FreeRADIUS 3.0.8, it won't compile or load with earlier versions due to API changes in the FreeRADIUS server. *==> I installed the freeradius 3.0.8* To compile, make sure you have the Datastax Cassandra cpp-driver[https://github.com/datastax/cpp-driver] properly installed, then clone the gist into src/modules/rlm_sql/drivers/ rlm_sql_cassandra directory of the FreeRADIUS source tree. ===>* I installed the cpp cassandra driver as well. and cloned the gist into the rlm_sql_cassandra directory which i created myself as it didn't exist.* * q1)* *since there is this all.mk <http://all.mk> file, i think i should build it. But i can't since there is no configure script provided as it's the case for the other directories ( for instance in the directory: rlm_sql_mysql: there are these files all.mk <http://all.mk> all.mk.in <http://all.mk.in> config.h config.h.in <http://config.h.in> config.log config.status configure configure.ac <http://configure.ac> rlm_sql_mysql.c)* *q2)* *what am i supposed to do with the sql.conf file provided in the gist in github??* The structure should look like this: freeradius-server-3.0.8 \-src \-modules \-rlm_sql \-drivers \-rlm_sql_cassandra |-all.mk \-rlm_sql_cassandra.c Then compile and install the server (or just copy the module out if you already have FreeRADIUS installed). The CQL script for creating the necessary tables are included, and should work with the included config file. To use it, list cassauth in the authorize section, cassauth/cassacctsupplement/cassacct in the accounting section, cassauth in the session section, and cassauth in the post-auth section of your site config. 2015-06-09 9:40 GMT+02:00 ICHIBA Sara <ichi.sara@gmail.com>:
Hey there,
I just started a project where I need to configure cassandra backends for freeradius. As i'm a newbie to both cassandra and freeradius I don't know much how to proceed. I found on github this repository <https://gist.github.com/linnaea/ef2457ae6fc6db7c2e04#file-rlm_sql_cassandra-c> which contains the schema for cassandra db, the sql conf and rlm_sql_cassandra module. Unfortunately, there is no documentation included so newbies like me would know what to do. As this mailing list is for developers I was hoping I could find someone here who could offer me some guidance, documentation or anything that might help me in my internship project.
In advance, thank you for your help. B.regards, Sara
participants (3)
-
Alister Winfield -
Arran Cudbard-Bell -
ICHIBA Sara