Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37847706
en ru br
Репозитории ALT
S:0.44.5-alt1
5.1: 0.10-alt2
4.1: 0.6-alt3.M41.4
4.0: 0.3-alt1.M40.2
www.altlinux.org/Changes

Группа :: Система/Настройка/Прочее
Пакет: alterator-auth

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

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<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!-- authentication administration module -->
<html wf="form">
<head>
<script>
effectShow("ldap_uri","profile","ldap");
effectShow("ldap_basedn", "profile", "ldap");
</script>
</head>
<body>
<form method="POST">
<table class="form-table">
<tr>
<td><span translate="_">Auth type:</span></td>
<td>
<select name="profile" enumref="/auth/avail_profile"/>
</td>
</tr>
<tr>
<td><span style="display:none" translate="_" name="ldap_uri">LDAP server:</span></td>
<td><input style="display:none" type="text" class="text" name="ldap_uri"/></td>
</tr>
<tr>
<td><span style="display:none" translate="_" name="ldap_basedn">Base DN:</span></td>
<td><input style="display:none" type="text" class="text" name="ldap_basedn"/></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="submit" value="Apply" class="btn"/>&nbsp;
<input type="reset" value="Reset" class="btn"/>
</td>
</tr>
</table>
<br/>
</form>
</body>
</html>
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))))
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin