예제 #1
0
 def __init__(self, method, requestInfo, responseInfo, sessionKey):
     splunk.rest.BaseRestHandler.__init__(self,
                                         method,
                                         requestInfo,
                                         responseInfo,
                                         sessionKey)
     # Default values
     self._allowRemote = True
     self._login = LOGIN_URL
     self._base = DEFAULT_URL
     self._agent = None
     self._platformInfo = None
     try:
         platform_info = platform.platform()
         os_name = platform.system()
         arch = platform.machine()
         py_ver = urllib.URLopener().version
         with open(os.path.join(bundle_paths.etc(), "splunk.version")) as f:
             for i in f:
                 if i.startswith("VERSION"):
                     version = i.split("=")[1].strip().strip('"')
                 elif i.startswith("BUILD"):
                     build = i.split("=")[1].strip()
         self._agent = "Splunkd/%s (%s; version=%s; arch=%s; build=%s; %s)" % (version, os_name, platform_info, arch, build, py_ver)
         self._platformInfo = {'version': version, 'platform': os_name}
     except Exception, e:
         logger.exception(e)
예제 #2
0
def splunk_etc():
        return bundle_paths.etc()
예제 #3
0
 def __init__(self, method, requestInfo, responseInfo, sessionKey):
     splunk.rest.BaseRestHandler.__init__(self, method, requestInfo,
                                          responseInfo, sessionKey)
     # Default values
     self._allowRemote = True
     self._login = LOGIN_URL
     self._base = DEFAULT_URL
     self._agent = None
     self._platformInfo = None
     self._supportInProductInstall = True
     self._sslpol = bundle_paths.SSLPolicy()
     try:
         platform_info = platform.platform()
         os_name = platform.system()
         arch = platform.machine()
         py_ver = URLopener().version
         with open(os.path.join(bundle_paths.etc(), "splunk.version")) as f:
             for i in f:
                 if i.startswith("VERSION"):
                     version = i.split("=")[1].strip().strip('"')
                 elif i.startswith("BUILD"):
                     build = i.split("=")[1].strip()
         self._agent = "Splunkd/%s (%s; version=%s; arch=%s; build=%s; %s)" % (
             version, os_name, platform_info, arch, build, py_ver)
         self._platformInfo = {'version': version, 'platform': os_name}
     except Exception as e:
         logger.exception(e)
     # Manual overrides in server.conf
     try:
         conf = bundle.getConf("server", self.sessionKey)
         s = conf["applicationsManagement"]
         if not s.isDisabled():
             if "allowInternetAccess" in s:
                 self._allowRemote = bundle_paths.parse_boolean(
                     s["allowInternetAccess"])
             if "loginUrl" in s:
                 self._login = s["loginUrl"]
             if "url" in s:
                 self._base = s["url"]
             if "useragent" in s:
                 self._agent = s["useragent"]
             if "caCertFile" in s:
                 self._sslpol._cafile = bundle_paths.expandvars(
                     s["caCertFile"])
             if "sslCommonNameList" in s:
                 self._sslpol._sslCommonNameList = bundle_paths.expandvars(
                     s["sslCommonNameList"])
             if "cipherSuite" in s:
                 self._sslpol._cipherSuite = bundle_paths.expandvars(
                     s["cipherSuite"])
         s = conf["shclustering"]
         if not s.isDisabled():
             self._supportInProductInstall = False
     except Exception as e:
         logger.exception(e)
     logger.debug("applicationsManagement.allowInternetAccess = %s" %
                  str(self._allowRemote))
     logger.debug("applicationsManagement.loginUrl = %s" % self._login)
     logger.debug("applicationsManagement.url = %s" % self._base)
     logger.debug("applicationsManagement.useragent = %s" % self._agent)
     logger.debug("applicationsManagement.supportInProductInstall = %s" %
                  str(self._supportInProductInstall))
     if self._sslpol._cafile is None:
         logger.debug("applicationsManagement.caCertFile = %s" %
                      str(self._sslpol._cafile))
     if self._sslpol._sslCommonNameList is None:
         logger.debug("applicationsManagement.sslCommonNameList = %s" %
                      str(self._sslpol._sslCommonNameList))
     if self._sslpol._cipherSuite is None:
         logger.debug("applicationsManagement.cipherSuite = %s" %
                      str(self._sslpol._cipherSuite))
예제 #4
0
def splunk_etc():
    return bundle_paths.etc()