cn => dn
Default configuration
This commit is contained in:
parent
766adcda50
commit
8ad91b74b6
19
config
19
config
@ -27,7 +27,7 @@ stock = utf-8
|
|||||||
|
|
||||||
[acl]
|
[acl]
|
||||||
# Access method
|
# Access method
|
||||||
# Value: fake | htpasswd
|
# Value: fake | htpasswd | authLdap
|
||||||
type = fake
|
type = fake
|
||||||
# Personal calendars only available for logged in users (if needed)
|
# Personal calendars only available for logged in users (if needed)
|
||||||
personal = False
|
personal = False
|
||||||
@ -37,9 +37,26 @@ filename = /etc/radicale/users
|
|||||||
# Value: plain | sha1 | crypt
|
# Value: plain | sha1 | crypt
|
||||||
encryption = crypt
|
encryption = crypt
|
||||||
|
|
||||||
|
[authLdap]
|
||||||
|
#LDAP Host
|
||||||
|
LDAPServer = 127.0.0.1
|
||||||
|
#Fields to create a LDAP bind
|
||||||
|
#Value to add before the user name in a LDAP bind
|
||||||
|
LDAPPrepend = uid=
|
||||||
|
#Value to add after the user name in a LDAP bind
|
||||||
|
LDAPAppend = ou=users,dc=exmaple,dc=dom
|
||||||
|
#=> uid=corentin,ou=users,dc=exmaple,dc=dom
|
||||||
|
|
||||||
[storage]
|
[storage]
|
||||||
# Folder for storing local calendars,
|
# Folder for storing local calendars,
|
||||||
# created if not present
|
# created if not present
|
||||||
folder = ~/.config/radicale/calendars
|
folder = ~/.config/radicale/calendars
|
||||||
|
|
||||||
|
[logging]
|
||||||
|
# Full path of logfile
|
||||||
|
file = ~/.config/radicale/radicale.log
|
||||||
|
# Logging messages which are less severe than level will be ignored
|
||||||
|
# Log level are (debug, info, warning, error, critical)
|
||||||
|
level = error
|
||||||
|
|
||||||
# vim:ft=cfg
|
# vim:ft=cfg
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys, ldap
|
import sys, ldap, syslog
|
||||||
|
|
||||||
from radicale import config
|
from radicale import config, log
|
||||||
|
|
||||||
def has_right(owner, user, password):
|
def has_right(owner, user, password):
|
||||||
if user == None:
|
if user == None:
|
||||||
@ -13,10 +13,11 @@ def has_right(owner, user, password):
|
|||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
l=ldap.open(LDAPSERVER, 389)
|
l=ldap.open(LDAPSERVER, 389)
|
||||||
cn="%s%s,%s" % (LDAPPREPEND, user, LDAPAPPEND)
|
dn="%s%s,%s" % (LDAPPREPEND, user, LDAPAPPEND)
|
||||||
l.simple_bind_s(cn, password);
|
l.simple_bind_s(dn, password);
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
|
log.error(sys.exc_info()[0])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
LDAPSERVER = config.get("authLdap", "LDAPServer")
|
LDAPSERVER = config.get("authLdap", "LDAPServer")
|
||||||
|
@ -56,7 +56,15 @@ INITIAL_CONFIG = {
|
|||||||
"filename": "/etc/radicale/users",
|
"filename": "/etc/radicale/users",
|
||||||
"encryption": "crypt"},
|
"encryption": "crypt"},
|
||||||
"storage": {
|
"storage": {
|
||||||
"folder": os.path.expanduser("~/.config/radicale/calendars")}}
|
"folder": os.path.expanduser("~/.config/radicale/calendars")},
|
||||||
|
"authLdap": {
|
||||||
|
"LDAPServer": "127.0.0.1",
|
||||||
|
"LDAPPrepend": "uid=",
|
||||||
|
"LDAPAppend": "ou=users,dc=example,dc=com"},
|
||||||
|
"logging": {
|
||||||
|
"file": os.path.expanduser("~/.config/radicale/radicale.log"),
|
||||||
|
"level": "error"}
|
||||||
|
}
|
||||||
|
|
||||||
# Create a ConfigParser and configure it
|
# Create a ConfigParser and configure it
|
||||||
_CONFIG_PARSER = ConfigParser()
|
_CONFIG_PARSER = ConfigParser()
|
||||||
|
Loading…
Reference in New Issue
Block a user