LEMONLDAP::NG : New Makefile in progress. Debian install is broken for now.
This commit is contained in:
parent
82fd48c92e
commit
5ba1178057
|
@ -1,38 +1,116 @@
|
||||||
#!/usr/bin/make
|
#!/usr/bin/make
|
||||||
|
|
||||||
# Example and real root installation
|
# Prefix for packaging
|
||||||
|
DESTDIR=
|
||||||
|
|
||||||
|
# Perl options
|
||||||
|
#PERLOPTIONS="INSTALLDIRS=vendor"
|
||||||
|
PERLOPTIONS=
|
||||||
|
|
||||||
|
# Default directories install
|
||||||
|
PREFIX=/usr/local/
|
||||||
|
LMPREFIX=$(PREFIX)lemonldap-ng/
|
||||||
|
RLMPREFIX=$(DESTDIR)$(LMPREFIX)
|
||||||
|
# BIN dirs
|
||||||
|
BINDIR=$(RLMPREFIX)bin/
|
||||||
|
SBINDIR=$(RLMPREFIX)sbin/
|
||||||
|
DATADIR=$(LMPREFIX)data/
|
||||||
|
RDATADIR=$(DESTDIR)$(DATADIR)
|
||||||
|
|
||||||
|
|
||||||
EXAMPLEROOT=`pwd`/example/
|
EXAMPLEROOT=`pwd`/example/
|
||||||
REALROOT=$(EXAMPLEROOT)
|
|
||||||
# Subfolders
|
# Document roots for Apache VirtualHosts
|
||||||
SYSTEMCONFDIR=$(EXAMPLEROOT)etc/lemonldap-ng/
|
DOCUMENTROOT=$(LMPREFIX)htdocs/
|
||||||
SCRIPTSDIR=$(EXAMPLEROOT)var/lib/lemonldap-ng/
|
PORTALDIR=$(DOCUMENTROOT)portal/
|
||||||
|
RPORTALDIR=$(DESTDIR)$(PORTALDIR)
|
||||||
|
PORTALSKINSDIR=$(PORTALDIR)skins/
|
||||||
|
RPORTALSKINSDIR=$(DESTDIR)$(PORTALSKINSDIR)
|
||||||
|
LASPPORTALDIR=$(DOCUMENTROOT)liberty-alliance-sp-portal/
|
||||||
|
RLASPPORTALDIR=$(DESTDIR)$(LASPPORTALDIR)
|
||||||
|
MANAGERDIR=$(DOCUMENTROOT)manager/
|
||||||
|
RMANAGERDIR=$(DESTDIR)$(MANAGERDIR)
|
||||||
|
MANAGERDATADIR=$(MANAGERDIR)imgs/
|
||||||
|
RMANAGERDATADIR=$(DESTDIR)$(MANAGERDATADIR)
|
||||||
|
SESSIONSEXPLORERDIR=$(MANAGERDIR)
|
||||||
|
RSESSIONSEXPLORERDIR=$(DESTDIR)$(SESSIONSEXPLORERDIR)
|
||||||
|
SESSIONSEXPLORERDATADIR=$(SESSIONSEXPLORERDIR)images/
|
||||||
|
RSESSIONSEXPLORERDATADIR=$(DESTDIR)$(SESSIONSEXPLORERDATADIR)
|
||||||
|
DOCDIR=$(DOCUMENTROOT)doc/
|
||||||
|
RDOCDIR=$(DESTDIR)$(DOCDIR)
|
||||||
|
TESTDIR=$(DOCUMENTROOT)test/
|
||||||
|
RTESTDIR=$(DESTDIR)$(TESTDIR)
|
||||||
|
EXAMPLESDIR=$(LMPREFIX)examples/
|
||||||
|
REXAMPLESDIR=$(DESTDIR)$(EXAMPLESDIR)
|
||||||
|
TOOLSDIR=$(LMPREFIX)tools/
|
||||||
|
RTOOLSDIR=$(DESTDIR)$(TOOLSDIR)
|
||||||
|
|
||||||
|
DOCDIR=$(DOCUMENTROOT)doc/
|
||||||
|
RDOCDIR=$(DESTDIR)$(DOCDIR)
|
||||||
|
|
||||||
|
# Handler dir
|
||||||
|
HANDLERDIR=$(LMPREFIX)handler/
|
||||||
|
RHANDLERDIR=$(DESTDIR)$(HANDLERDIR)
|
||||||
|
|
||||||
|
# Configuration dir
|
||||||
|
CONFDIR=$(LMPREFIX)etc/
|
||||||
|
RCONFDIR=$(DESTDIR)$(CONFDIR)
|
||||||
|
CRONDIR=$(LMPREFIX)etc/cron.d/
|
||||||
|
RCRONDIR=$(DESTDIR)$(CRONDIR)
|
||||||
|
STORAGECONFFILE=$(CONFDIR)storage.conf
|
||||||
|
|
||||||
|
# Lemonldap-ng configuration storage dir
|
||||||
|
FILECONFIGDIR=$(DATADIR)conf/
|
||||||
|
RFILECONFIGDIR=$(DESTDIR)$(FILECONFIGDIR)
|
||||||
|
|
||||||
|
# Apache::Session::File storage dir
|
||||||
|
APACHESESSIONFILEDIR=$(DATADIR)sessions/
|
||||||
|
RAPACHESESSIONFILEDIR=$(DESTDIR)$(APACHESESSIONFILEDIR)
|
||||||
|
APACHESESSIONFILELOCKDIR=$(APACHESESSIONFILEDIR)lock/
|
||||||
|
RAPACHESESSIONFILELOCKDIR=$(DESTDIR)$(APACHESESSIONFILELOCKDIR)
|
||||||
|
APACHEUSER=
|
||||||
|
APACHEGROUP=
|
||||||
|
|
||||||
# DNS Domain for cookie and virtual hosts
|
# DNS Domain for cookie and virtual hosts
|
||||||
DNSDOMAIN="example.com"
|
DNSDOMAIN=example.com
|
||||||
|
|
||||||
# LDAP parameters
|
# LDAP parameters
|
||||||
LDAPHOST="localhost"
|
LDAPHOST=localhost
|
||||||
LDAPPORT="389"
|
LDAPPORT=389
|
||||||
LDAPSUFFIX="dc=example,dc=net"
|
LDAPSUFFIX=dc=example,dc=net
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
VERSION=`head -n1 changelog |sed -e 's/lemonldap-ng (//' -e 's/).*$$//'`
|
VERSION=`head -n1 changelog |sed -e 's/lemonldap-ng (//' -e 's/).*$$//'`
|
||||||
SRCCOMMONDIR=lemonldap-ng-common
|
SRCCOMMONDIR=lemonldap-ng-common/
|
||||||
SRCHANDLERDIR=lemonldap-ng-handler
|
SRCHANDLERDIR=lemonldap-ng-handler/
|
||||||
SRCPORTALDIR=lemonldap-ng-portal
|
SRCPORTALDIR=lemonldap-ng-portal/
|
||||||
SRCMANAGERDIR=lemonldap-ng-manager
|
SRCMANAGERDIR=lemonldap-ng-manager/
|
||||||
EXAMPLELANG=en # For static Manager only
|
EXAMPLELANG=en # For static Manager example only
|
||||||
DESTFILECONFDIR=$(SYSTEMCONFDIR)conf/
|
|
||||||
DESTSESSIONDIR=$(SCRIPTSDIR)sessions/
|
|
||||||
DESTLASPDIR=$(SCRIPTSDIR)liberty-alliance-sp-portal
|
|
||||||
DESTPORTALDIR=$(SCRIPTSDIR)portal/
|
|
||||||
DESTHANDLERDIR=$(SCRIPTSDIR)handler/
|
|
||||||
DESTMANAGERDIR=$(SCRIPTSDIR)manager/
|
|
||||||
DESTDOCSDIR=$(SCRIPTSDIR)docs/
|
|
||||||
# Real directories for file content substitution
|
|
||||||
REALSYSTEMCONFDIR=$(REALROOT)etc/lemonldap-ng/
|
|
||||||
REALSCRIPTSDIR=$(REALROOT)var/lib/lemonldap-ng/
|
|
||||||
REALDESTFILECONFDIR=$(REALSYSTEMCONFDIR)conf/
|
|
||||||
REALDESTSESSIONDIR=$(REALSCRIPTSDIR)sessions/
|
|
||||||
REALDESTLASPDIR=$(REALSCRIPTSDIR)liberty-alliance-sp-portal
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Perl libraries configuration
|
||||||
|
#
|
||||||
|
configure: common_conf handler_conf portal_conf manager_conf
|
||||||
|
|
||||||
|
common_conf:
|
||||||
|
@cd ${SRCCOMMONDIR}; LMNGCONFFILE=$(STORAGECONFFILE) perl Makefile.PL $(PERLOPTIONS)
|
||||||
|
@touch common_conf
|
||||||
|
|
||||||
|
handler_conf:
|
||||||
|
@cd ${SRCHANDLERDIR}; perl Makefile.PL $(PERLOPTIONS)
|
||||||
|
@touch handler_conf
|
||||||
|
|
||||||
|
portal_conf:
|
||||||
|
@cd ${SRCPORTALDIR}; perl Makefile.PL $(PERLOPTIONS)
|
||||||
|
@touch portal_conf
|
||||||
|
|
||||||
|
manager_conf:
|
||||||
|
@cd ${SRCMANAGERDIR}; perl Makefile.PL $(PERLOPTIONS)
|
||||||
|
@touch manager_conf
|
||||||
|
|
||||||
|
#
|
||||||
|
# Perl libraries make
|
||||||
|
#
|
||||||
all: common handler manager portal
|
all: common handler manager portal
|
||||||
|
|
||||||
common: common_conf
|
common: common_conf
|
||||||
|
@ -51,24 +129,6 @@ manager: manager_conf
|
||||||
@$(MAKE) -C ${SRCMANAGERDIR}
|
@$(MAKE) -C ${SRCMANAGERDIR}
|
||||||
@touch manager
|
@touch manager
|
||||||
|
|
||||||
configure: common_conf handler_conf portal_conf manager_conf
|
|
||||||
|
|
||||||
common_conf:
|
|
||||||
@cd ${SRCCOMMONDIR}; perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
|
|
||||||
@touch common_conf
|
|
||||||
|
|
||||||
handler_conf:
|
|
||||||
@cd ${SRCHANDLERDIR}; perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
|
|
||||||
@touch handler_conf
|
|
||||||
|
|
||||||
portal_conf:
|
|
||||||
@cd ${SRCPORTALDIR}; perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
|
|
||||||
@touch portal_conf
|
|
||||||
|
|
||||||
manager_conf:
|
|
||||||
@cd ${SRCMANAGERDIR}; perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
|
|
||||||
@touch manager_conf
|
|
||||||
|
|
||||||
test: common handler portal manager common_test handler_test portal_test manager_test
|
test: common handler portal manager common_test handler_test portal_test manager_test
|
||||||
|
|
||||||
common_test: common
|
common_test: common
|
||||||
|
@ -83,60 +143,153 @@ portal_test: portal handler_test common_test
|
||||||
manager_test: manager handler_test common_test
|
manager_test: manager handler_test common_test
|
||||||
@$(MAKE) -C ${SRCMANAGERDIR} test INST_ARCHLIB=../${SRCCOMMONDIR}/blib/lib/
|
@$(MAKE) -C ${SRCMANAGERDIR} test INST_ARCHLIB=../${SRCCOMMONDIR}/blib/lib/
|
||||||
|
|
||||||
install: common_install handler_install portal_install manager_install
|
#
|
||||||
|
# INSTALL
|
||||||
|
#
|
||||||
|
install: install_libs install_bin install_site
|
||||||
|
|
||||||
common_install: common
|
#
|
||||||
|
# Perl libraires install
|
||||||
|
#
|
||||||
|
install_libs: common_install_libs handler_install_libs portal_install_libs manager_install_libs
|
||||||
|
|
||||||
|
common_install_libs: common
|
||||||
@$(MAKE) -C ${SRCCOMMONDIR} install
|
@$(MAKE) -C ${SRCCOMMONDIR} install
|
||||||
@touch common_install
|
@touch common_install
|
||||||
|
|
||||||
handler_install: handler
|
handler_install_libs: handler
|
||||||
@$(MAKE) -C ${SRCHANDLERDIR} install
|
@$(MAKE) -C ${SRCHANDLERDIR} install
|
||||||
@touch handler_install
|
@touch handler_install
|
||||||
|
|
||||||
portal_install: portal
|
portal_install_libs: portal
|
||||||
@$(MAKE) -C ${SRCPORTALDIR} install
|
@$(MAKE) -C ${SRCPORTALDIR} install
|
||||||
@touch portal_install
|
@touch portal_install
|
||||||
|
|
||||||
manager_install: manager
|
manager_install_libs: manager
|
||||||
@$(MAKE) -C ${SRCMANAGERDIR} install
|
@$(MAKE) -C ${SRCMANAGERDIR} install
|
||||||
@touch manager_install
|
@touch manager_install
|
||||||
|
|
||||||
distclean: clean
|
example:
|
||||||
|
@$(MAKE) -f $(MAKEFILE) install_site LMPREFIX=$(EXAMPLEROOT)
|
||||||
|
|
||||||
clean: common_clean handler_clean portal_clean manager_clean
|
install_bin: install_libs install_conf_dir
|
||||||
@rm -rf ${SYSTEMCONFDIR}
|
mkdir -p $(BINDIR)
|
||||||
@rm -rf ${SCRIPTSDIR}
|
cp --preserve=mode ${SRCPORTALDIR}/example/scripts/purgeCentralCache $(BINDIR)
|
||||||
@rm -vf *gz
|
cp --preserve=mode ${SRCMANAGERDIR}/example/scripts/lmConfigEditor $(BINDIR)
|
||||||
|
|
||||||
common_clean:
|
#
|
||||||
- $(MAKE) -C ${SRCCOMMONDIR} distclean
|
# SITE INSTALL
|
||||||
@rm -vf common*
|
#
|
||||||
|
install_site: install_manager_site install_portal_site install_handler_site install_test_site install_examples_site
|
||||||
|
@install -v -d $(RCONFDIR)
|
||||||
|
# Apache configuration files
|
||||||
|
@cp --remove-destination _example/etc/apache* $(RCONFDIR)
|
||||||
|
@perl -i -pe 's#__HANDLER__#${HANDLERDIR}MyHandler.pm#; \
|
||||||
|
s/__DNSDOMAIN__/$(DNSDOMAIN)/g; \
|
||||||
|
s#__PORTALDIR__#$(PORTALDIR)#g; \
|
||||||
|
s#__MANAGERDIR__#$(MANAGERDIR)#g; \
|
||||||
|
s#__TESTDIR__#$(TESTDIR)#g; \
|
||||||
|
s#__DOCDIR__#$(DOCDIR)#g;' $(RCONFDIR)/apache*
|
||||||
|
# File for /etc/hosts inclusion
|
||||||
|
@cp --remove-destination _example/etc/for_etc_hosts $(RCONFDIR)
|
||||||
|
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $(RCONFDIR)for_etc_hosts
|
||||||
|
|
||||||
handler_clean:
|
install_manager_site: install_conf_dir
|
||||||
- $(MAKE) -C ${SRCHANDLERDIR} distclean
|
# Manager install
|
||||||
@rm -vf handler*
|
@install -v -d ${RMANAGERDIR} ${RMANAGERDATADIR} \
|
||||||
|
${RSESSIONSEXPLORERDIR} $(RSESSIONSEXPLORERDATADIR) \
|
||||||
|
$(RCONFDIR)
|
||||||
|
@find ${RMANAGERDIR} -type l -name imgs -delete
|
||||||
|
@find ${RMANAGERDIR} -type l -name images -delete
|
||||||
|
@cp -pR --remove-destination ${SRCMANAGERDIR}example/* ${RMANAGERDIR}
|
||||||
|
@rm -rf $$(find ${RMANAGERDIR} -type d -name .svn)
|
||||||
|
@if [ "${RMANAGERDIR}imgs/" != "${RMANAGERDATADIR}" ]; then \
|
||||||
|
mv -f ${RMANAGERDIR}imgs/* ${RMANAGERDATADIR}; \
|
||||||
|
rm -rf ${RMANAGERDIR}imgs; \
|
||||||
|
ln -s $$(echo ${RMANAGERDATADIR} | sed -e 's/\/$$//') ${RMANAGERDIR}imgs; \
|
||||||
|
fi
|
||||||
|
# apply.conf install
|
||||||
|
@mv ${RMANAGERDIR}apply.conf $(RCONFDIR)
|
||||||
|
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $(RCONFDIR)apply.conf
|
||||||
|
@perl -i -pe 's#__APPLYCONFFILE__#$(CONFDIR)apply.conf#' ${RMANAGERDIR}index.pl
|
||||||
|
# Sessions explorer install
|
||||||
|
@if [ "${MANAGERDIR}" != "$(SESSIONSEXPLORERDIR)" ]; then mv -f ${RMANAGERDIR}sessions.pl $(RSESSIONSEXPLORERDIR); fi
|
||||||
|
@if [ "${MANAGERDIR}images/" != "${SESSIONSEXPLORERDATADIR}" ]; then \
|
||||||
|
mv -f ${RMANAGERDIR}images/* ${RSESSIONSEXPLORERDATADIR}; \
|
||||||
|
rm -rf ${RMANAGERDIR}images; \
|
||||||
|
ln -s $$(echo ${SESSIONSEXPLORERDATADIR} | sed -e 's/\/$$//') ${RMANAGERDIR}images; \
|
||||||
|
fi
|
||||||
|
|
||||||
portal_clean:
|
install_portal_site: install_conf_dir
|
||||||
- $(MAKE) -C ${SRCPORTALDIR} distclean
|
# Portal install
|
||||||
@rm -vf portal*
|
@install -v -d $(RPORTALDIR) $(RPORTALSKINSDIR) \
|
||||||
|
$(RPORTALDIR)skins/ $(RLASPPORTALDIR) \
|
||||||
|
$(RCRONDIR) $(RCONFDIR)
|
||||||
|
@for skin in $$(ls lemonldap-ng-portal/example/skins/); do \
|
||||||
|
[ -h $(RPORTALDIR)skins/$$skin ] && rm -f $(RPORTALDIR)skins/$$skin; \
|
||||||
|
install -v -d $(RPORTALSKINSDIR)$$skin; \
|
||||||
|
done
|
||||||
|
@cp -pR --remove-destination ${SRCPORTALDIR}example/index_skin.pl ${RPORTALDIR}index.pl
|
||||||
|
@cp -pR --remove-destination ${SRCPORTALDIR}example/error.pl ${RPORTALDIR}
|
||||||
|
@perl -i -pe 's#__SKINDIR__#$(PORTALDIR)skins#; \
|
||||||
|
s#__APPSXMLFILE__#$(CONFDIR)apps-list.xml#;' ${RPORTALDIR}index.pl ${RPORTALDIR}error.pl
|
||||||
|
@cp -pR --remove-destination ${SRCPORTALDIR}example/skins/* $(RPORTALSKINSDIR)
|
||||||
|
@if [ "$(PORTALDIR)skins/" != "$(PORTALSKINSDIR)" ]; then \
|
||||||
|
for skin in $$(ls lemonldap-ng-portal/example/skins/); do \
|
||||||
|
rm -rf $(RPORTALDIR)skins/$$skin/; \
|
||||||
|
ln -s $(PORTALSKINSDIR)$$skin $(RPORTALDIR)skins/$$skin; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
@cp --remove-destination _example/etc/apps-list* $(RCONFDIR)
|
||||||
|
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $(RCONFDIR)apps-list.xml
|
||||||
|
# L-A portal install
|
||||||
|
@cp -pR --remove-destination ${SRCPORTALDIR}example/AuthLA/* $(RLASPPORTALDIR)
|
||||||
|
@perl -i -pe 's#__DIR__#$(LASPPORTALDIR)#g' $(RLASPPORTALDIR)index.pl
|
||||||
|
# Cron files
|
||||||
|
@cp --remove-destination lemonldap-ng-portal/example/scripts/purgeCentralCache.cron.d $(RCRONDIR)
|
||||||
|
# Clean SVN files
|
||||||
|
@rm -rf $$(find ${RPORTALDIR} $(RPORTALSKINSDIR) $(RLASPPORTALDIR) -type d -name .svn)
|
||||||
|
|
||||||
manager_clean:
|
install_handler_site: install_conf_dir
|
||||||
- $(MAKE) -C ${SRCMANAGERDIR} distclean
|
@install -v -d ${RHANDLERDIR}
|
||||||
@rm -vf manager*
|
@cp --remove-destination ${SRCHANDLERDIR}/example/MyHandler.pm ${RHANDLERDIR}
|
||||||
|
|
||||||
example: all
|
install_test_site:
|
||||||
@mkdir -p ${DESTFILECONFDIR} ${DESTPORTALDIR} ${DESTHANDLERDIR} ${DESTMANAGERDIR} ${SYSTEMCONFDIR} ${DESTDOCSDIR} ${DESTSESSIONDIR}
|
@install -v -d $(RTESTDIR)
|
||||||
@cp -a ${SRCHANDLERDIR}/example/* ${DESTHANDLERDIR}
|
@cp -pR --remove-destination _example/test/* $(RTESTDIR)
|
||||||
@cp -a ${SRCPORTALDIR}/example/* ${DESTPORTALDIR}
|
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $(RTESTDIR)index.pl
|
||||||
@rm -rf ${DESTLASPDIR}
|
|
||||||
@mv ${DESTPORTALDIR}AuthLA $$(echo ${DESTLASPDIR} | sed -e 's/\/$$//')
|
install_examples_site:
|
||||||
@cp -a ${SRCMANAGERDIR}/example/* ${DESTMANAGERDIR}
|
@install -v -d $(REXAMPLESDIR)
|
||||||
@cp -a _example/etc/lemonldap-ng/* ${SYSTEMCONFDIR}
|
@for i in portal manager portal handler; do \
|
||||||
@cp -a _example/var/lib/lemonldap-ng/* ${SCRIPTSDIR}
|
cp -dpR --remove-destination lemonldap-ng-$$i/example $(REXAMPLESDIR)/$$i; \
|
||||||
@cp -a doc/* ${DESTDOCSDIR}
|
done
|
||||||
@find ${DESTLASPDIR} -type f -exec perl -i -pe 's#__DIR__/?#'${REALDESTLASPDIR}'#g;s#__CONFDIR__/?#'${REALDESTFILECONFDIR}'#g' {} \;
|
|
||||||
@find ${SCRIPTSDIR} -type f -exec perl -i -pe 's#__DIR__/?#'${REALSCRIPTSDIR}'#g;s#__SYSCONFDIR__/?#'${REALSYSTEMCONFDIR}'#g;s#__CONFDIR__/?#'${REALDESTFILECONFDIR}'#g;s#__SESSIONDIR__/?#'${REALDESTSESSIONDIR}'#g;s#__DNSDOMAIN__#'${DNSDOMAIN}'#g;s#__LDAPHOST__#'${LDAPHOST}'#g;s#__LDAPPORT__#'${LDAPPORT}'#g;s#__LDAPSUFFIX__#'${LDAPSUFFIX}'#g;' {} \;
|
install_conf_dir: install_sessions_dir
|
||||||
@find ${SYSTEMCONFDIR} -type f -exec perl -i -pe 's#__DIR__/?#'${REALSCRIPTSDIR}'#g;s#__SESSIONDIR__/?#'${REALDESTSESSIONDIR}'#g;s#__DNSDOMAIN__#'${DNSDOMAIN}'#g;s#__LDAPHOST__#'${LDAPHOST}'#g;s#__LDAPPORT__#'${LDAPPORT}'#g;s#__LDAPSUFFIX__#'${LDAPSUFFIX}'#g;' {} \;
|
@install -v -d $(RCONFDIR) $(RFILECONFIGDIR) $(RTOOLSDIR)
|
||||||
|
@cp --remove-destination $(SRCCOMMONDIR)storage.conf $(RCONFDIR)
|
||||||
|
@cp _example/conf/lmConf-1 $(RFILECONFIGDIR)
|
||||||
|
@perl -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g;\
|
||||||
|
s/__LDAPPORT__/$(LDAPPORT)/g;\
|
||||||
|
s/__LDAPHOST__/$(LDAPHOST)/g;\
|
||||||
|
s/__LDAPSUFFIX__/$(LDAPSUFFIX)/g;\
|
||||||
|
s#__SESSIONDIR__#$(APACHESESSIONFILEDIR)#g;' $(RFILECONFIGDIR)lmConf-1
|
||||||
|
@cp lemonldap-ng-common/tools/lmConfig.mysql lemonldap-ng-common/tools/apache-session-mysql.sql $(RTOOLSDIR)
|
||||||
|
|
||||||
|
install_sessions_dir:
|
||||||
|
@install -m 777 -v -d $(RAPACHESESSIONFILEDIR) $(RAPACHESESSIONFILELOCKDIR)
|
||||||
|
# Fix Apache::Session directories permissions
|
||||||
|
@if [ "$(APACHEUSER)" != "" ]; then \
|
||||||
|
chown $(APACHEUSER) $(RAPACHESESSIONFILEDIR) $(RAPACHESESSIONFILELOCKDIR); \
|
||||||
|
if [ "$(APACHEGROUP)" != "" ]; then \
|
||||||
|
chgrp $(APACHEGROUP) $(RAPACHESESSIONFILEDIR) $(RAPACHESESSIONFILELOCKDIR); \
|
||||||
|
fi; \
|
||||||
|
chmod 770 $(RAPACHESESSIONFILEDIR) $(RAPACHESESSIONFILELOCKDIR); \
|
||||||
|
else \
|
||||||
|
chmod 777 $(RAPACHESESSIONFILEDIR) $(RAPACHESESSIONFILELOCKDIR); \
|
||||||
|
fi
|
||||||
|
|
||||||
|
TODO:
|
||||||
@echo
|
@echo
|
||||||
@echo "LemonLDAP::NG example v${VERSION} is installed with these parameters:"
|
@echo "LemonLDAP::NG example v${VERSION} is installed with these parameters:"
|
||||||
@echo " - System configuration: ${SYSTEMCONFDIR}"
|
@echo " - System configuration: ${SYSTEMCONFDIR}"
|
||||||
|
@ -177,12 +330,6 @@ postconf_unixrights:
|
||||||
postconf: postconf_hosts postconf_unixrights
|
postconf: postconf_hosts postconf_unixrights
|
||||||
@echo "Post configuration done"
|
@echo "Post configuration done"
|
||||||
|
|
||||||
production_preconf:
|
|
||||||
# TODO: modify EXAMPLEROOT and set it to /
|
|
||||||
# TODO: ask parameters value (like DNSDOMAIN, LDAPHOST, etc.)
|
|
||||||
|
|
||||||
production_install: production_preconf example
|
|
||||||
|
|
||||||
uninstall: configure handler_uninstall portal_uninstall manager_uninstall
|
uninstall: configure handler_uninstall portal_uninstall manager_uninstall
|
||||||
|
|
||||||
common_uninstall: common
|
common_uninstall: common
|
||||||
|
@ -239,3 +386,25 @@ static_example: example
|
||||||
documentation:
|
documentation:
|
||||||
@cd doc/ && ../scripts/doc.pl
|
@cd doc/ && ../scripts/doc.pl
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
|
||||||
|
clean: common_clean handler_clean portal_clean manager_clean
|
||||||
|
@rm -rf $(EXAMPLEROOT)
|
||||||
|
@rm -vf *gz
|
||||||
|
|
||||||
|
common_clean:
|
||||||
|
- $(MAKE) -C ${SRCCOMMONDIR} distclean
|
||||||
|
@rm -vf common*
|
||||||
|
|
||||||
|
handler_clean:
|
||||||
|
- $(MAKE) -C ${SRCHANDLERDIR} distclean
|
||||||
|
@rm -vf handler*
|
||||||
|
|
||||||
|
portal_clean:
|
||||||
|
- $(MAKE) -C ${SRCPORTALDIR} distclean
|
||||||
|
@rm -vf portal*
|
||||||
|
|
||||||
|
manager_clean:
|
||||||
|
- $(MAKE) -C ${SRCMANAGERDIR} distclean
|
||||||
|
@rm -vf manager*
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
NameVirtualHost *
|
NameVirtualHost *
|
||||||
|
|
||||||
# Perl environment
|
# Perl environment
|
||||||
PerlRequire __DIR__/handler/MyHandler.pm
|
PerlRequire __HANDLER__
|
||||||
<Files ~ "\.(pl)$">
|
<Files ~ "\.(pl)$">
|
||||||
SetHandler perl-script
|
SetHandler perl-script
|
||||||
PerlHandler Apache::Registry
|
PerlHandler Apache::Registry
|
||||||
|
@ -20,8 +20,8 @@ LogLevel warn
|
||||||
ServerName auth.__DNSDOMAIN__
|
ServerName auth.__DNSDOMAIN__
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __DIR__/portal/
|
DocumentRoot __PORTALDIR__
|
||||||
<Directory __DIR__/portal/>
|
<Directory __PORTALDIR__>
|
||||||
Order allow,deny
|
Order allow,deny
|
||||||
Allow from all
|
Allow from all
|
||||||
Options +ExecCGI
|
Options +ExecCGI
|
||||||
|
@ -34,8 +34,8 @@ LogLevel warn
|
||||||
ServerName manager.__DNSDOMAIN__
|
ServerName manager.__DNSDOMAIN__
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __DIR__/manager/
|
DocumentRoot __MANAGERDIR__
|
||||||
<Directory __DIR__/manager/>
|
<Directory __MANAGERDIR__>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Deny from all
|
Deny from all
|
||||||
Allow from 127.0.0.0/8
|
Allow from 127.0.0.0/8
|
||||||
|
@ -43,8 +43,8 @@ LogLevel warn
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
# On-line documentation
|
# On-line documentation
|
||||||
Alias /docs/ __DIR__/docs/
|
Alias /docs/ __DOCDIR__/docs/
|
||||||
<Directory __DIR__/docs/>
|
<Directory __DOCDIR__/docs/>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
</Directory>
|
</Directory>
|
||||||
|
@ -59,8 +59,8 @@ LogLevel warn
|
||||||
PerlHeaderParserHandler My::Package
|
PerlHeaderParserHandler My::Package
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __DIR__/test/
|
DocumentRoot __TESTDIR__
|
||||||
<Directory __DIR__/test/>
|
<Directory __TESTDIR__>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
Options +ExecCGI
|
Options +ExecCGI
|
||||||
|
@ -93,8 +93,8 @@ LogLevel warn
|
||||||
PerlHeaderParserHandler My::Package
|
PerlHeaderParserHandler My::Package
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __DIR__/test/
|
DocumentRoot __TESTDIR__
|
||||||
<Directory __DIR__/test/>
|
<Directory __TESTDIR__>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
Options +ExecCGI
|
Options +ExecCGI
|
||||||
|
@ -119,3 +119,4 @@ LogLevel warn
|
||||||
#</Location>
|
#</Location>
|
||||||
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
NameVirtualHost *
|
NameVirtualHost *
|
||||||
|
|
||||||
# Perl environment
|
# Perl environment
|
||||||
PerlRequire __DIR__/handler/MyHandler.pm
|
PerlRequire __HANDLER__
|
||||||
PerlOptions +GlobalRequest
|
PerlOptions +GlobalRequest
|
||||||
<Files ~ "\.(pl)$">
|
<Files ~ "\.(pl)$">
|
||||||
SetHandler perl-script
|
SetHandler perl-script
|
||||||
|
@ -22,8 +22,8 @@ LogLevel warn
|
||||||
ServerName auth.__DNSDOMAIN__
|
ServerName auth.__DNSDOMAIN__
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __DIR__/portal/
|
DocumentRoot __PORTALDIR__
|
||||||
<Directory __DIR__/portal/>
|
<Directory __PORTALDIR__>
|
||||||
Order allow,deny
|
Order allow,deny
|
||||||
Allow from all
|
Allow from all
|
||||||
Options +ExecCGI
|
Options +ExecCGI
|
||||||
|
@ -36,8 +36,8 @@ LogLevel warn
|
||||||
ServerName manager.__DNSDOMAIN__
|
ServerName manager.__DNSDOMAIN__
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __DIR__/manager/
|
DocumentRoot __MANAGERDIR__
|
||||||
<Directory __DIR__/manager/>
|
<Directory __MANAGERDIR__>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Deny from all
|
Deny from all
|
||||||
Allow from 127.0.0.0/8
|
Allow from 127.0.0.0/8
|
||||||
|
@ -45,8 +45,8 @@ LogLevel warn
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
# On-line documentation
|
# On-line documentation
|
||||||
Alias /docs/ __DIR__/docs/
|
Alias /docs/ __DOCDIR__/docs/
|
||||||
<Directory __DIR__/docs/>
|
<Directory __DOCDIR__/docs/>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
</Directory>
|
</Directory>
|
||||||
|
@ -61,8 +61,8 @@ LogLevel warn
|
||||||
PerlHeaderParserHandler My::Package
|
PerlHeaderParserHandler My::Package
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __DIR__/test/
|
DocumentRoot __TESTDIR__
|
||||||
<Directory __DIR__/test/>
|
<Directory __TESTDIR__>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
Options +ExecCGI
|
Options +ExecCGI
|
||||||
|
@ -95,8 +95,8 @@ LogLevel warn
|
||||||
PerlHeaderParserHandler My::Package
|
PerlHeaderParserHandler My::Package
|
||||||
|
|
||||||
# DocumentRoot
|
# DocumentRoot
|
||||||
DocumentRoot __DIR__/test/
|
DocumentRoot __TESTDIR__
|
||||||
<Directory __DIR__/test/>
|
<Directory __TESTDIR__>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
Options +ExecCGI
|
Options +ExecCGI
|
145
build/lemonldap-ng/_example/test/index.pl
Executable file
145
build/lemonldap-ng/_example/test/index.pl
Executable file
|
@ -0,0 +1,145 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
#================================================
|
||||||
|
# LemonLDAP::NG default test page
|
||||||
|
# Display headers and environment
|
||||||
|
#================================================
|
||||||
|
|
||||||
|
# Init CGI
|
||||||
|
use CGI;
|
||||||
|
my $cgi = CGI->new;
|
||||||
|
|
||||||
|
# GET parameters
|
||||||
|
my $name = $cgi->param("name") || "LemonLDAP::NG sample protected application";
|
||||||
|
my $color = $cgi->param("color") || "#ddd";
|
||||||
|
|
||||||
|
# Local parameters
|
||||||
|
my $manager_url = "http://manager.__DNSDOMAIN__";
|
||||||
|
my $portal_url = "http://auth.__DNSDOMAIN__";
|
||||||
|
|
||||||
|
# CSS
|
||||||
|
my $css = <<EOT;
|
||||||
|
body{
|
||||||
|
background:$color;
|
||||||
|
font-family:sans-serif;
|
||||||
|
font-size:11pt;
|
||||||
|
padding:0 5%;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
#content{
|
||||||
|
background:#fff;
|
||||||
|
padding:10px;
|
||||||
|
}
|
||||||
|
#menu{
|
||||||
|
text-align:center;
|
||||||
|
margin-top:30px;
|
||||||
|
}
|
||||||
|
a{
|
||||||
|
text-decoration:none;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
h1{
|
||||||
|
font-size:16pt;
|
||||||
|
text-align:center;
|
||||||
|
margin:5px 100px;
|
||||||
|
border:2px solid $color;
|
||||||
|
}
|
||||||
|
h2{
|
||||||
|
border-bottom:2px solid $color;
|
||||||
|
}
|
||||||
|
p.note{
|
||||||
|
border:1px solid #ccc;
|
||||||
|
padding:5px;
|
||||||
|
background:#eee;
|
||||||
|
}
|
||||||
|
table{
|
||||||
|
border:1px solid #ccc;
|
||||||
|
border-collapse:collapse;
|
||||||
|
margin:5px 0;
|
||||||
|
width:100%;
|
||||||
|
font-size:small;
|
||||||
|
}
|
||||||
|
tr{
|
||||||
|
border:1px dotted #ccc;
|
||||||
|
}
|
||||||
|
tr:hover{
|
||||||
|
background:#eee;
|
||||||
|
}
|
||||||
|
th{
|
||||||
|
background:#eee;
|
||||||
|
}
|
||||||
|
td, th{
|
||||||
|
padding:3px 5px;
|
||||||
|
}
|
||||||
|
td.emphase{
|
||||||
|
background-color:#eee;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
EOT
|
||||||
|
|
||||||
|
# Read headers
|
||||||
|
my %headers;
|
||||||
|
foreach(sort keys %ENV) {
|
||||||
|
if($_ =~ /^HTTP_/) {
|
||||||
|
($a=$_) =~ s/^HTTP_//i;
|
||||||
|
$a = join '-', map {ucfirst(lc)} split '_',$a;
|
||||||
|
$headers->{$a} = $_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Display page
|
||||||
|
print $cgi->header;
|
||||||
|
print $cgi->start_html( -title => "$name",
|
||||||
|
-style => { -code => $css } );
|
||||||
|
|
||||||
|
print "<div id=\"content\">\n";
|
||||||
|
|
||||||
|
print "<h1>$name</h1>\n";
|
||||||
|
|
||||||
|
print "<div id=\"menu\"><a href=\"$portal_url\">Portal</a> - <a href=\"/logout\">Logout</a></div>\n";
|
||||||
|
|
||||||
|
print "<h2>Main informations</h2>\n";
|
||||||
|
print "<ul>\n";
|
||||||
|
print "<li>Authentication status: SUCCESS</li>\n";
|
||||||
|
print "<li>Connected user: <ul>\n";
|
||||||
|
print "<li><tt>\$ENV{HTTP_AUTH_USER}</tt>: $ENV{HTTP_AUTH_USER}</li>\n";
|
||||||
|
print "<li><tt>\$ENV{REMOTE_USER}</tt>: $ENV{REMOTE_USER}</li>\n";
|
||||||
|
print "</ul></li>\n";
|
||||||
|
print "</ul>\n";
|
||||||
|
print "<p class=\"note\">Be carefull, the <tt>\$ENV{REMOTE_USER}</tt> is set only if your script is
|
||||||
|
in the same server than Lemonldap::NG Handler (<tt>\$whatToTrace</tt> parameter). If you use
|
||||||
|
it on a reverse-proxy, <tt>\$ENV{REMOTE_USER}</tt> is not set.</p>\n";
|
||||||
|
|
||||||
|
print "<h2>HTTP headers</h2>\n";
|
||||||
|
print "<p>To know who is connected in your applications, you can read HTTP headers:</p>\n";
|
||||||
|
print "<table>\n";
|
||||||
|
print "<tr><th>Header</th><th>Perl CGI</th><th>PHP script</th><th>Value</th></tr>\n";
|
||||||
|
foreach(sort keys %$headers) {
|
||||||
|
$style = $_ eq 'Auth-User' ? 'class="emphase"' : '';
|
||||||
|
print "<tr>
|
||||||
|
<td $style>$_</td>
|
||||||
|
<td $style><tt>\$ENV{$headers->{$_}}</tt></td>
|
||||||
|
<td $style><tt>\$_SERVER{$headers->{$_}}</tt></td>
|
||||||
|
<td $style>$ENV{$headers->{$_}}</td>
|
||||||
|
</tr>\n"
|
||||||
|
}
|
||||||
|
print "</table>\n";
|
||||||
|
print "<p class=\"note\">Note that Lemonldap::NG cookie is hidden. So that application developpers can
|
||||||
|
not spoof sessions.</p>\n";
|
||||||
|
print "<p class=\"note\">You can access to any information (IP address or LDAP attribute) by customizing
|
||||||
|
exported headers with the <a href=\"$manager_url\">Lemonldap::NG Management interface</a></p>\n";
|
||||||
|
|
||||||
|
print "<h2>Environment for Perl CGI</h2>\n";
|
||||||
|
print "<table>\n";
|
||||||
|
print "<tr><th>Environment variable</th><th>Value</th></tr>\n";
|
||||||
|
foreach(sort keys %ENV) {
|
||||||
|
my $tmp = $ENV{$_};
|
||||||
|
$tmp =~ s/&/&/g;
|
||||||
|
$tmp =~ s/>/>/g;
|
||||||
|
$tmp =~ s/</</g;
|
||||||
|
print "<tr><td>$_</td><td>=> $tmp</td></tr>\n";
|
||||||
|
}
|
||||||
|
print "</table>\n";
|
||||||
|
print "</div>\n";
|
||||||
|
print $cgi->end_html;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Revision history for Perl extension Lemonldap::NG::Common.
|
Revision history for Perl extension Lemonldap::NG::Common.
|
||||||
|
|
||||||
0.1 Mon Nov 17 16:34:56 2008
|
0.9 Mon Nov 17 16:34:56 2008
|
||||||
- New package including the old Lemonldap::NG::manager::Conf
|
- New package including the old Lemonldap::NG::manager::Conf
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,10 @@ MANIFEST
|
||||||
META.yml Module meta-data (added by MakeMaker)
|
META.yml Module meta-data (added by MakeMaker)
|
||||||
README
|
README
|
||||||
scripts/lmConfig_File2MySQL
|
scripts/lmConfig_File2MySQL
|
||||||
|
storage.conf
|
||||||
t/01-Manager-Conf.t
|
t/01-Manager-Conf.t
|
||||||
t/02-Manager-Conf-File.t
|
t/02-Manager-Conf-File.t
|
||||||
t/03-Manager-Conf-DBI.t
|
t/03-Manager-Conf-DBI.t
|
||||||
t/04-Manager-Conf-SOAP.t
|
t/04-Manager-Conf-SOAP.t
|
||||||
t/10-Common.t
|
t/10-Common.t
|
||||||
|
tools/lmConfig.mysql
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
use ExtUtils::MakeMaker;
|
use ExtUtils::MakeMaker;
|
||||||
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
||||||
# the contents of the Makefile that is written.
|
# the contents of the Makefile that is written.
|
||||||
|
|
||||||
|
sub MY::top_targets {
|
||||||
|
my $self=shift;
|
||||||
|
my $r = $self->MM::top_targets(@_);
|
||||||
|
if(my $cf = $ENV{LMNGCONFFILE}) {
|
||||||
|
$r =~ s/^(all.*)$/$1 my_target/m;
|
||||||
|
$cf = quotemeta($cf);
|
||||||
|
$r .= <<"EOT";
|
||||||
|
|
||||||
|
my_target:
|
||||||
|
perl -i -pe 's/^(use constant DEFAULTCONFFILE =>).*\$\$/\$\$1 "$cf";/' blib/lib/Lemonldap/NG/Common/Conf.pm
|
||||||
|
EOT
|
||||||
|
}
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
WriteMakefile(
|
WriteMakefile(
|
||||||
NAME => 'Lemonldap::NG::Common',
|
NAME => 'Lemonldap::NG::Common',
|
||||||
VERSION_FROM => 'lib/Lemonldap/NG/Common.pm', # finds $VERSION
|
VERSION_FROM => 'lib/Lemonldap/NG/Common.pm', # finds $VERSION
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package Lemonldap::NG::Common;
|
package Lemonldap::NG::Common;
|
||||||
|
|
||||||
|
our $VERSION='0.9';
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -6,9 +6,13 @@ use Data::Dumper;
|
||||||
use Lemonldap::NG::Common::Conf::Constants;
|
use Lemonldap::NG::Common::Conf::Constants;
|
||||||
use Regexp::Assemble;
|
use Regexp::Assemble;
|
||||||
|
|
||||||
|
use constant DEFAULTCONFFILE => '/etc/lemonldap-ng/storage.conf';
|
||||||
|
|
||||||
our $VERSION = 0.51;
|
our $VERSION = 0.51;
|
||||||
our $msg;
|
our $msg;
|
||||||
|
|
||||||
|
our %_confFiles;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $args;
|
my $args;
|
||||||
|
@ -21,15 +25,16 @@ sub new {
|
||||||
%$self = @_;
|
%$self = @_;
|
||||||
}
|
}
|
||||||
unless ( $self->{mdone} ) {
|
unless ( $self->{mdone} ) {
|
||||||
|
$self->_readConfFile( $self->{confFile} );
|
||||||
unless ( $self->{type} ) {
|
unless ( $self->{type} ) {
|
||||||
$msg = "configStorage: type is not defined\n";
|
$msg .= "configStorage: type is not defined\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$self->{type} = "Lemonldap::NG::Common::Conf::$self->{type}"
|
$self->{type} = "Lemonldap::NG::Common::Conf::$self->{type}"
|
||||||
unless $self->{type} =~ /^Lemonldap/;
|
unless $self->{type} =~ /^Lemonldap::/;
|
||||||
eval "require $self->{type}";
|
eval "require $self->{type}";
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$msg = "Unknown package $self->{type}";
|
$msg .= "Unknown package $self->{type}";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0 unless $self->prereq;
|
return 0 unless $self->prereq;
|
||||||
|
@ -39,7 +44,7 @@ sub new {
|
||||||
if ( $self->{localStorage} and not defined( $self->{refLocalStorage} ) ) {
|
if ( $self->{localStorage} and not defined( $self->{refLocalStorage} ) ) {
|
||||||
eval "use $self->{localStorage};";
|
eval "use $self->{localStorage};";
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$msg = "Unable to load $self->{localStorage}: $@";
|
$msg .= "Unable to load $self->{localStorage}: $@";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$self->{refLocalStorage} =
|
$self->{refLocalStorage} =
|
||||||
|
@ -49,6 +54,35 @@ sub new {
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _readConfFile {
|
||||||
|
my $self = shift;
|
||||||
|
my $file = shift || DEFAULTCONFFILE;
|
||||||
|
unless ( $_confFiles{$file} ) {
|
||||||
|
unless ( open F, $file ) {
|
||||||
|
$msg = "/etc/lemonldap-ng/storage.conf: $!";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
while (<F>) {
|
||||||
|
next if ( /^\s*$/ or /^\s*#/ );
|
||||||
|
chomp;
|
||||||
|
s/\r//g;
|
||||||
|
/^\s*([\w]+)(?:\s*[:=]\s*|\s+)(["']?)([\S].*[\S])\2\s*$/ or next;
|
||||||
|
my $k = $1;
|
||||||
|
$_confFiles{$file}->{$k} = $3;
|
||||||
|
if ( $_confFiles{$file}->{$k} =~ /^[{\[].*[}\]]$/ ) {
|
||||||
|
eval "\$_confFiles{'$file'}->{'$k'} = $_confFiles{$file}->{$k}";
|
||||||
|
if ($@) {
|
||||||
|
$msg = "Error in file $file : $@";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close F;
|
||||||
|
}
|
||||||
|
%$self = ( %$self, %{ $_confFiles{$file} } );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
sub saveConf {
|
sub saveConf {
|
||||||
my ( $self, $conf ) = @_;
|
my ( $self, $conf ) = @_;
|
||||||
|
|
||||||
|
|
43
modules/lemonldap-ng-common/storage.conf
Normal file
43
modules/lemonldap-ng-common/storage.conf
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#
|
||||||
|
# This file contains parameters used by Lemonldap::NG to find its configuration
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 1 - Type
|
||||||
|
#
|
||||||
|
# You can use one of the following:
|
||||||
|
# * File: you have to set 'dirName' parameter. Example:
|
||||||
|
#
|
||||||
|
# type = File
|
||||||
|
# dirName = /var/lib/lemonldap-ng/conf
|
||||||
|
#
|
||||||
|
# * DBI : you have to set 'dbiChain' (required) and 'dbiUser' and 'dbiPassword'
|
||||||
|
# if needed. Example:
|
||||||
|
#
|
||||||
|
# type = DBI
|
||||||
|
# dbiChain = DBI:mysql:database=lemonldap-ng;host=1.2.3.4
|
||||||
|
# dbiUser = lemonldap
|
||||||
|
# dbiPassword = password
|
||||||
|
#
|
||||||
|
# * SOAP: SOAP configuration access is a sort of proxy: the SOAP server that
|
||||||
|
# runs Lemonldap::NG::Manager::SOAPServer is configured to use the real
|
||||||
|
# session storage type (DBI or File for example).
|
||||||
|
# You have to set 'proxy' parameter. Example:
|
||||||
|
#
|
||||||
|
# type = SOAP
|
||||||
|
# proxy = https://manager.example.com/soapmanager.pl
|
||||||
|
# proxyOptions = { timeout => 5 }
|
||||||
|
# User = lemonldap
|
||||||
|
# Password = mypassword
|
||||||
|
#
|
||||||
|
# 2 - LocalStorage
|
||||||
|
#
|
||||||
|
# To increase performances, use a local cache for the configuration. You have
|
||||||
|
# to choose a Cache::Cache module and set it's parameters (1 line). Example:
|
||||||
|
#
|
||||||
|
# localStorage = Cache::FileCache
|
||||||
|
# localStorageOptions = { 'namespace' => 'MyNamespace', 'default_expires_in' => 600, 'directory_umask' => '007', 'cache_root' => '/tmp', 'cache_depth' => 5, }
|
||||||
|
|
||||||
|
type = File
|
||||||
|
dirName = /var/lib/lemonldap-ng/conf
|
||||||
|
localStorage = Cache::FileCache
|
||||||
|
localStorageOptions = { 'namespace' => 'MyNamespace', 'default_expires_in' => 600, 'directory_umask' => '007', 'cache_root' => '/tmp', 'cache_depth' => 5, }
|
|
@ -3,20 +3,6 @@ use Lemonldap::NG::Handler::SharedConf;
|
||||||
@ISA = qw(Lemonldap::NG::Handler::SharedConf);
|
@ISA = qw(Lemonldap::NG::Handler::SharedConf);
|
||||||
|
|
||||||
__PACKAGE__->init ( {
|
__PACKAGE__->init ( {
|
||||||
localStorage => "Cache::FileCache",
|
|
||||||
localStorageOptions => {
|
|
||||||
'namespace' => 'MyNamespace',
|
|
||||||
'default_expires_in' => 600,
|
|
||||||
'directory_umask' => '007',
|
|
||||||
'cache_root' => '/tmp',
|
|
||||||
'cache_depth' => 5,
|
|
||||||
},
|
|
||||||
|
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
|
|
||||||
https => 0,
|
https => 0,
|
||||||
# Uncomment this to activate status module
|
# Uncomment this to activate status module
|
||||||
# status => 1,
|
# status => 1,
|
||||||
|
|
|
@ -4,20 +4,6 @@ use Lemonldap::NG::Handler::SharedConf;
|
||||||
|
|
||||||
__PACKAGE__->init(
|
__PACKAGE__->init(
|
||||||
{
|
{
|
||||||
localStorage => "Cache::FileCache",
|
|
||||||
localStorageOptions => {
|
|
||||||
'namespace' => 'MyNamespace',
|
|
||||||
'default_expires_in' => 600,
|
|
||||||
'directory_umask' => '007',
|
|
||||||
'cache_root' => '/tmp',
|
|
||||||
'cache_depth' => 5,
|
|
||||||
},
|
|
||||||
|
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
|
|
||||||
https => 0,
|
https => 0,
|
||||||
# Uncomment this to activate status module
|
# Uncomment this to activate status module
|
||||||
# status => 1,
|
# status => 1,
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
my $cgi = new Lemonldap::NG::Handler::CGI ( {
|
my $cgi = new Lemonldap::NG::Handler::CGI ( {
|
||||||
localStorage => "Cache::FileCache",
|
|
||||||
localStorageOptions => {
|
|
||||||
'namespace' => 'MyNamespace',
|
|
||||||
'default_expires_in' => 600,
|
|
||||||
},
|
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
https => 0,
|
https => 0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,21 +22,6 @@ use strict;
|
||||||
our $cgi;
|
our $cgi;
|
||||||
$cgi = Lemonldap::NG::Handler::CGI->new(
|
$cgi = Lemonldap::NG::Handler::CGI->new(
|
||||||
{
|
{
|
||||||
localStorage => "Cache::FileCache",
|
|
||||||
localStorageOptions => {
|
|
||||||
'namespace' => 'MyNamespace',
|
|
||||||
'default_expires_in' => 600,
|
|
||||||
'directory_umask' => '007',
|
|
||||||
'cache_root' => '/tmp',
|
|
||||||
'cache_depth' => 5,
|
|
||||||
},
|
|
||||||
# DEBIAN USERS : use this instead of classic configStorage
|
|
||||||
#configStorage => $Lemonldap::NG::Conf::configStorage,
|
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
|
|
||||||
https => 0,
|
https => 0,
|
||||||
}
|
}
|
||||||
) or die;
|
) or die;
|
||||||
|
|
|
@ -71,11 +71,9 @@ example/imgs/tombs_mag.gif
|
||||||
example/index.pl
|
example/index.pl
|
||||||
example/jquery.js
|
example/jquery.js
|
||||||
example/lemonldap-ng-manager.js
|
example/lemonldap-ng-manager.js
|
||||||
example/lmConfig.mysql
|
|
||||||
example/mrtg/lmng-mrtg
|
example/mrtg/lmng-mrtg
|
||||||
example/mrtg/mrtg.cfg.example
|
example/mrtg/mrtg.cfg.example
|
||||||
example/scripts/lmConfigEditor
|
example/scripts/lmConfigEditor
|
||||||
example/scripts/lmSessionDump
|
|
||||||
example/sessions.pl
|
example/sessions.pl
|
||||||
example/soapserver.pl
|
example/soapserver.pl
|
||||||
example/theme/default.css
|
example/theme/default.css
|
||||||
|
|
|
@ -4,12 +4,8 @@ use Lemonldap::NG::Manager;
|
||||||
|
|
||||||
my $h = new Lemonldap::NG::Manager(
|
my $h = new Lemonldap::NG::Manager(
|
||||||
{
|
{
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => "__CONFDIR__",
|
|
||||||
},
|
|
||||||
dhtmlXTreeImageLocation => "/imgs/",
|
dhtmlXTreeImageLocation => "/imgs/",
|
||||||
applyConfFile => '__DIR__/manager/apply.conf',
|
applyConfFile => '__APPLYCONFFILE__',
|
||||||
cssFile => 'theme/default.css',
|
cssFile => 'theme/default.css',
|
||||||
textareaW => 50,
|
textareaW => 50,
|
||||||
textareaH => 2,
|
textareaH => 2,
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
CREATE TABLE lmConfig (
|
|
||||||
cfgNum int not null primary key,
|
|
||||||
locationRules text,
|
|
||||||
exportedHeaders text,
|
|
||||||
globalStorage text,
|
|
||||||
globalStorageOptions text,
|
|
||||||
macros text,
|
|
||||||
groups text,
|
|
||||||
portal text,
|
|
||||||
domain text,
|
|
||||||
ldapServer text,
|
|
||||||
ldapPort int,
|
|
||||||
ldapBase text,
|
|
||||||
securedCookie int,
|
|
||||||
cookieName text,
|
|
||||||
authentication text,
|
|
||||||
exportedVars text,
|
|
||||||
managerDn text,
|
|
||||||
managerPassword text,
|
|
||||||
timeout int,
|
|
||||||
whatToTrace text
|
|
||||||
);
|
|
|
@ -11,12 +11,7 @@ our $editFile = `mktemp`;
|
||||||
chomp $refFile;
|
chomp $refFile;
|
||||||
chomp $editFile;
|
chomp $editFile;
|
||||||
|
|
||||||
my $conf = Lemonldap::NG::Common::Conf->new(
|
my $conf = Lemonldap::NG::Common::Conf->new();
|
||||||
{
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
open F1, ">$refFile" or quit($!);
|
open F1, ">$refFile" or quit($!);
|
||||||
open F2, ">$editFile" or quit($!);
|
open F2, ">$editFile" or quit($!);
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
# Set here the session storage you use
|
|
||||||
$sessionStorage = 'Apache::Session::File';
|
|
||||||
$sessionStorageOptions = {
|
|
||||||
Directory => '__SESSIONDIR__',
|
|
||||||
};
|
|
||||||
|
|
||||||
############
|
|
||||||
usage() unless($ARGV[0]);
|
|
||||||
|
|
||||||
eval "use $sessionStorage";
|
|
||||||
die $@ if($@);
|
|
||||||
|
|
||||||
tie %h, $sessionStorage, $ARGV[0], $sessionStorageOptions;
|
|
||||||
|
|
||||||
print "Attributes and macros :\n";
|
|
||||||
my @t = sort keys(%h);
|
|
||||||
print "$_ " foreach(@t);
|
|
||||||
print "\n";
|
|
||||||
foreach my $k ( sort keys(%h) ) {
|
|
||||||
next if($k eq 'groups');
|
|
||||||
print "\t$k\t=> $h{$k}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $h{groups} ) {
|
|
||||||
print "Groups :\n";
|
|
||||||
print "\t$_\n" foreach( sort split /\s+/, $h{groups} );
|
|
||||||
}
|
|
|
@ -5,20 +5,6 @@ use strict;
|
||||||
use Lemonldap::NG::Manager::Sessions;
|
use Lemonldap::NG::Manager::Sessions;
|
||||||
|
|
||||||
our $cgi = Lemonldap::NG::Manager::Sessions->new({
|
our $cgi = Lemonldap::NG::Manager::Sessions->new({
|
||||||
localStorage => "Cache::FileCache",
|
|
||||||
localStorageOptions => {
|
|
||||||
'namespace' => 'MyNamespace',
|
|
||||||
'default_expires_in' => 600,
|
|
||||||
'directory_umask' => '007',
|
|
||||||
'cache_root' => '/tmp',
|
|
||||||
'cache_depth' => 5,
|
|
||||||
},
|
|
||||||
# Use configStorage with Debian
|
|
||||||
#configStorage => $Lemonldap::NG::Conf::configStorage,
|
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => "__CONFDIR__",
|
|
||||||
},
|
|
||||||
https => 0,
|
https => 0,
|
||||||
jqueryUri => 'jquery.js',
|
jqueryUri => 'jquery.js',
|
||||||
imagePath => '/images/',
|
imagePath => '/images/',
|
||||||
|
|
|
@ -2,11 +2,6 @@
|
||||||
|
|
||||||
use Lemonldap::NG::Manager::SOAPServer;
|
use Lemonldap::NG::Manager::SOAPServer;
|
||||||
|
|
||||||
Lemonldap::NG::Manager::SOAPServer->start(
|
Lemonldap::NG::Manager::SOAPServer->start();
|
||||||
configStorage => {
|
|
||||||
type => "File",
|
|
||||||
dirName => "__CONFDIR__"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
|
|
@ -10,11 +10,6 @@ use Lemonldap::NG::Portal::AuthLA;
|
||||||
|
|
||||||
my $portal = Lemonldap::NG::Portal::AuthLA->new(
|
my $portal = Lemonldap::NG::Portal::AuthLA->new(
|
||||||
{
|
{
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
|
|
||||||
# Liberty Parameters
|
# Liberty Parameters
|
||||||
laSp => {
|
laSp => {
|
||||||
certificate => "__DIR__/ressources/lemonsp-key-public.pem",
|
certificate => "__DIR__/ressources/lemonsp-key-public.pem",
|
||||||
|
|
|
@ -80,12 +80,7 @@ print $cgi->header(
|
||||||
|
|
||||||
print "LEMONLDAP::NG::PORTAL STATUS\n\nConfiguration : ";
|
print "LEMONLDAP::NG::PORTAL STATUS\n\nConfiguration : ";
|
||||||
|
|
||||||
my $lmconf = Lemonldap::NG::Common::Conf->new(
|
my $lmconf = Lemonldap::NG::Common::Conf->new();
|
||||||
{
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
unless ($lmconf) {
|
unless ($lmconf) {
|
||||||
print "unable to create conf object\n";
|
print "unable to create conf object\n";
|
||||||
|
|
|
@ -3,15 +3,9 @@ use Lemonldap::NG::Portal::Error;
|
||||||
use HTML::Template;
|
use HTML::Template;
|
||||||
|
|
||||||
my $skin = "pastel";
|
my $skin = "pastel";
|
||||||
my $skin_dir = "__DIR__/portal/skins/";
|
my $skin_dir = "__SKINDIR__";
|
||||||
|
|
||||||
my $portal = Lemonldap::NG::Portal::Error->new(
|
my $portal = Lemonldap::NG::Portal::Error->new();
|
||||||
{
|
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
my $portal_url = $portal->getPortal;
|
my $portal_url = $portal->getPortal;
|
||||||
my $logout_url = "$portal_url?logout=1";
|
my $logout_url = "$portal_url?logout=1";
|
||||||
|
|
|
@ -4,10 +4,6 @@ use Lemonldap::NG::Portal::SharedConf;
|
||||||
|
|
||||||
my $portal = Lemonldap::NG::Portal::SharedConf->new(
|
my $portal = Lemonldap::NG::Portal::SharedConf->new(
|
||||||
{
|
{
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
#ldapPpolicyControl => 1, # Remove comment to use LDAP Password Policy
|
#ldapPpolicyControl => 1, # Remove comment to use LDAP Password Policy
|
||||||
#storePassword => 1, # Remove comment to store password in session (use with caution)
|
#storePassword => 1, # Remove comment to store password in session (use with caution)
|
||||||
#Soap => 1, # Remove comment to activate SOAP Function getCookies(user,pwd)
|
#Soap => 1, # Remove comment to activate SOAP Function getCookies(user,pwd)
|
||||||
|
|
|
@ -5,17 +5,12 @@ use HTML::Template;
|
||||||
|
|
||||||
# Path configuration
|
# Path configuration
|
||||||
my $skin = "pastel";
|
my $skin = "pastel";
|
||||||
my $skin_dir = "__DIR__/portal/skins";
|
my $skin_dir = "__SKINDIR__";
|
||||||
my $appsxmlfile = "__SYSCONFDIR__/apps-list.xml";
|
my $appsxmlfile = "__APPSXMLFILE__";
|
||||||
my $appsimgpath = "apps/";
|
my $appsimgpath = "apps/";
|
||||||
|
|
||||||
my $portal = Lemonldap::NG::Portal::SharedConf->new(
|
my $portal = Lemonldap::NG::Portal::SharedConf->new(
|
||||||
{
|
{
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
existingSession => sub { PE_DONE }, # Required to display the menu to a connected user
|
|
||||||
#ldapPpolicyControl => 1, # Remove comment to use LDAP Password Policy
|
#ldapPpolicyControl => 1, # Remove comment to use LDAP Password Policy
|
||||||
#storePassword => 1, # Remove comment to store password in session (use with caution)
|
#storePassword => 1, # Remove comment to store password in session (use with caution)
|
||||||
#Soap => 1, # Remove comment to activate SOAP Function getCookies(user,pwd)
|
#Soap => 1, # Remove comment to activate SOAP Function getCookies(user,pwd)
|
||||||
|
|
|
@ -9,12 +9,7 @@ use Lemonldap::NG::Common::Conf::Constants;
|
||||||
use Lemonldap::NG::Common::Apache::Session;
|
use Lemonldap::NG::Common::Apache::Session;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my $lmconf = Lemonldap::NG::Common::Conf->new(
|
my $lmconf = Lemonldap::NG::Common::Conf->new();
|
||||||
{
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
my $conf = $lmconf->getConf or die "Unable to get configuration ($!)";
|
my $conf = $lmconf->getConf or die "Unable to get configuration ($!)";
|
||||||
|
|
||||||
|
|
|
@ -40,13 +40,6 @@ use Lemonldap::NG::Portal::CDA;
|
||||||
|
|
||||||
my $portal = Lemonldap::NG::Portal::CDA->new(
|
my $portal = Lemonldap::NG::Portal::CDA->new(
|
||||||
{
|
{
|
||||||
|
|
||||||
# configStorage ADAPT IT as usual
|
|
||||||
configStorage => {
|
|
||||||
type => 'File',
|
|
||||||
dirName => '__CONFDIR__',
|
|
||||||
},
|
|
||||||
|
|
||||||
# SUBROUTINES OVERLOAD
|
# SUBROUTINES OVERLOAD
|
||||||
# 2 cases :
|
# 2 cases :
|
||||||
# 1 - If LDAP search is not needed (the master SSO gives all
|
# 1 - If LDAP search is not needed (the master SSO gives all
|
||||||
|
|
Loading…
Reference in New Issue
Block a user