fortinet.fortimanager.fmgr_pkg_firewall_consolidated_policy 模块 – 配置整合的 IPv4/IPv6 策略。

注意

此模块是 fortinet.fortimanager 集合 (版本 2.8.2) 的一部分。

如果您正在使用 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install fortinet.fortimanager

要在 playbook 中使用它,请指定: fortinet.fortimanager.fmgr_pkg_firewall_consolidated_policy

fortinet.fortimanager 2.1.0 中的新增功能

概要

  • 此模块能够配置 FortiManager 设备。

  • 示例包括所有需要在使用前调整为数据源的参数和值。

参数

参数

注释

access_token

字符串

无需使用用户名和密码即可访问 FortiManager 的令牌。

adom

字符串 / 必需

请求 URL 中的参数 (adom)。

bypass_validation

布尔值

仅当模块模式与 FortiManager API 结构不同时设置为 True,模块将继续执行而无需验证参数。

选项

  • false ← (默认)

  • true

enable_log

布尔值

启用/禁用任务日志记录。

选项

  • false ← (默认)

  • true

forticloud_access_token

字符串

使用 FortiCloud API 访问令牌验证 Ansible 客户端。

pkg

字符串 / 必需

请求 URL 中的参数 (pkg)。

pkg_firewall_consolidated_policy

字典

设置的顶级参数。

_policy_block

整数

分配的策略块。

action

字符串

策略操作

选项

  • "deny"

  • "accept"

  • "ipsec"

app_category

别名:app-category

任意

(列表或字符串) 应用类别 ID 列表。

app_group

别名:app-group

任意

(列表或字符串) 应用组名称。

application

任意

(列表) 应用 ID 列表。

application_list

别名:application-list

字符串

现有应用列表的名称。

auto_asic_offload

别名:auto-asic-offload

字符串

启用/禁用将安全配置文件处理卸载到 CP 处理器。

选项

  • "disable"

  • "enable"

av_profile

别名:av-profile

字符串

现有防病毒配置文件的名称。

captive_portal_exempt

别名:captive-portal-exempt

字符串

启用免除某些用户受限门户。

选项

  • "disable"

  • "enable"

cifs_profile

别名:cifs-profile

字符串

现有 CIFS 配置文件的名称。

comments

字符串

注释。

diffserv_forward

别名:diffserv-forward

字符串

启用将数据包 DiffServ 值更改为指定的 diffservcode-forward 值。

选项

  • "disable"

  • "enable"

diffserv_reverse

别名:diffserv-reverse

字符串

启用更改数据包反向。

选项

  • "disable"

  • "enable"

diffservcode_forward

别名:diffservcode-forward

字符串

将数据包 DiffServ 更改为此值。

diffservcode_rev

别名:diffservcode-rev

字符串

更改数据包反向。

dlp_sensor

别名:dlp-sensor

字符串

现有 DLP 传感器的名称。

dnsfilter_profile

别名:dnsfilter-profile

字符串

现有 DNS 过滤配置文件的名称。

dstaddr4

任意

(列表或字符串) 目的 IPv4 地址名称和地址组名称。

dstaddr6

任意

(列表或字符串) 目的 IPv6 地址名称和地址组名称。

dstaddr_negate

别名:dstaddr-negate

字符串

启用时,dstaddr 指定目的地址不能是什么。

选项

  • "disable"

  • "enable"

dstintf

任意

(列表或字符串) 出站

emailfilter_profile

别名:emailfilter-profile

字符串

现有邮件过滤配置文件的名称。

fixedport

字符串

启用以防止源 NAT 更改会话的源端口。

选项

  • "disable"

  • "enable"

fsso_groups

别名:fsso-groups

任意

(列表或字符串) FSSO 组的名称。

global_label

别名:global-label

字符串

在 GUI 处于全局视图模式时显示的策略标签。

groups

任意

(列表或字符串) 可以使用此策略进行身份验证的用户组的名称。

http_policy_redirect

别名:http-policy-redirect

字符串

重定向 HTTP。

选项

  • "disable"

  • "enable"

icap_profile

别名:icap-profile

字符串

现有 ICAP 配置文件的名称。

inbound

字符串

基于策略的 IPsec VPN

选项

  • "disable"

  • "enable"

inspection_mode

别名:inspection-mode

字符串

策略检查模式

选项

  • "代理"

  • "流"

internet_service

别名:internet-service

字符串

启用/禁用此策略的互联网服务。

选项

  • "disable"

  • "enable"

internet_service_custom

别名:internet-service-custom

任意

(列表或字符串) 自定义互联网服务名称。

internet_service_custom_group

别名:internet-service-custom-group

任意

(列表或字符串) 自定义互联网服务组名称。

internet_service_group

别名:internet-service-group

任意

(列表或字符串) 互联网服务组名称。

internet_service_id

别名:internet-service-id

任意

(列表或字符串) 互联网服务ID。

internet_service_negate

别名:internet-service-negate

字符串

启用时,internet-service 指定服务不能是什么。

选项

  • "disable"

  • "enable"

internet_service_src

别名:internet-service-src

字符串

启用/禁用此策略源中的互联网服务。

选项

  • "disable"

  • "enable"

internet_service_src_custom

别名:internet-service-src-custom

任意

(列表或字符串) 自定义互联网服务源名称。

internet_service_src_custom_group

别名:internet-service-src-custom-group

任意

(列表或字符串) 自定义互联网服务源组名称。

internet_service_src_group

别名:internet-service-src-group

任意

(列表或字符串) 互联网服务源组名称。

internet_service_src_id

别名:internet-service-src-id

任意

(列表或字符串) 互联网服务源ID。

internet_service_src_negate

别名:internet-service-src-negate

字符串

启用时,internet-service-src 指定服务不能是什么。

选项

  • "disable"

  • "enable"

ippool

字符串

启用后,使用 IP 池进行源 NAT。

选项

  • "disable"

  • "enable"

ips_sensor

别名:ips-sensor

字符串

现有 IPS 传感器的名称。

logtraffic

字符串

启用或禁用日志记录。

选项

  • "disable"

  • "全部"

  • "UTM"

logtraffic_start

别名:logtraffic-start

字符串

会话开始时记录日志。

选项

  • "disable"

  • "enable"

mms_profile

别名:mms-profile

字符串

现有 MMS 配置文件的名称。

name

字符串

策略名称。

nat

字符串

启用/禁用源 NAT。

选项

  • "disable"

  • "enable"

outbound

字符串

基于策略的 IPsec VPN

选项

  • "disable"

  • "enable"

per_ip_shaper

别名:per-ip-shaper

字符串

每 IP 流量整形器。

policyid

整数 / 必需

策略ID

poolname4

任意

(列表或字符串) IPv4 池名称。

poolname6

任意

(列表或字符串) IPv6 池名称。

profile_group

别名:profile-group

字符串

配置文件组的名称。

profile_protocol_options

别名:profile-protocol-options

字符串

现有协议选项配置文件的名称。

profile_type

别名:profile-type

字符串

确定防火墙策略是否只允许安全配置文件组或单个配置文件。

选项

  • "单一"

  • "组"

schedule

字符串

调度名称。

service

任意

(列表或字符串) 服务和服务组名称。

service_negate

别名:service-negate

字符串

启用时,service 指定服务不能是什么。

选项

  • "disable"

  • "enable"

session_ttl

别名:session-ttl

整数

此策略接受的会话的 TTL(秒)。

srcaddr4

任意

(列表或字符串) 源 IPv4 地址名称和地址组名称。

srcaddr6

任意

(列表或字符串) 源 IPv6 地址名称和地址组名称。

srcaddr_negate

别名:srcaddr-negate

字符串

启用时,srcaddr 指定源地址不能是什么。

选项

  • "disable"

  • "enable"

srcintf

任意

(列表或字符串) 输入

ssh_filter_profile

别名:ssh-filter-profile

字符串

现有 SSH 过滤配置文件的名称。

ssh_policy_redirect

别名:ssh-policy-redirect

字符串

将 SSH 流量重定向到匹配的透明代理策略。

选项

  • "disable"

  • "enable"

ssl_ssh_profile

别名:ssl-ssh-profile

字符串

现有 SSL SSH 配置文件的名称。

status

字符串

启用或禁用此策略。

选项

  • "disable"

  • "enable"

tcp_mss_receiver

别名:tcp-mss-receiver

整数

接收器 TCP 最大分段大小

tcp_mss_sender

别名:tcp-mss-sender

整数

发送器 TCP 最大分段大小

traffic_shaper

别名:traffic-shaper

字符串

流量整形器。

traffic_shaper_reverse

别名:traffic-shaper-reverse

字符串

反向流量整形器。

url_category

别名:url-category

任意

(列表或字符串) URL 类别 ID 列表。

users

任意

(列表或字符串) 可以使用此策略进行身份验证的单个用户的名称。

utm_status

别名:utm-status

字符串

启用以添加一个或多个安全配置文件

选项

  • "disable"

  • "enable"

uuid

字符串

通用唯一标识符

voip_profile

别名:voip-profile

字符串

现有 VoIP 配置文件的名称。

vpntunnel

字符串

基于策略的 IPsec VPN

waf_profile

别名:waf-profile

字符串

现有 Web 应用防火墙配置文件的名称。

wanopt

字符串

启用/禁用 WAN 优化。

选项

  • "disable"

  • "enable"

wanopt_detection

别名:wanopt-detection

字符串

WAN 优化自动检测模式。

选项

  • "主动"

  • "被动"

  • "关闭"

wanopt_passive_opt

别名:wanopt-passive-opt

字符串

WAN 优化被动模式选项。

选项

  • "默认"

  • "透明"

  • "非透明"

wanopt_peer

别名:wanopt-peer

字符串

WAN 优化对等体。

wanopt_profile

别名:wanopt-profile

字符串

WAN 优化配置文件。

webcache

字符串

启用/禁用 Web 缓存。

选项

  • "disable"

  • "enable"

webcache_https

别名:webcache-https

字符串

启用/禁用 HTTPS 的 Web 缓存。

选项

  • "disable"

  • "enable"

webfilter_profile

别名:webfilter-profile

字符串

现有 Web 过滤配置文件的名称。

webproxy_forward_server

别名:webproxy-forward-server

字符串

Web 代理转发服务器名称。

webproxy_profile

别名:webproxy-profile

字符串

Web 代理配置文件名称。

proposed_method

字符串

底层 Json RPC 请求的覆盖方法。

选项

  • "更新"

  • "设置"

  • "添加"

rc_failed

列表 / 元素=整数

将覆盖失败条件的 rc 代码列表。

rc_succeeded

列表 / 元素=整数

将覆盖成功条件的 rc 代码列表。

state

字符串 / 必需

创建、更新或删除对象的指令。

选项

  • "存在"

  • "不存在"

workspace_locking_adom

字符串

在工作区模式下运行 FortiManager 时要锁定的 ADOM,该值可以是全局的和其他值,包括 root。

workspace_locking_timeout

整数

等待其他用户释放工作区锁的最大时间(秒)。

默认值: 300

注释

注意

  • 从 2.4.0 版开始,所有输入参数都使用下划线命名约定 (snake_case)。请将诸如“var-name”之类的参数更改为“var_name”。旧的参数名称仍然可用,但您将收到弃用警告。您可以通过在 ansible.cfg 中设置 deprecation_warnings=False 来忽略此警告。

  • 此 FortiManager 模块支持在工作区锁定模式下运行,顶级参数 workspace_locking_adom 和 workspace_locking_timeout 有助于完成这项工作。

  • 要创建或更新对象,请使用 state present 指令。

  • 要删除对象,请使用 state absent 指令。

  • 通常,当返回非零 rc 时,运行一个模块可能会失败。您还可以使用参数 rc_failed 和 rc_succeeded 覆盖失败或成功的条件。

示例

- name: Example playbook (generated based on argument schema)
  hosts: fortimanagers
  connection: httpapi
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Configure consolidated IPv4/IPv6 policies.
      fortinet.fortimanager.fmgr_pkg_firewall_consolidated_policy:
        # bypass_validation: false
        workspace_locking_adom: <value in [global, custom adom including root]>
        workspace_locking_timeout: 300
        # rc_succeeded: [0, -2, -3, ...]
        # rc_failed: [-2, -3, ...]
        adom: <your own value>
        pkg: <your own value>
        state: present # <value in [present, absent]>
        pkg_firewall_consolidated_policy:
          action: <value in [deny, accept, ipsec]>
          app_category: <list or string>
          app_group: <list or string>
          application: <list or integer>
          application_list: <string>
          auto_asic_offload: <value in [disable, enable]>
          av_profile: <string>
          cifs_profile: <string>
          comments: <string>
          diffserv_forward: <value in [disable, enable]>
          diffserv_reverse: <value in [disable, enable]>
          diffservcode_forward: <string>
          diffservcode_rev: <string>
          dlp_sensor: <string>
          dnsfilter_profile: <string>
          dstaddr4: <list or string>
          dstaddr6: <list or string>
          dstintf: <list or string>
          emailfilter_profile: <string>
          fixedport: <value in [disable, enable]>
          groups: <list or string>
          http_policy_redirect: <value in [disable, enable]>
          icap_profile: <string>
          inbound: <value in [disable, enable]>
          inspection_mode: <value in [proxy, flow]>
          internet_service: <value in [disable, enable]>
          internet_service_custom: <list or string>
          internet_service_custom_group: <list or string>
          internet_service_group: <list or string>
          internet_service_id: <list or string>
          internet_service_src: <value in [disable, enable]>
          internet_service_src_custom: <list or string>
          internet_service_src_custom_group: <list or string>
          internet_service_src_group: <list or string>
          internet_service_src_id: <list or string>
          ippool: <value in [disable, enable]>
          ips_sensor: <string>
          logtraffic: <value in [disable, all, utm]>
          logtraffic_start: <value in [disable, enable]>
          mms_profile: <string>
          name: <string>
          nat: <value in [disable, enable]>
          outbound: <value in [disable, enable]>
          per_ip_shaper: <string>
          policyid: <integer>
          poolname4: <list or string>
          poolname6: <list or string>
          profile_group: <string>
          profile_protocol_options: <string>
          profile_type: <value in [single, group]>
          schedule: <string>
          service: <list or string>
          session_ttl: <integer>
          srcaddr4: <list or string>
          srcaddr6: <list or string>
          srcintf: <list or string>
          ssh_filter_profile: <string>
          ssh_policy_redirect: <value in [disable, enable]>
          ssl_ssh_profile: <string>
          status: <value in [disable, enable]>
          tcp_mss_receiver: <integer>
          tcp_mss_sender: <integer>
          traffic_shaper: <string>
          traffic_shaper_reverse: <string>
          url_category: <list or string>
          users: <list or string>
          utm_status: <value in [disable, enable]>
          uuid: <string>
          voip_profile: <string>
          vpntunnel: <string>
          waf_profile: <string>
          wanopt: <value in [disable, enable]>
          wanopt_detection: <value in [active, passive, off]>
          wanopt_passive_opt: <value in [default, transparent, non-transparent]>
          wanopt_peer: <string>
          wanopt_profile: <string>
          webcache: <value in [disable, enable]>
          webcache_https: <value in [disable, enable]>
          webfilter_profile: <string>
          webproxy_forward_server: <string>
          webproxy_profile: <string>
          captive_portal_exempt: <value in [disable, enable]>
          dstaddr_negate: <value in [disable, enable]>
          fsso_groups: <list or string>
          global_label: <string>
          internet_service_negate: <value in [disable, enable]>
          internet_service_src_negate: <value in [disable, enable]>
          service_negate: <value in [disable, enable]>
          srcaddr_negate: <value in [disable, enable]>
          _policy_block: <integer>

返回值

常用返回值已在此处记录,以下是此模块特有的字段

描述

meta

字典

请求的结果。

返回值:始终

request_url

字符串

请求的完整 URL。

返回值:始终

示例: "/sys/login/user"

response_code

整数

API 请求的状态。

返回值:始终

示例: 0

response_data

列表 / 元素=字符串

API 响应。

返回值:始终

response_message

字符串

API 响应的描述性消息。

返回值:始终

示例: "OK."

system_information

字典

目标系统的信息。

返回值:始终

rc

整数

请求的状态。

返回值:始终

示例: 0

version_check_warning

列表 / 元素=字符串

如果剧本中使用的参数不受当前 FortiManager 版本支持,则会发出警告。

返回值: 复杂类型

作者

  • 杜欣伟 (@dux-fortinet)

  • 李兴 (@lix-fortinet)

  • 薛杰 (@JieX19)

  • 郑琳 (@chillancezen)

  • 沈峰 (@fshen01)

  • 陆洪斌 (@fgtdev-hblu)