Module: check_mk
Branch: master
Commit: 801def8008bb98b736fce22035d73239f8abe6ec
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=801def8008bb98…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Sep 5 13:11:39 2017 +0200
Dropped obsolete code
Change-Id: Ie9deeb6c18921731b2494fdc510e5b5c64bebd61
---
web/plugins/userdb/ldap.py | 108 ---------------------------------------------
1 file changed, 108 deletions(-)
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 2559766..c933175 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -334,114 +334,6 @@ class LDAPUserConnector(UserConnector):
return domain
-
- # Active directory only: This function tries to detect the nearest domain controller
of the
- # AD found when connecting to the given server. It works as follows:
- #
- # 1. A connection is established with the configured server. Normally this is the
- # DNS name of the AD domain. For this connection a "random DC" is used.
In fact
- # the given name is locally resolved using DNS and one answered IP is picked.
- # 2. The authentication with the default credentials is done.
- # 3. The AD site of the local system is detected.
- # This is done by gathering the local IP subnets of the Check_MK server, then all
subnets
- # configured in the domain are fetched and all matching subnets are collected.
Then the
- # subnets are sorted by their size.
- # 4. The domain controllers of the AD sites associated with the matched, sorted sites
are
- # are fetched from the AD
- # 5. A random DC of the found AD site is used instead of "server".
- #
- # In case the detection does not work the "server" that has been handed
over to this
- # function is used.
- #def _discover_nearest_dc(self, server):
- # matched_site_dns = self._find_site_distinguished_names()
- # if not matched_site_dns:
- # self.log(" DISCOVERY: Found no site distinguished names matching the
"
- # "Check_MK servers IP range -> Skipping discovery")
- # return server
-
- # self.log("%r" % matched_site_dns)
-
- # for site_dn in matched_site_dns:
- # # Get list of DCs for this site
- # results = self.ldap_search("CN=SERVERS,%s" % site_dn,
- # filt="(objectclass=server)",
- # columns=["dnshostname"],
- # implicit_connect=False)
-
- # if not results:
- # continue # Maybe there is another site to lookup
-
- # for server_dn, attrs in results:
- # return attrs["dnshostname"][0] # In case there are multiple,
use the first one
-
- # self.log(" DISCOVERY: Found no DC for the sites: %r -> Skipping
discovery" % matched_site_dns)
- # return server
-
-
- #def _find_site_distinguished_names(self):
- # server_subnets = self._subnets_of_check_mk_server()
-
- # if not server_subnets:
- # self.log(" DISCOVERY: Failed to get the Check_MK server
subnets")
- # return []
-
- # domain_subnet_map = self._subnets_of_domain()
-
- # if not domain_subnet_map:
- # self.log(" DISCOVERY: Found no domain subnets")
- # return []
-
- # # Now get all nets from domain_subnet_map that match the Check_MK server
subnets
- # import ipaddress
-
- # matched = []
- # for subnet_txt in server_subnets:
- # server_subnet = ipadress.IPv4Network(subnet_txt)
-
- # for domain_subnet_txt, site_dn in domain_subnet_map.items():
- # domain_subnet = ipadress.IPv4Network(domain_subnet_txt)
- # if server_subnet == domain_subnet or
server_subnet.subnet_of(domain_subnet):
- # matched.append((domain_subnet.prefixlen, site_dn))
-
- # # And sort them by their network size: Smallest subnets first
- # return [ e[1] for e in sorted(matched) ]
-
-
- #def _subnets_of_check_mk_server(self):
- # subnets = []
-
- # import netifaces, ipaddress
- # for network_interface in netifaces.interfaces():
- # for link in netifaces.ifaddresses(network_interface).get(netifaces.AF_INET,
[]):
- # ip_interface = ipaddress.IPv4Interface("%s/%s" %
(link["addr"], link["netmask"]))
- # network_addr = "%s" % ip_interface.network
- # if not network_addr.startswith("127."):
- # subnets.append(network_addr)
-
- # return subnets
-
-
- #def _subnets_of_domain(self):
- # domain_dn = self.get_forest_root_domain_dn()
- # subnet_dn = "CN=Subnets,CN=Sites,CN=Configuration,%s" % domain_dn
-
- # results = self.ldap_search(subnet_dn,
- # filt='(&(objectclass=subnet))',
- # columns=["cn", "siteobject"],
- # implicit_connect=False)
-
- # if not results:
- # return []
-
- # subnets = {}
- # for subnet_dn, attrs in results:
- # site_dn = attrs["siteobject"][0]
- # cn = attrs["cn"][0]
- # subnets[cn] = site_dn
-
- # return subnets
-
-
# Bind with the default credentials
def default_bind(self, conn):
try: