Authenticate Against MySQL with Perl

Name: check_mysql_perl
Purpose: Authenticating against MySQL with Perl
Author: Alejandro Grijalba (SuD)
Type: Script
Requirements: Perl
Download: check_mysql.pl.txt
# Mysql external auth script
# Features: auth and isUser work, but setPass doesn't.
# Restrictions: Username or passwords may not contain some special characters: $'"` nor line breaks

# Security considerations: 
#  - i am not sure whether password is shown in the "echo" sentence when listing processes, perhaps not if echo is a shell builtin
#  - character filtering may not be perfect, but the most important '$"` are filtered out by this script
#  - mysql user password should not be set on command-line, instead use --defaults-extra-file=... 
#      The file must contain [client] in the first line and password=... next (check some man page for more details)

# 2005-1-24 Modified by Alejandro Grijalba (SuD) http://www.latinsud.com
# Based on check_pass_null.pl script

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Addtional information

I recently tried to get it working with ejabbered 2.1.5 and have some comments that might help future users of this:

In the check_mysql.pl script :

my ($op,$user,$password) = split /:/,$buf;

should be changed to :

my ($op,$host, $user,$password) = split /:/,$buf;

else, password field may not have the correct value.

Its good to keep this script in /var/lib/ejabberd/ [ assuming standard install] - and the datbase password is supplied in a separate file ./datosSql in the format :

[client]
password="mypassword"

- make sure that complete path is specified to this file e.g /var/lib/ejabbered/datatoSql

Syndicate content