fortios_firewall_vip – Configure virtual IP for IPv4 in Fortinet’s FortiOS and FortiGate

New in version 2.8.

Synopsis

  • This module is able to configure a FortiGate or FortiOS by allowing the user to configure firewall feature and vip category. Examples includes all options and need to be adjusted to datasources before usage. Tested with FOS v6.0.2

Requirements

The below requirements are needed on the host that executes this module.

  • fortiosapi>=0.9.8

Parameters

Parameter Choices/Defaults Comments
firewall_vip
-
Default:
null
Configure virtual IP for IPv4.
arp-reply
-
    Choices:
  • disable
  • enable
Enable to respond to ARP requests for this virtual IP address. Enabled by default.
color
-
Color of icon on the GUI.
comment
-
Comment.
dns-mapping-ttl
-
DNS mapping TTL (Set to zero to use TTL in DNS response, default = 0).
extaddr
-
External FQDN address name.
name
- / required
Address name. Source firewall.address.name firewall.addrgrp.name.
extintf
-
Interface connected to the source network that receives the packets that will be forwarded to the destination network. Source system .interface.name.
extip
-
IP address or address range on the external interface that you want to map to an address or address range on the destination network.
extport
-
Incoming port number range that you want to map to a port number range on the destination network.
gratuitous-arp-interval
-
Enable to have the VIP send gratuitous ARPs. 0=disabled. Set from 5 up to 8640000 seconds to enable.
http-cookie-age
-
Time in minutes that client web browsers should keep a cookie. Default is 60 seconds. 0 = no time limit.
http-cookie-domain
-
Domain that HTTP cookie persistence should apply to.
http-cookie-domain-from-host
-
    Choices:
  • disable
  • enable
Enable/disable use of HTTP cookie domain from host field in HTTP.
http-cookie-generation
-
Generation of HTTP cookie to be accepted. Changing invalidates all existing cookies.
http-cookie-path
-
Limit HTTP cookie persistence to the specified path.
http-cookie-share
-
    Choices:
  • disable
  • same-ip
Control sharing of cookies across virtual servers. same-ip means a cookie from one virtual server can be used by another. Disable stops cookie sharing.
http-ip-header
-
    Choices:
  • enable
  • disable
For HTTP multiplexing, enable to add the original client IP address in the XForwarded-For HTTP header.
http-ip-header-name
-
For HTTP multiplexing, enter a custom HTTPS header name. The original client IP address is added to this header. If empty, X-Forwarded-For is used.
http-multiplex
-
    Choices:
  • enable
  • disable
Enable/disable HTTP multiplexing.
https-cookie-secure
-
    Choices:
  • disable
  • enable
Enable/disable verification that inserted HTTPS cookies are secure.
id
-
Custom defined ID.
ldb-method
-
    Choices:
  • static
  • round-robin
  • weighted
  • least-session
  • least-rtt
  • first-alive
  • http-host
Method used to distribute sessions to real servers.
mapped-addr
-
Mapped FQDN address name. Source firewall.address.name.
mappedip
-
IP address or address range on the destination network to which the external IP address is mapped.
range
- / required
Mapped IP range.
mappedport
-
Port number range on the destination network to which the external port number range is mapped.
max-embryonic-connections
-
Maximum number of incomplete connections.
monitor
-
Name of the health check monitor to use when polling to determine a virtual server's connectivity status.
name
- / required
Health monitor name. Source firewall.ldb-monitor.name.
name
- / required
Virtual IP name.
nat-source-vip
-
    Choices:
  • disable
  • enable
Enable to prevent unintended servers from using a virtual IP. Disable to use the actual IP address of the server as the source address.
outlook-web-access
-
    Choices:
  • disable
  • enable
Enable to add the Front-End-Https header for Microsoft Outlook Web Access.
persistence
-
    Choices:
  • none
  • http-cookie
  • ssl-session-id
Configure how to make sure that clients connect to the same server every time they make a request that is part of the same session.
portforward
-
    Choices:
  • disable
  • enable
Enable/disable port forwarding.
portmapping-type
-
    Choices:
  • 1-to-1
  • m-to-n
Port mapping type.
protocol
-
    Choices:
  • tcp
  • udp
  • sctp
  • icmp
Protocol to use when forwarding packets.
realservers
-
Select the real servers that this server load balancing VIP will distribute traffic to.
client-ip
-
Only clients in this IP range can connect to this real server.
healthcheck
-
    Choices:
  • disable
  • enable
  • vip
Enable to check the responsiveness of the real server before forwarding traffic.
holddown-interval
-
Time in seconds that the health check monitor continues to monitor and unresponsive server that should be active.
http-host
-
HTTP server domain name in HTTP header.
id
- / required
Real server ID.
ip
-
IP address of the real server.
max-connections
-
Max number of active connections that can be directed to the real server. When reached, sessions are sent to other real servers.
monitor
-
Name of the health check monitor to use when polling to determine a virtual server's connectivity status. Source firewall .ldb-monitor.name.
port
-
Port for communicating with the real server. Required if port forwarding is enabled.
status
-
    Choices:
  • active
  • standby
  • disable
Set the status of the real server to active so that it can accept traffic, or on standby or disabled so no traffic is sent.
weight
-
Weight of the real server. If weighted load balancing is enabled, the server with the highest weight gets more connections.
server-type
-
    Choices:
  • http
  • https
  • imaps
  • pop3s
  • smtps
  • ssl
  • tcp
  • udp
  • ip
Protocol to be load balanced by the virtual server (also called the server load balance virtual IP).
service
-
Service name.
name
- / required
Service name. Source firewall.service.custom.name firewall.service.group.name.
src-filter
-
Source address filter. Each address must be either an IP/subnet (x.x.x.x/n) or a range (x.x.x.x-y.y.y.y). Separate addresses with spaces.
range
- / required
Source-filter range.
srcintf-filter
-
Interfaces to which the VIP applies. Separate the names with spaces.
interface-name
- / required
Interface name. Source system.interface.name.
ssl-algorithm
-
    Choices:
  • high
  • medium
  • low
  • custom
Permitted encryption algorithms for SSL sessions according to encryption strength.
ssl-certificate
-
The name of the SSL certificate to use for SSL acceleration. Source vpn.certificate.local.name.
ssl-cipher-suites
-
SSL/TLS cipher suites acceptable from a client, ordered by priority.
cipher
-
    Choices:
  • TLS-RSA-WITH-3DES-EDE-CBC-SHA
  • TLS-DHE-RSA-WITH-DES-CBC-SHA
  • TLS-DHE-DSS-WITH-DES-CBC-SHA
Cipher suite name.
priority
- / required
SSL/TLS cipher suites priority.
versions
-
    Choices:
  • ssl-3.0
  • tls-1.0
  • tls-1.1
  • tls-1.2
SSL/TLS versions that the cipher suite can be used with.
ssl-client-fallback
-
    Choices:
  • disable
  • enable
Enable/disable support for preventing Downgrade Attacks on client connections (RFC 7507).
ssl-client-renegotiation
-
    Choices:
  • allow
  • deny
  • secure
Allow, deny, or require secure renegotiation of client sessions to comply with RFC 5746.
ssl-client-session-state-max
-
Maximum number of client to FortiGate SSL session states to keep.
ssl-client-session-state-timeout
-
Number of minutes to keep client to FortiGate SSL session state.
ssl-client-session-state-type
-
    Choices:
  • disable
  • time
  • count
  • both
How to expire SSL sessions for the segment of the SSL connection between the client and the FortiGate.
ssl-dh-bits
-
    Choices:
  • 768
  • 1024
  • 1536
  • 2048
  • 3072
  • 4096
Number of bits to use in the Diffie-Hellman exchange for RSA encryption of SSL sessions.
ssl-hpkp
-
    Choices:
  • disable
  • enable
  • report-only
Enable/disable including HPKP header in response.
ssl-hpkp-age
-
Number of seconds the client should honour the HPKP setting.
ssl-hpkp-backup
-
Certificate to generate backup HPKP pin from. Source vpn.certificate.local.name vpn.certificate.ca.name.
ssl-hpkp-include-subdomains
-
    Choices:
  • disable
  • enable
Indicate that HPKP header applies to all subdomains.
ssl-hpkp-primary
-
Certificate to generate primary HPKP pin from. Source vpn.certificate.local.name vpn.certificate.ca.name.
ssl-hpkp-report-uri
-
URL to report HPKP violations to.
ssl-hsts
-
    Choices:
  • disable
  • enable
Enable/disable including HSTS header in response.
ssl-hsts-age
-
Number of seconds the client should honour the HSTS setting.
ssl-hsts-include-subdomains
-
    Choices:
  • disable
  • enable
Indicate that HSTS header applies to all subdomains.
ssl-http-location-conversion
-
    Choices:
  • enable
  • disable
Enable to replace HTTP with HTTPS in the reply's Location HTTP header field.
ssl-http-match-host
-
    Choices:
  • enable
  • disable
Enable/disable HTTP host matching for location conversion.
ssl-max-version
-
    Choices:
  • ssl-3.0
  • tls-1.0
  • tls-1.1
  • tls-1.2
Highest SSL/TLS version acceptable from a client.
ssl-min-version
-
    Choices:
  • ssl-3.0
  • tls-1.0
  • tls-1.1
  • tls-1.2
Lowest SSL/TLS version acceptable from a client.
ssl-mode
-
    Choices:
  • half
  • full
Apply SSL offloading between the client and the FortiGate (half) or from the client to the FortiGate and from the FortiGate to the server (full).
ssl-pfs
-
    Choices:
  • require
  • deny
  • allow
Select the cipher suites that can be used for SSL perfect forward secrecy (PFS). Applies to both client and server sessions.
ssl-send-empty-frags
-
    Choices:
  • enable
  • disable
Enable/disable sending empty fragments to avoid CBC IV attacks (SSL 3.0 & TLS 1.0 only). May need to be disabled for compatibility with older systems.
ssl-server-algorithm
-
    Choices:
  • high
  • medium
  • low
  • custom
  • client
Permitted encryption algorithms for the server side of SSL full mode sessions according to encryption strength.
ssl-server-cipher-suites
-
SSL/TLS cipher suites to offer to a server, ordered by priority.
cipher
-
    Choices:
  • TLS-RSA-WITH-3DES-EDE-CBC-SHA
  • TLS-DHE-RSA-WITH-DES-CBC-SHA
  • TLS-DHE-DSS-WITH-DES-CBC-SHA
Cipher suite name.
priority
- / required
SSL/TLS cipher suites priority.
versions
-
    Choices:
  • ssl-3.0
  • tls-1.0
  • tls-1.1
  • tls-1.2
SSL/TLS versions that the cipher suite can be used with.
ssl-server-max-version
-
    Choices:
  • ssl-3.0
  • tls-1.0
  • tls-1.1
  • tls-1.2
  • client
Highest SSL/TLS version acceptable from a server. Use the client setting by default.
ssl-server-min-version
-
    Choices:
  • ssl-3.0
  • tls-1.0
  • tls-1.1
  • tls-1.2
  • client
Lowest SSL/TLS version acceptable from a server. Use the client setting by default.
ssl-server-session-state-max
-
Maximum number of FortiGate to Server SSL session states to keep.
ssl-server-session-state-timeout
-
Number of minutes to keep FortiGate to Server SSL session state.
ssl-server-session-state-type
-
    Choices:
  • disable
  • time
  • count
  • both
How to expire SSL sessions for the segment of the SSL connection between the server and the FortiGate.
state
-
    Choices:
  • present
  • absent
Indicates whether to create or remove the object
type
-
    Choices:
  • static-nat
  • load-balance
  • server-load-balance
  • dns-translation
  • fqdn
Configure a static NAT, load balance, server load balance, DNS translation, or FQDN VIP.
uuid
-
Universally Unique Identifier (UUID; automatically assigned but can be manually reset).
weblogic-server
-
    Choices:
  • disable
  • enable
Enable to add an HTTP header to indicate SSL offloading for a WebLogic server.
websphere-server
-
    Choices:
  • disable
  • enable
Enable to add an HTTP header to indicate SSL offloading for a WebSphere server.
host
- / required
FortiOS or FortiGate ip address.
https
boolean
    Choices:
  • no ←
  • yes
Indicates if the requests towards FortiGate must use HTTPS protocol
password
-
Default:
""
FortiOS or FortiGate password.
username
- / required
FortiOS or FortiGate username.
vdom
-
Default:
"root"
Virtual domain, among those defined previously. A vdom is a virtual instance of the FortiGate that can be configured and used as a different unit.

Notes

Note

  • Requires fortiosapi library developed by Fortinet
  • Run as a local_action in your playbook

Examples

- hosts: localhost
  vars:
   host: "192.168.122.40"
   username: "admin"
   password: ""
   vdom: "root"
  tasks:
  - name: Configure virtual IP for IPv4.
    fortios_firewall_vip:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      firewall_vip:
        state: "present"
        arp-reply: "disable"
        color: "4"
        comment: "Comment."
        dns-mapping-ttl: "6"
        extaddr:
         -
            name: "default_name_8 (source firewall.address.name firewall.addrgrp.name)"
        extintf: "<your_own_value> (source system.interface.name)"
        extip: "<your_own_value>"
        extport: "<your_own_value>"
        gratuitous-arp-interval: "12"
        http-cookie-age: "13"
        http-cookie-domain: "<your_own_value>"
        http-cookie-domain-from-host: "disable"
        http-cookie-generation: "16"
        http-cookie-path: "<your_own_value>"
        http-cookie-share: "disable"
        http-ip-header: "enable"
        http-ip-header-name: "<your_own_value>"
        http-multiplex: "enable"
        https-cookie-secure: "disable"
        id:  "23"
        ldb-method: "static"
        mapped-addr: "<your_own_value> (source firewall.address.name)"
        mappedip:
         -
            range: "<your_own_value>"
        mappedport: "<your_own_value>"
        max-embryonic-connections: "29"
        monitor:
         -
            name: "default_name_31 (source firewall.ldb-monitor.name)"
        name: "default_name_32"
        nat-source-vip: "disable"
        outlook-web-access: "disable"
        persistence: "none"
        portforward: "disable"
        portmapping-type: "1-to-1"
        protocol: "tcp"
        realservers:
         -
            client-ip: "<your_own_value>"
            healthcheck: "disable"
            holddown-interval: "42"
            http-host: "myhostname"
            id:  "44"
            ip: "<your_own_value>"
            max-connections: "46"
            monitor: "<your_own_value> (source firewall.ldb-monitor.name)"
            port: "48"
            status: "active"
            weight: "50"
        server-type: "http"
        service:
         -
            name: "default_name_53 (source firewall.service.custom.name firewall.service.group.name)"
        src-filter:
         -
            range: "<your_own_value>"
        srcintf-filter:
         -
            interface-name: "<your_own_value> (source system.interface.name)"
        ssl-algorithm: "high"
        ssl-certificate: "<your_own_value> (source vpn.certificate.local.name)"
        ssl-cipher-suites:
         -
            cipher: "TLS-RSA-WITH-3DES-EDE-CBC-SHA"
            priority: "62"
            versions: "ssl-3.0"
        ssl-client-fallback: "disable"
        ssl-client-renegotiation: "allow"
        ssl-client-session-state-max: "66"
        ssl-client-session-state-timeout: "67"
        ssl-client-session-state-type: "disable"
        ssl-dh-bits: "768"
        ssl-hpkp: "disable"
        ssl-hpkp-age: "71"
        ssl-hpkp-backup: "<your_own_value> (source vpn.certificate.local.name vpn.certificate.ca.name)"
        ssl-hpkp-include-subdomains: "disable"
        ssl-hpkp-primary: "<your_own_value> (source vpn.certificate.local.name vpn.certificate.ca.name)"
        ssl-hpkp-report-uri: "<your_own_value>"
        ssl-hsts: "disable"
        ssl-hsts-age: "77"
        ssl-hsts-include-subdomains: "disable"
        ssl-http-location-conversion: "enable"
        ssl-http-match-host: "enable"
        ssl-max-version: "ssl-3.0"
        ssl-min-version: "ssl-3.0"
        ssl-mode: "half"
        ssl-pfs: "require"
        ssl-send-empty-frags: "enable"
        ssl-server-algorithm: "high"
        ssl-server-cipher-suites:
         -
            cipher: "TLS-RSA-WITH-3DES-EDE-CBC-SHA"
            priority: "89"
            versions: "ssl-3.0"
        ssl-server-max-version: "ssl-3.0"
        ssl-server-min-version: "ssl-3.0"
        ssl-server-session-state-max: "93"
        ssl-server-session-state-timeout: "94"
        ssl-server-session-state-type: "disable"
        type: "static-nat"
        uuid: "<your_own_value>"
        weblogic-server: "disable"
        websphere-server: "disable"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
build
string
always
Build number of the fortigate image

Sample:
1547
http_method
string
always
Last method used to provision the content into FortiGate

Sample:
PUT
http_status
string
always
Last result given by FortiGate on last operation applied

Sample:
200
mkey
string
success
Master key (id) used in the last call to FortiGate

Sample:
key1
name
string
always
Name of the table used to fulfill the request

Sample:
urlfilter
path
string
always
Path of the table used to fulfill the request

Sample:
webfilter
revision
string
always
Internal revision number

Sample:
17.0.2.10658
serial
string
always
Serial number of the unit

Sample:
FGVMEVYYQT3AB5352
status
string
always
Indication of the operation's result

Sample:
success
vdom
string
always
Virtual domain used

Sample:
root
version
string
always
Version of the FortiGate

Sample:
v5.6.3


Status

Authors

  • Miguel Angel Munoz (@mamunozgonzalez)
  • Nicolas Thomas (@thomnico)

Hint

If you notice any issues in this documentation you can edit this document to improve it.