【问题标题】:Maintenance Mode to one computer in Application Control inside Deep Security 12趋势科技服务器深度安全防护系统 12 内的应用程序控制中的一台计算机的维护模式
【发布时间】:2020-03-26 13:46:59
【问题描述】:

我正在尝试使用此 Python 脚本通过 API 将计算机置于 Deep Security 12 内的应用程序控制模块中的维护模式:

#

import deepsecurity as api
from deepsecurity.rest import ApiException as api_exception
import time, sys, warnings, pprint
import urllib3
urllib3.disable_warnings()

# Setup
configuration = api.Configuration()
configuration.host = 'https://xxxxxxxxxxxx.xxxxxxx.com:4119/api'

# Authentication
configuration.api_key['api-secret-key'] = 'xxxxxxxxxxxxxxxxxxx'

#Initialization
computer_id = "989"
api_version = 'v1'

def turn_on_maintenance_mode():

  # Create and configure an ApplicationControlComputerExtesnion object
  application_control = api.ApplicationControlComputerExtension()
  application_control.maintenance_mode_status = "on"
  application_control.maintenance_mode_duration = "0"

  # Add the ApplicationControlComputerExtension to a Computer object
  computer = api.Computer()
  computer.application_control_computer_extension = application_control

  try: 
    # Update the computer
    computers_api = api.ComputersApi(api.ApiClient(configuration))
    return computers_api.modify_computer(computer_id, computer, api_version)

  except api_exception as e:
    return "Exception: " + str(e)

if __name__ == '__main__':
  turn_on_maintenance_mode()

脚本执行没有任何错误,并且计算机接收到策略更改(因此与 API 和这台计算机的通信正常),但计算机没有将自身置于维护模式。

对正在发生的事情有什么想法吗?

提前致谢!

【问题讨论】:

  • 您好,您已将维护模式的持续时间设置为 0 -- 尝试增加 application_control.maintenance_mode_duration 的值
  • 您好,感谢您的留言。我尝试过其他值,如 15、“15”、“15”等。结果相同。

标签: deepsecurity


【解决方案1】:

computer.application_control_computer_extension = application_control

应该是:

computer.application_control = application_control

自动化中心文章中的示例 python 代码似乎不正确。应该很快就会更新了。

【讨论】:

  • 是的,你是对的!这就是问题所在。非常感谢!
  • @ManU 如果这个答案解决了你的问题,你可以选择“接受”它是正确的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-02-02
  • 1970-01-01
  • 2017-09-05
  • 2015-05-03
  • 2017-06-20
  • 2020-06-01
  • 2013-10-04
相关资源
最近更新 更多