Authenticate Against PostgreSQL with Perl

Name: check_postgresql_perl
Purpose: Authenticating against PostgreSQL with Perl
Author: Adam Thorsen
Type: Script
Requirements: Perl
Download: check_postgresql.pl.txt
# Postgresql external auth script
# Features: auth works. isUser should 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
#  - psql user password must be set in ~/.pgpass which is of the format:  
# localhost:port:database:user:password
#  
# CHANGELOG:
#
# 2005-12-27 Modified by Adam Thorsen http://www.guruza.com/oss
# Based on Alejandro Grijalba's ejabberd_mysql_auth.pl script 
# which can be found here: http://www.latinsud.com/ejabberd_mysql_auth.pl 
#
# 2007-11-21 Modified by Badlop and Sps_black to make compatible with recent ejabberd SVN. 

Comment viewing options

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

Updated to work with newer ejabberd version

When using the original version of this script with ejabberd SVN of November 2007, authentication worked correctly but subscription requests were not delivered to the destination. This problem was not present with ejabberd 1.1.x.

The solution was to replace:

$fieldUser='$user'

which appeared two times in the script, with this new code:

$fieldUser='$jid'

This problem was reported by Sps_black in the ejabberd chatroom, and took us several days to debug. I've updated the script available for download with his solution.

Syndicate content