alterator-auth-0.6/000075500000000000000000000000001111743703100143075ustar00rootroot00000000000000alterator-auth-0.6/Makefile000064400000000000000000000001721111743703100157470ustar00rootroot00000000000000NAME=auth INSTALL=/usr/bin/install all: clean: install: install-module include /usr/share/alterator/build/module.mak alterator-auth-0.6/applications/000075500000000000000000000000001111743703100167755ustar00rootroot00000000000000alterator-auth-0.6/applications/auth.desktop000064400000000000000000000002551111743703100213330ustar00rootroot00000000000000[Desktop Entry] Type=Application Categories=X-Alterator-Users Icon=auth Terminal=false Name=Authentication X-Alterator-URI=/auth X-Alterator-Weight=20 X-Alterator-Help=auth alterator-auth-0.6/backend3/000075500000000000000000000000001111743703100157615ustar00rootroot00000000000000alterator-auth-0.6/backend3/auth000075500000000000000000000052551111743703100166570ustar00rootroot00000000000000#!/bin/sh #common part po_domain="alterator-auth" ldap_uri_re='^(ldap|ldapi|ldaps)://[.a-zA-Z0-9_-]+$' rdelim='[[:space:]]\+' wdelim=' ' #pam configuration pamldapfile="/etc/pam_ldap.conf" #nss configuration nssldapfile= nssldapfile1="/etc/nss_ldap.conf" nssldapfile2="/etc/nss-ldapd.conf" nsswitchfile="/etc/nsswitch.conf" #select between nss_ldap and nss_ldapd [ -f "$nssldapfile1" ] && nssldapfile="$nssldapfile1" [ -f "$nssldapfile2" ] && nssldapfile="$nssldapfile2" . alterator-sh-functions . shell-config #turn off auto expansion set -f list_profile() { write_enum_item "local" "`_ "Local files"`" [ -n "$(find /$(getconf SLIB)/security -name 'pam_ldap.*')" ] && [ -n "$(find /$(getconf SLIB) -name 'libnss_ldap.so.*')" ] && write_enum_item "ldap" "`_ "LDAP"`" } read_profile() { /usr/sbin/control system-auth } write_nsswitch() { shell_config_set "$nsswitchfile" "$1:" "$2" "$rdelim" "$wdelim" } write_profile() { /usr/sbin/control system-auth "$1" && case "$1" in local) write_nsswitch "passwd" "files" write_nsswitch "shadow" "tcb files" write_nsswitch "group" "files" ;; ldap) write_nsswitch "passwd" "files ldap" write_nsswitch "shadow" "tcb files ldap" write_nsswitch "group" "files ldap" ;; esac } read_ldap() { shell_config_get "$1" "$2" "$rdelim" } write_ldap() { shell_config_set "$1" "$2" "$3" "$rdelim" "$wdelim" } #syncronyous config change read_ldap2() { read_ldap "$pamldapfile" "$1" } write_ldap2() { write_ldap "$pamldapfile" "$1" "$2" && write_ldap "$nssldapfile" "$1" "$2" } del_ldap() { shell_config_del "$1" "$2" "$rdelim" } del_ldap2() { del_ldap "$pamldapfile" "$1" && del_ldap "$nssldapfile" "$1" } #initial settings del_ldap2 host [ ! -s "$nssldapfile1" ] || write_ldap "$nssldapfile1" bind_policy soft [ ! -s "$nssldapfile1" ] || write_ldap "$nssldapfile1" bind_timelimit 30 on_message() { case "$in_action" in constraints) echo '(' printf 'ldap_uri (label "%s" match ("%s" "%s"))' \ "`_ "LDAP server"`" \ "$ldap_uri_re" \ "`_ "should be ldap://host or ldapi://host or ldaps://host"`" echo ')' ;; list) echo '(' [ "$in__objects" = "avail_profile" ] && list_profile echo ')' ;; read) echo '(' write_string_param profile "$(read_profile)" write_string_param ldap_uri "$(read_ldap2 uri)" write_string_param ldap_basedn "$(read_ldap2 base)" echo ')' ;; write) [ -n "$in_profile" ] && write_profile "$in_profile" [ -n "$in_ldap_uri" ] && write_ldap2 uri "$in_ldap_uri" [ -n "$in_ldap_basedn" ] && write_ldap2 base "$in_ldap_basedn" write_nop ;; *) echo '#f' ;; esac } message_loop alterator-auth-0.6/templates/000075500000000000000000000000001111743703100163055ustar00rootroot00000000000000alterator-auth-0.6/templates/auth/000075500000000000000000000000001111743703100172465ustar00rootroot00000000000000alterator-auth-0.6/templates/auth/index.html000064400000000000000000000021751111743703100212500ustar00rootroot00000000000000
Auth type:
LDAP server:
Base DN:
 
   

alterator-auth-0.6/ui/000075500000000000000000000000001111743703100147245ustar00rootroot00000000000000alterator-auth-0.6/ui/auth/000075500000000000000000000000001111743703100156655ustar00rootroot00000000000000alterator-auth-0.6/ui/auth/index.scm000064400000000000000000000031151111743703100175000ustar00rootroot00000000000000(document:surround "/std/base") (document:insert "/std/functions") (document:envelop with-translation _ "alterator-auth") ;;; Functions (define (read-profile) (woo-catch/message (thunk (profile-id enumref "/auth/avail_profile") (let ((data (woo-read-first "/auth"))) (ldap-uri value (woo-get-option data 'ldap_uri)) (ldap-basedn value (woo-get-option data 'ldap_basedn)) (profile-id value (woo-get-option data 'profile)))))) (define (write-profile) (woo-catch/message (thunk (woo-write/constraints "/auth" 'profile (profile-id value) 'ldap_uri (ldap-uri value) 'ldap_basedn (ldap-basedn value))))) ;;; UI (gridbox columns "10;0;80;10" (spacer) (label text (_ "Auth type:") align "right") (document:id profile-id (combobox name "profile")) (spacer) (label colspan 4) (spacer) (document:id ldap-uri-label (label text (_ "LDAP server:") align "right" name "ldap_uri" visibility #f)) (document:id ldap-uri (edit name "ldap_uri" visibility #f)) (spacer) (spacer) (document:id ldap-basedn-label (label text (_ "Base DN:") align "right" name "ldap_basedn" visibility #f)) (document:id ldap-basedn (edit name "ldap_basedn" visibility #f)) (spacer) (label colspan 4) (spacer) (spacer) (hbox align "left" (button text (_ "Apply") (when clicked (write-profile))) (button text (_ "Reset") (when clicked (read-profile) (update-effect)))) (spacer)) ;;; Logic (effect-show "ldap_uri" "profile" "ldap") (effect-show "ldap_basedn" "profile" "ldap") (document:root (when loaded (and (read-profile) (init-effect))))