diff options
author | Menno E. Duursma <druiloor@zonnet.nl> | 2010-05-11 14:56:23 +0200 |
---|---|---|
committer | Michiel van Wessem <michiel@slackbuilds.org> | 2010-05-11 14:56:23 +0200 |
commit | fa5d40c6c9310fcc68552d49057e8c00b483c818 (patch) | |
tree | 085ac88cb536699e2e1e4abb0a1a4fa66c92049f | |
parent | 692b814b6acff1ddb46058a8846e3724f579ce9e (diff) | |
download | slackbuilds-fa5d40c6c9310fcc68552d49057e8c00b483c818.tar.gz |
libraries/nss-mysql: Initial import
-rw-r--r-- | libraries/nss-mysql/README | 41 | ||||
-rw-r--r-- | libraries/nss-mysql/doinst.sh | 19 | ||||
-rw-r--r-- | libraries/nss-mysql/nss-mysql-1.0-config.patch | 137 | ||||
-rw-r--r-- | libraries/nss-mysql/nss-mysql.SlackBuild | 72 | ||||
-rw-r--r-- | libraries/nss-mysql/nss-mysql.info | 8 | ||||
-rw-r--r-- | libraries/nss-mysql/nsswitch.conf | 39 | ||||
-rw-r--r-- | libraries/nss-mysql/slack-desc | 8 |
7 files changed, 324 insertions, 0 deletions
diff --git a/libraries/nss-mysql/README b/libraries/nss-mysql/README new file mode 100644 index 0000000000..9f48ffb1d5 --- /dev/null +++ b/libraries/nss-mysql/README @@ -0,0 +1,41 @@ +The NSS-MySQL name service switch library + +libnss_mysql retrieves user account information from a MySQL database server. +Per default stored in /etc/{group,passwd,shadow} on Unix-like systems. Which +(partly) is similar in functionality to NIS, LDAP, RADIUS, Hesoid, winbindd + +When used over a remote-network uttermost care should be taken in the security +of this (such as TLS/SSL encripting the connection) and even then storing any +valid password for such 'virtual' users is probably a bad idee in itself. + +Kerberos provides for far superior single-sign-on autentication system (the +'shadow' part in these kinds of systems) both in performance and security. + +On to the good stuff :-) +To get this working (locally) login to the database server, presuming that +it is running; otherwise read /etc/rc.d/rc.mysqld first; to make the DB: + +# mysql -uroot -p +> CREATE DATABASE nss_mysql; + +After this is done it has to be populated with the user tables; there is +an example for them is provided in /usr/doc/nss-mysql-<version>/sample.sql + +You can copy that to say /tmp , (probably) edit it some and insert it with: + +# mysql -uroot -p -D nss_mysql < /tmp/sample.sql + +After this is done create the 'nss' and 'nss-shadow' database users with +statements such as the ones found in /usr/doc/nss-mysql-<version>/SHADOW +And make sure the passwords for them in /etc/nss-{mysql,mysql-root}.conf +are the same ... + +Now edit your /etc/nsswitch.conf to look like the -mysql and try the commands + +getent passwd +getent shadow + +Which should list the users pulled from mysql! +( Otherwise have a look at 'tail /var/log/syslog' - for hints to fix it). + +-Menno. diff --git a/libraries/nss-mysql/doinst.sh b/libraries/nss-mysql/doinst.sh new file mode 100644 index 0000000000..52667d67ec --- /dev/null +++ b/libraries/nss-mysql/doinst.sh @@ -0,0 +1,19 @@ +config() +{ + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Try not to mess over any costum settings +config etc/nss-mysql-root.conf.new +config etc/nss-mysql.conf.new +config etc/nsswitch.conf-mysql.new + diff --git a/libraries/nss-mysql/nss-mysql-1.0-config.patch b/libraries/nss-mysql/nss-mysql-1.0-config.patch new file mode 100644 index 0000000000..14c550a382 --- /dev/null +++ b/libraries/nss-mysql/nss-mysql-1.0-config.patch @@ -0,0 +1,137 @@ +diff -ur nss-mysql-1.0.std/SHADOW nss-mysql-1.0/SHADOW +--- nss-mysql-1.0.std/SHADOW 2005-01-26 04:42:13.000000000 +0100 ++++ nss-mysql-1.0/SHADOW 2007-05-18 16:04:32.000000000 +0200 +@@ -45,7 +45,7 @@ + ## shadow extentions in your database, you must add these columns to the + ## following SQL request. + +-> GRANT select(user_name,password,user_id,status,name) on nss_mysql.user to ++> GRANT select(user_name,password,user_id,status) on nss_mysql.user to + 'nss-shadow'@localhost identified by 'another_password'; + + > FLUSH PRIVILEGES; +diff -ur nss-mysql-1.0.std/nss-mysql-root.conf nss-mysql-1.0/nss-mysql-root.conf +--- nss-mysql-1.0.std/nss-mysql-root.conf 2002-08-28 18:47:53.000000000 +0200 ++++ nss-mysql-1.0/nss-mysql-root.conf 2007-05-18 16:07:32.000000000 +0200 +@@ -46,7 +46,8 @@ + # 2) inet:host (port will be 3306) + # 3) host:port (inet socket will be used) + # 4) host (inet socket on port 3306 will be used) +-shadow.host = inet:localhost:3306; ++#shadow.host = inet:localhost:3306; ++shadow.host = unix:/var/run/mysql/mysql.sock; + + # database: database name + # This database MUST contain all the columns mentionned in this file +@@ -63,7 +64,7 @@ + # backup host + # A backup MySQL server + # Can be empty +-shadow.backup_host = inet:backup:3306; ++#shadow.backup_host = inet:backup:3306; + + # The following parameters are just like + # the main server. They can be empty. +@@ -71,7 +72,7 @@ + # the corresponding value for the main + # server will be use + +-shadow.backup_database = nss_mysql_backup; ++#shadow.backup_database = nss_mysql_backup; + # shadow.backup_db_user = nss; + # shadow.backup_db_password = mAip2sFxXJcw; + +@@ -103,39 +104,45 @@ + # if you do not have such a column, you can use something like + # shadow.lastchange_column = UNIX_TIMESTAMP()-10; + # The field name must be fully qualified, i.e. written as table.field +-shadow.lastchange_column = user.lastchange; ++#shadow.lastchange_column = user.lastchange; ++shadow.lastchange_column = UNIX_TIMESTAMP()-10; + + # min_column + # Minimum number of days to warn user to change the password + # if you do not have such a column, you can use something like + # shadow.min_column = 1; + # The field name must be fully qualified, i.e. written as table.field +-shadow.min_column = user.min; ++#shadow.min_column = user.min; ++shadow.min_column = 1; + + # max_column + # Maximum number of days to warn user to change the password + # if you do not have such a column, you can use something like + # shadow.max_column = 2; + # The field name must be fully qualified, i.e. written as table.field +-shadow.max_column = user.max; ++#shadow.max_column = user.max; ++shadow.max_column = 2; + + # warn_column + # Number of days to warn user to change the password + # if you do not have such a column, you can use something like + # shadow.warn_column = 7; + # The field name must be fully qualified, i.e. written as table.field +-shadow.warn_column = user.warn; ++#shadow.warn_column = user.warn; ++shadow.warn_column = 7; + + # inact_column + # Number of days the account may be inactive + # if you do not have such a column, you can use something like + # shadow.inact_column = -1; # disabled + # The field name must be fully qualified, i.e. written as table.field +-shadow.inact_column = user.inact; ++#shadow.inact_column = user.inact; ++shadow.inact_column = -1; + + # expire_column + # Number of days since 1970-01-01 until account expired + # if you do not have such a column, you can use something like + # shadow.expire_column = -1; # disabled + # The field name must be fully qualified, i.e. written as table.field +-shadow.expire_column = user.expire; ++#shadow.expire_column = user.expire; ++shadow.expire_column = -1; +diff -ur nss-mysql-1.0.std/nss-mysql.conf nss-mysql-1.0/nss-mysql.conf +--- nss-mysql-1.0.std/nss-mysql.conf 2002-08-28 18:47:53.000000000 +0200 ++++ nss-mysql-1.0/nss-mysql.conf 2007-05-18 16:08:12.000000000 +0200 +@@ -46,7 +46,8 @@ + # 2) inet:host (port will be 3306) + # 3) host:port (inet socket will be used) + # 4) host (inet socket on port 3306 will be used) +-users.host = inet:localhost:3306; ++#users.host = inet:localhost:3306; ++users.host = unix:/var/run/mysql/mysql.sock; + + # database: database name + # This database MUST contain all the columns mentionned in this file +@@ -63,7 +64,7 @@ + # backup host + # A backup MySQL server + # Can be empty +-users.backup_host = inet:backup:3306; ++#users.backup_host = inet:backup:3306; + + # The following parameters work just like + # the main server's. They can be empty. +@@ -71,7 +72,7 @@ + # the corresponding value for the main + # server will be used + +-users.backup_database = nss_mysql_backup; ++#users.backup_database = nss_mysql_backup; + # users.backup_db_user = nss; + # users.backup_db_password = mAip2sFxXJcw; + +diff -ur nss-mysql-1.0.std/sample.sql nss-mysql-1.0/sample.sql +--- nss-mysql-1.0.std/sample.sql 2005-01-26 04:39:06.000000000 +0100 ++++ nss-mysql-1.0/sample.sql 2007-05-18 16:04:11.000000000 +0200 +@@ -1,6 +1,6 @@ + # MySQL dump 8.9 + # +-# Host: localhost Database: nss-mysql ++# Host: localhost Database: nss_mysql + # + + # diff --git a/libraries/nss-mysql/nss-mysql.SlackBuild b/libraries/nss-mysql/nss-mysql.SlackBuild new file mode 100644 index 0000000000..8a3923fd37 --- /dev/null +++ b/libraries/nss-mysql/nss-mysql.SlackBuild @@ -0,0 +1,72 @@ +#!/bin/sh + +# Slackware build script for NSS-MySQL +# Written by Menno E. Duursma <druiloor@zonnet.nl> + +# Modified by the SlackBuilds.org project +set -e + +PRGNAM=nss-mysql +VERSION=1.0 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar -xzvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +# Apply patch to the documentation/examples +cat $CWD/nss-mysql-1.0-config.patch | patch -p1 --verbose + +# This thing installs in /lib as users might still have to be able and +# login even in the event of /usr unavailability +CFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/ \ + --sysconfdir=/etc + +make +make install-strip DESTDIR=$PKG + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a [A-Z][A-Z]* ChangeLog *.sql $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo + +# Move configfiles to .new and let doinst.sh hanle them gracefully +( cd $PKG/etc + mv nss-mysql-root.conf nss-mysql-root.conf.new + mv nss-mysql.conf nss-mysql.conf.new +) + +# Copy the sample glibc config into place also +cat $CWD/nsswitch.conf > $PKG/etc/nsswitch.conf-mysql.new + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz + +# Clean up the temp stuff +if [ "$1" = "--cleanup" ]; then + rm -rf $PKG + rm -rf $TMP/$PRGNAM-$VERSION +fi diff --git a/libraries/nss-mysql/nss-mysql.info b/libraries/nss-mysql/nss-mysql.info new file mode 100644 index 0000000000..a89f32e5e3 --- /dev/null +++ b/libraries/nss-mysql/nss-mysql.info @@ -0,0 +1,8 @@ +PRGNAM="nss-mysql" +VERSION="1.0" +HOMEPAGE="http://freshmeat.net/projects/nss-mysql" +DOWNLOAD="http://download.savannah.gnu.org/releases/nss-mysql/nss-mysql-1.0.tar.gz" +MD5SUM="a1bacf9bcdd8c5172b8074e268af1436" +MAINTAINER="Menno E. Duursma" +EMAIL="druiloor@zonnet.nl" +APPROVED="BP{k}" diff --git a/libraries/nss-mysql/nsswitch.conf b/libraries/nss-mysql/nsswitch.conf new file mode 100644 index 0000000000..d081f675bf --- /dev/null +++ b/libraries/nss-mysql/nsswitch.conf @@ -0,0 +1,39 @@ +# +# /etc/nsswitch.conf +# +# An example Name Service Switch config file. This file should be +# sorted with the most-used services at the beginning. +# +# The entry '[NOTFOUND=return]' means that the search for an +# entry should stop if the search in the previous entry turned +# up nothing. Note that if the search failed due to some other reason +# (like no NIS server responding) then the search continues with the +# next entry. +# +# Legal entries are: +# +# nisplus or nis+ Use NIS+ (NIS version 3) +# nis or yp Use NIS (NIS version 2), also called YP +# dns Use DNS (Domain Name Service) +# files Use the local files +# [NOTFOUND=return] Stop searching if not found so far +# + +passwd: files mysql +shadow: files mysql +group: files mysql + +hosts: files dns +networks: files dns + +services: files +protocols: files +rpc: files +ethers: files +netmasks: files +netgroup: files +bootparams: files + +automount: files +aliases: files + diff --git a/libraries/nss-mysql/slack-desc b/libraries/nss-mysql/slack-desc new file mode 100644 index 0000000000..e408fa83b0 --- /dev/null +++ b/libraries/nss-mysql/slack-desc @@ -0,0 +1,8 @@ +nss-mysql: MySQL Name Service Switch Module +nss-mysql: +nss-mysql: NSS-MySQL is a NSS library for MySQL. +nss-mysql: Featuring full groups, passwd and shadow support. +nss-mysql: +nss-mysql: The nss-mysql project was started by Steve Brown +nss-mysql: and is currently maintained by Guillaume Morin +nss-mysql: |