0

当我调用 DSM api 端点“describe_anti_malware(api_version)”(Python SDK)时,我得到:

An exception occurred when calling AntiMalwareConfigurationsApi.search_anti_malwares: (500)
Reason:
HTTP response headers: HTTPHeaderDict({'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection':'1;mode=block', 'Cache-Control': 'no-cache,no-store', 'Pragma': 'no-cache', 'X-DSM-Version': 'Deep Security/12.0.393', 'Content-Type': 'application/json', 'Content-Length': '35', 'Date': 'Wed, 26 Aug 2020 08:02:32 GMT', 'Connection': 'close'})
HTTP response body: {"message":"Internal server error"}

但这仅发生在少数配置 id 上,其他我收到没有问题。同样的问题出现在'list_anti_malwares(api_version)'(NullPointer Exception)

我尝试了 AntiMalwareConfig。搜索端点也是如此,但会出现同样的问题。

TMDS 版本是 12.0.393 ,API 版本是 12.0.0

非常感谢你的帮助!

问候桑德罗

日志输出:


        Aug 25, 2020 11:46:50.895000000 AM [+0200] unknown unknown
    SEVERE: ThID:128524|TID:0|TNAME:Primary|UID:21|UNAME:SAPO01|REST API method at /antimalwareconfigurations/51 encountered error
    java.lang.NullPointerException
        at com.trendmicro.ds.api.base.antimalwareconfiguration.impl.AntiMalwareConfigurationAPI.convert(AntiMalwareConfigurationAPI.java:524)
        at com.trendmicro.ds.api.base.antimalwareconfiguration.impl.AntiMalwareConfigurationAPI.describeAntiMalware(AntiMalwareConfigurationAPI.java:165)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:294)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:248)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:235)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:402)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:209)
        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:470)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316)
        at com.trendmicro.ds.api.VersionRouterFilter.doFilter(VersionRouterFilter.java:116)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.filters.RemoteIpFilter.doFilter(RemoteIpFilter.java:885)
        at org.apache.catalina.filters.RemoteIpFilter.doFilter(RemoteIpFilter.java:942)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at com.thirdbrigade.manager.webclient.HttpRequestFilter.doFilter(HttpRequestFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at com.thirdbrigade.manager.webclient.HttpResponseFilter.doFilter(HttpResponseFilter.java:73)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at com.thirdbrigade.manager.webclient.CookieFilter.doFilter(CookieFilter.java:40)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)

我的代码片段(几乎与API-Doc示例中的相同):

anti_malware_api = deepsecurity.AntiMalwareConfigurationsApi(api_client)

try:
    amc_id = 12
    anti_malware = anti_malware_api.describe_anti_malware(amc_id, API_VERSION)
    if SAVE_SINGLE_FILES:
        with open(f'anti_malware_{amc_id}.txt', 'w') as outfile:
            json.dump(anti_malware.to_dict(), outfile)
except ApiException as e:   
    print("An exception occurred when calling AntiMalwareConfigurationsApi.list_anti_malwares: %s\n" % e)

我还注意到一些奇怪的事情,当我在 Web 界面中重新保存 AntiMalwareConfig(即使没有更改字段),然后可以通过 API 访问配置。

4

1 回答 1

0

事实证明,问题出在数据库中。某些设置为 Null 的 ScanActionForAtseLevel2 并且 API 无法处理。

Update [DSM].[dbo].[antimalware]
SET
ScanActionForAtseLevel2 = 1,
ScanActionForAtseLevel3 = 1,
ScanActionForAtseLevel4 = 1
WHERE
ScanActionForAtseLevel2 IS NULL

我认为 dsm 更新导致了这个问题。

于 2020-08-31T12:01:04.763 回答