Though kannel already has some pam functionality included, it’s far from optimal imho.
As it is now, to use pam authentication you have to:
1. Configure with –enable-pam and compile.
2. Create an smsbox-user called “pam” with a dummy password.
3. Create a pam configuration file called “kannel” on /etc/pam.d/, with your pam settings.
4. Kannel will then use only pam for authentication, so you could use LDAP, Radius or whatever supported authentication modules you have configured on the box.
However:
* Other smsbox-user’s are disabled, only the “pam” user is allowed to authenticate.
* All users would get logged as “pam”, so you cannot make settings per users of any kind.
* Only one pam group is allowed.
After applying the patch, pam authentication gets managed with a special group sendsms-pam-user, which shares most of sendsms-user parameters, except for username and password, and adds the acl parameter instead.
group = sendsms-pam-user
acl = kannel
<other sendsms-user parameters>
* You can define as many groups as needed, pointing to different pam configuration files.
* The acl parameter points to the pam module on /etc/pam.d/ (”kannel” in this case, but could be anything you want).
* Pam authentication is only attempted after trying the regular sendsms-user way, so you can have local users and pam users at the same time (local taking precedence).
* Each sendsms-pam-user group will be logged separately, and you’ll also get info about the pam user making the call.
To use the patch:
1. Download the patch here and apply it.
2. Run ./bootstrap.sh
3. Run ./configure –enable-pam
4. make and make install as usual.
As usual, please try it and let me know what you think.
NOTE: This patch is already committed to CVS, so if you download the latest CVS version, you’ll get it included.
Here’s a new version of my former patch to add support for custom MO parameters on the “generic” http-smsc.
This new version adds a few extra features:
Support to set the response message (nowadays is fixed to “Sent.”).
Support to use escape codes on the response message. You can now show the internal message id (or any other message field for what matters) when responding to a successful request.
Support to set the response code for successful and failed requests.
With the addition of meta-data functionality in Kannel, now it’s possible to pass meta-data between different smsc’s and services.
When defining services or urls to send messages, the new %D parameter gets replaced with the complete meta-data information available.
However, there wasn’t any way to use only part of that data when posting to url’s. This is why I’ve created this patch that allows you to use individual meta-data fields in your urls.
USAGE
To use it, a new set of parameters is defined, with the following format:
%#group#parameter#
Where group is the meta-data group (for example: smpp, http or foo) and parameter is the individual meta-data parameter you want to replace.
For example, let’s suppose we’re using a generic http-smsc, and we want to pass a couple of extra parameters for a dynamic username and password (some aggregators do that). Right now, that would require patching the source code and inventing some method to pass the extra parameters from the sendsms interface.
With the patch applied, this would be as simple as this:
1. Pass the meta-data parameter on the sendsms request (urlencoded):
?http?user=Alex&pass=bar
2. Define the send-url parameter on your http-smsc to pass those parameters:
Note: I’m defining the http group here, but it could be anything, even the smpp group coming from an smpp bind, in which case the syntax would be #smpp#username# instead.
* rpm target (already on the latest snapshot). You can now run ./configure and then make rpm to build an RPM!
* Support for MS-SQL and Sybase over FreeTDS. You need a current Kannel snapshot to support this.
* Some code cleanups.
If you’re using an external DB for dlr storage, there’s a slight chance that the carrier’s response to your MT (with the dlr information) would arrive after the dlr itself. If this happens, Kannel won’t be able to find the dlr (because it’s not there yet).
This patch implements an sleep and retry mechanism when calling dlr_get(). This aims to solve that problem.
2 new core parameters are defined:
dlr-retry-count -> How many times do we attempt to fetch the dlr? Default: 1
dlr-retry-delay -> How many milliseconds do we sleep before retrying? Default: 0
So, if you don’t set these parameters the behaviour remains as it was before patching. However, if you, for instance, set:
dlr-retry-count = 3
dlr-retry-delay = 200
Kannel will try 3 times in total (the original plus 2 more), pausing 200ms (0.2 seconds) before each attempt. If after the third attempt the DLR’s still missing, Kannel will display a warning as usual.
NOTE: This patch was superseded by another one I’ve wrote that adds smsc-admin-id instead. The smsc-admin-id patch was already commited to CVS so the use of the smsc-dlr-alias is now officially deprecated.
A problem you may have faced with dlrs on Kannel: If you’re using dlrs and have more than one bind to a given carrier, you need to name them all the same. Otherwise, if the dlr come back over a different bind than the one you’ve used to send the MT message in the first place, Kannel won’t be able to match them, since they won’t share the same “smsc” field.
This is usually OK. However, you lose the ability to control the binds independently: you cannot shutdown a single bind, for example. The problem worsens yet more if your binds are to different data centers (some carriers have redundant SMSC’s on geographycally distant places).
That’s why I’ve created this patch that adds a new configuration option to SMSC groups:
smsc-dlr-alias
Using this parameter, you can define an alias to use when storing dlrs, so they will match despite being sent/received over different binds.
For example:
…
#carrier link 1
group = smsc
smsc = smpp
smsc-id = “link1″
smsc-dlr-alias = “myalias”
allowed-smsc-id = “link1;mylink”
host = “1.1.1.1″
…
#carrier link 2
group = smsc
smsc = smpp
smsc-id = “link2″
smsc-dlr-alias = “myalias”
allowed-smsc-id = “link2;mylink”
host = “1.1.1.1″
…
Using this configuration, you just have to use the “&smsc=mylink” parameter on your send-sms url. The dlr will be stored using the alias “myalias” no matter which of these 2 routes the message takes. When getting the response back, again, it will be matched against “myalias”.
Yesterday I’ve published a patch that added Kannel’s DBPool support for MS-SQL and Sybase via the FreeTDS library.
Today’s patch uses that functionality to implement the DLR storage on MS-SQL and Sybase DB Engines.
To use this, you need to:
1. Patch Kannel to support FreeTDS (see yesterday’s link).
2. Patch Kannel using this patch, to add support for DLR’s over FreeTDS.
3. ./configure –with-mssql=[optional path] [--other-switches]
4. make
5. sudo make install 6. Configure dlr-storage = mssql 7. Configure the DB connection (see yesterday’s article for details).
8. Configure the dlr-db group (see the userguide for details).
A simple example:
group = core
…
dlr-storage = mssql
…
group = mssql-connection
id = msdlr
username = myuser
password = mypass
server = mssql
database = mydb
#DLR Configuration
group = dlr-db
id = msdlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
UPDATE: This patch has been officially accepted into the main tree. Just download the latest CVS and you’re all set.
The following article is now old news:
I’ve been working integrating Kannel with FreeTDS, an open source project that provides a free, open source driver for the tabular data system protocol used on MS-SQL and Sybase DB Engines.
The result is a DBPool module that makes Kannel capable of talking with MS-SQL and Sybase DB’s.
To use this module you need to have FreeTDS installed on your kannel box (either by compiling the source code or installing binary packages). If you’re installing from packages, do not forget to install the development packages as well (otherwise you won’t be able to compile Kannel).
Once you’ve installed FreeTDS, configure the freetds.conf and make sure that everything works properly. Hint: use the tsql command line utility and try connecting to your DB server).
To compile this into Kannel, you need to download and apply this patch. Since it touches the configure template, you need to bootstrap the code afterwards. In short:
1. Download the patch kannel-dbpool-mssql to Kannel’s source root directory
2. Apply the patch: patch -p0 < kannel-dbpool-mssql.patch
3. ./bootstrap.sh (only the first time after applying the patch)
4. ./configure –with-mssql=[optional path] [--other-switches]
5. make
6. sudo make install
Now, to configure the DB-Link, you need to add a dbpool group to kannel’s configuration files. It should look similar to this:
group = mssql-connection
id = mssql-db
username = myuser
password = mypass
server = server_name
database =my_db_name
Note: server_name should match the [server_name] group for the DB link on your freetds.conf file.
Right now, this patch only adds the functionality to make Kannel FreeTDS-capable. I’m adding support for DLR’s and SqlBox soon, so stay tuned!
My kid Juan (13) did this video along with 3 friends as part of a schoolwork assignment. He wrote the script, did the greenscreen and also did the editing. Watch it, it’s lots of fun!
I don’t have to say how proud of my kids I am. They make life worth it.