pykolab/setup
Daniel Hoffend
hoffend at kolabsys.com
Tue Feb 24 23:23:20 CET 2015
pykolab/setup/setup_freebusy.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
New commits:
commit e3f7ca606bbfc853cf3025f363e1f338dec668fe
Author: Daniel Hoffend <dh at dotlan.net>
Date: Tue Feb 24 23:23:12 2015 +0100
enable httpauth + trust localips for freebusy service
diff --git a/pykolab/setup/setup_freebusy.py b/pykolab/setup/setup_freebusy.py
index 34784ed..947e1fb 100644
--- a/pykolab/setup/setup_freebusy.py
+++ b/pykolab/setup/setup_freebusy.py
@@ -21,6 +21,7 @@ from ConfigParser import RawConfigParser
import os
import sys
import time
+import socket
from urlparse import urlparse
import components
@@ -92,6 +93,17 @@ def execute(*args, **kw):
users_imap_uri = '%s://%%s:%s@%s:%s/?proxy_auth=%s' % (scheme, admin_password, hostname, port, admin_login)
freebusy_settings = {
+ 'httpauth': {
+ 'type': 'ldap',
+ 'host': conf.get('ldap', 'ldap_uri'),
+ 'base_dn': conf.get('ldap', 'base_dn'),
+ 'bind_dn': conf.get('ldap', 'service_bind_dn'),
+ 'bind_pw': conf.get('ldap', 'service_bind_pw'),
+ 'filter': '(&(objectClass=kolabInetOrgPerson)(|(mail=%s)(alias=%s)(uid=%s)))',
+ },
+ 'trustednetworks': {
+ 'allow': ','.join(get_local_ips())
+ },
'directory "local"': {
'type': 'static',
'fbsource': 'file:/var/lib/kolab-freebusy/%s.ifb',
@@ -167,3 +179,13 @@ def execute(*args, **kw):
cfg_parser.write(fp)
fp.close()
+def get_local_ips():
+ ips = ['::1','127.0.0.1']
+ for family in [socket.AF_INET, socket.AF_INET6]:
+ try:
+ for ip in socket.getaddrinfo(socket.getfqdn(), None, family):
+ if ip[4][0] not in ips:
+ ips.append(ip[4][0])
+ except:
+ pass
+ return ips
More information about the commits
mailing list