Skip to content

Updated libpam-sqlite to support SQLite3 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*~
*.o
*.so
*.swp
config.guess
config.sub
25 changes: 14 additions & 11 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# $Id: Makefile.in,v 1.5 2003/06/22 22:59:45 ek Exp $
LIBSRC= pam_sqlite.c
LIBOBJ= pam_sqlite.o pam_get_pass.o pam_std_option.o pam_get_service.o
LIBLIB= pam_sqlite.so
LIBSRC= pam_sqlite.c pam_sqlite3.c
LIBOBJ= pam_sqlite.o pam_get_pass.o pam_std_option.o pam_get_service.o
LIBOBJ3= pam_sqlite3.o pam_get_pass.o pam_std_option.o pam_get_service.o

DISTDIR= pam_sqlite-0.1
ROOTDIR=

LINK= @SQLITE_LIB@
LDLIBS= ${LINK} @LIBS@
LDLIBS= @SQLITE_LIBS@ @LIBS@
LDLIBS3= @SQLITE3_LIBS@ @LIBS@
INCLUDE= @SQLITE_INC@
CFLAGS= @CFLAGS@ -fPIC -DPIC -Wall -D_GNU_SOURCE ${INCLUDE}


all: ${LIBLIB}
all: pam_sqlite.so pam_sqlite3.so

DISTDIRS= debian
DISTFILES= acconfig.h README pam_get_pass.c pam_get_service.c pam_mod_misc.h \
pam_sqlite.c pam_std_option.c test.c debian/changelog debian/control \
debian/copyright debian/dirs debian/rules Makefile.in configure.in \
config.h.in install-sh config.sub config.guess install-module configure \
CREDITS
pam_sqlite.c pam_sqlite3.c pam_std_option.c test.c debian/changelog \
debian/control debian/copyright debian/dirs debian/rules Makefile.in \
configure.in config.h.in install-sh config.sub config.guess install-module \
configure CREDITS

distfiles: ${DISTFILES}

Expand All @@ -36,9 +36,12 @@ ${DISTDIR}.tar.gz: distfiles

dist: ${DISTDIR}.tar.gz

${LIBLIB}: ${LIBOBJ}
pam_sqlite.so: ${LIBOBJ}
${CC} ${CFLAGS} ${INCLUDE} -shared -o $@ ${LIBOBJ} ${LDLIBS}

pam_sqlite3.so: ${LIBOBJ3}
${CC} ${CFLAGS} ${INCLUDE} -shared -o $@ ${LIBOBJ3} ${LDLIBS3}

test: test.c
${CC} ${CFLAGS} -o $@ test.c ${LDLIBS}

Expand Down
113 changes: 0 additions & 113 deletions README

This file was deleted.

1 change: 1 addition & 0 deletions README
113 changes: 113 additions & 0 deletions README_pam_sqlite
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
pam_sqlite 0.3
=============

Introduction
============

This module provides support to authenticate against SQLite
tables for PAM-enabled appliations.

This module is based on pam_pgsql module.

Compilation & Installation
==========================

pam_sqlite is now autoconf'ed, thus, compiling should be a matter
of:

$ ./configure
$ make
$ make install

Compilation has been tested on RedHat Linux 7.3.

You will need to have SQLite library and header files
for this module to compile.

See test.c for an example application that authenticates using
this module.

Configuration
=============

For the service you wish the module to be used, you need
to edit the /etc/pam.d/<service> file or /etc/pam.conf, and
add the relevant lines.

For example:

auth required pam_sqlite.so
account required pam_sqlite.so
password required pam_sqlite.so

Configure the database, and table the module should use with
the configuration file /etc/pam_sqlite.conf. An example of
this file:

database = /etc/sysdb
table = account
user_column = user_name
pwd_column = user_password
expired_column = acc_expired
newtok_column = acc_new_pwreq
debug

expired_column tells PAM if the user account has expired. Set it to '1'
or 'y' if it has.

newtok_column tells PAM if the user needs a new password. Set it to '1'
or 'y' if it does.

Note that for backwards compatibility with earlier versions, options specified
in the configuration file can be supplied as module arguments as well. Module
arguments will override the configuration file.

Configuration Options
=====================

database - the database which should be connected to
table - the name of the table to query
user_column - the column containing usernames
pwd_column - the column containing the passwords
expired_column - this column should contain '1' or 'y' if the account
has expired
newtok_column - this column should contain '1' or 'y' if the user
needs to change their password
debug - this is a standard module option that will enable
debug output to syslog (takes no values)
pw_type - specifies the password encryption scheme, can be one
of 'clear', 'md5', or 'crypt'. defaults to 'clear'.
config_file - specifies the path to a file to read for further
configuration options
sql_verify - specifies SQL template to use when verifying the
the password for a user
sql_check_expired - SQL template to use when checking for account expiry.
sql_check_newtok - SQL template to use when checking to see if the user
needs to change their password.
sql_set_passwd - SQL template to use when updating the password for
and user.


SQL Templates
=============

SQL templates are printf-inspired format strings. The following escape
sequences are understood:

%% - literal % character

%U - The username (provided by PAM). It will be quoted for use
in the SQL.
%P - The password, either entered by the user or the new password
to use when changing it. It will be quoted for use in SQL.

%O<char> - an option from the configuration; the following options are
supported:

%Op - value of pwd_column
%Ou - value of user_column
%Ot - value of table
%Ox - value of expired_column
%On - value of newtok_column

vim:et:
83 changes: 83 additions & 0 deletions README_pam_sqlite3
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
PAM module for SQLite3
======================


Introduction
============

This is an enhancement done on the original project in order to
provide PAM support for SQLite3.
- https://github.com/Sectoid/libpam-sqlite
- git@github.com:Sectoid/libpam-sqlite.git


Download
========

$ git clone git@github.com:sangeeths/libpam-sqlite.git


Compilation & Installation
==========================

NOTE: If you come across issues on libtool, then add the
following softlinks from the libpam-sqlite directory.
In my machine I had the following softlinks.

config.guess -> /usr/share/libtool/config/config.guess
config.sub -> /usr/share/libtool/config/config.sub

$ ./configure
$ make
$ make install

Compilation has been tested on
-> Fedora Core 18 running 3.6.10-4 on x86_64

You will need to have SQLite and SQLite3 library and header
files for this module to compile.


Configuration
=============

For the service you wish the module to be used, you need
to edit the /etc/pam.d/<service> file or /etc/pam.conf, and
add the relevant lines.

For example:

auth required /lib/security/pam_sqlite3.so
account required /lib/security/pam_sqlite3.so
password required /lib/security/pam_sqlite3.so

Configure the database, and table the module should use with
the configuration file /etc/pam_sqlite.conf. An example of
this file:

database = /etc/sysdb
table = account
user_column = user_name
pwd_column = user_password
expired_column = acc_expired
newtok_column = acc_new_pwreq
debug

/etc/sysdb should be a SQLite3 database file.

expired_column tells PAM if the user account has expired. Set it to '1'
or 'y' if it has.

newtok_column tells PAM if the user needs a new password. Set it to '1'
or 'y' if it does.


References
==========
Please go through the README of the original project for
detailed explanation on various configurable options,
format specifiers, etc.
- https://github.com/Sectoid/libpam-sqlite/blob/master/README


__END__
Loading