fortinet-ansible-dev / ansible-galaxy-fortios-sphinxdoc Goto Github PK
View Code? Open in Web Editor NEWhttps://ansible-galaxy-fortios-docs.readthedocs.io/en/latest/
https://ansible-galaxy-fortios-docs.readthedocs.io/en/latest/
I am unable to fully populate the pac_file_data with the actual contents. It cuts off and seems to have issues with certain symbols.
ansible 2.10.5
python version = 3.6.5 (default, Jan 19 2021, 14:04:45) [GCC 10.2.1 20200826 (Red Hat 10.2.1-3)]
ansible-galaxy collection list
Collection Version
----------------- -------
ansible.netcommon 1.5.0
fortinet.fortios 2.0.1
The playbook is as follows:
- name: CONFIGURE EXPLICIT-PROXY PAC FILE AND SETTINGS
fortios_web_proxy_explicit:
vdom: "{{ vdom }}"
web_proxy_explicit:
ftp_over_http: "enable"
http_incoming_port: "12345"
message_upon_server_error: "enable"
pac_file_data: "{{ lookup('file', 'proxy_ex.pac') }}"
pac_file_name: "proxy.pac"
pac_file_server_status: "enable"
pref_dns_result: "ipv4"
realm: "default"
sec_default_action: "deny"
socks: "disable"
ssl_algorithm: "low"
status: "enable"
strict_guest: "disable"
trace_auth_no_rsp: "disable"
unknown_http_version: "reject"
and what actually gets pushed is the following:
PROXY 4.5.6.7:8080; PROXY 7.8.9.10:8080
The PAC file contents are the following:
function FindProxyForURL(url, host) {
// If the hostname matches, send direct.
if (dnsDomainIs(host, "intranet.domain.com") ||
shExpMatch(host, "(*.abcdomain.com|abcdomain.com)"))
return "DIRECT";
// If the protocol or URL matches, send direct.
if (url.substring(0, 4)=="ftp:" ||
shExpMatch(url, "http://abcdomain.com/folder/*"))
return "DIRECT";
// If the requested website is hosted within the internal network, send direct.
if (isPlainHostName(host) ||
shExpMatch(host, "*.local") ||
isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0") ||
isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0") ||
isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0"))
return "DIRECT";
// If the IP address of the local machine is within a defined
// subnet, send to a specific proxy.
if (isInNet(myIpAddress(), "10.10.5.0", "255.255.255.0"))
return "PROXY 1.2.3.4:8080";
// DEFAULT RULE: All other traffic, use below proxies, in fail-over order.
return "PROXY 4.5.6.7:8080; PROXY 7.8.9.10:8080";
}
And the ansible debug is the following:
changed: [firewall] => {
"changed": true,
"invocation": {
"module_args": {
"access_token": null,
"enable_log": null,
"vdom": "root",
"web_proxy_explicit": {
"ftp_incoming_port": null,
"ftp_over_http": "enable",
"http_incoming_port": "12345",
"https_incoming_port": null,
"https_replacement_message": null,
"incoming_ip": null,
"incoming_ip6": null,
"ipv6_status": null,
"message_upon_server_error": "enable",
"outgoing_ip": null,
"outgoing_ip6": null,
"pac_file_data": "function FindProxyForURL(url, host) {\n\n// If the hostname matches, send direct.\n\tif (dnsDomainIs(host, \"intranet.domain.com\") ||\n\t\tshExpMatch(host, \"(*.abcdomain.com|abcdomain.com)\"))\n\t\treturn \"DIRECT\";\n\n// If the protocol or URL matches, send direct.\n\tif (url.substring(0, 4)==\"ftp:\" ||\n\t\tshExpMatch(url, \"http://abcdomain.com/folder/*\"))\n\t\treturn \"DIRECT\";\n\n// If the requested website is hosted within the internal network, send direct.\n\tif (isPlainHostName(host) ||\n\t\tshExpMatch(host, \"*.local\") ||\n\t\tisInNet(dnsResolve(host), \"10.0.0.0\", \"255.0.0.0\") ||\n\t\tisInNet(dnsResolve(host), \"172.16.0.0\", \"255.240.0.0\") ||\n\t\tisInNet(dnsResolve(host), \"192.168.0.0\", \"255.255.0.0\") ||\n\t\tisInNet(dnsResolve(host), \"127.0.0.0\", \"255.255.255.0\"))\n\t\treturn \"DIRECT\";\n\n// If the IP address of the local machine is within a defined\n// subnet, send to a specific proxy.\n\tif (isInNet(myIpAddress(), \"10.10.5.0\", \"255.255.255.0\"))\n\t\treturn \"PROXY 1.2.3.4:8080\";\n\n// DEFAULT RULE: All other traffic, use below proxies, in fail-over order.\n\treturn \"PROXY 4.5.6.7:8080; PROXY 7.8.9.10:8080\";\n\n}",
"pac_file_name": "proxy.pac",
"pac_file_server_port": null,
"pac_file_server_status": "enable",
"pac_file_url": null,
"pac_policy": null,
"pref_dns_result": "ipv4",
"realm": "default",
"sec_default_action": "deny",
"socks": "disable",
"socks_incoming_port": null,
"ssl_algorithm": "low",
"status": "enable",
"strict_guest": "disable",
"trace_auth_no_rsp": "disable",
"unknown_http_version": "reject"
}
}
},
"meta": {
"build": 1190,
"http_method": "PUT",
"http_status": 200,
"name": "explicit",
"old_revision": "4a01d4d8969443cd9406d8920856c2ef",
"path": "web-proxy",
"revision": "18a1aa6bb651a9b2a26bbc6d5cfdab0d",
"revision_changed": true,
"serial": "FG200E4Q17914080",
"status": "success",
"vdom": "root",
"version": "v6.2.7"
}
}
What the firewall actually sees is the following when debugging:
firewall (root) # 0: config vdom
0: edit root
0: config web-proxy explicit
0: unset pac-file-url
0: unset pac-file-data
0: set pac-file-data "PROXY 4.5.6.7:8080; PROXY 7.8.9.10:8080"
0: end
0: end
Despite the debug of ansible showing it sent the whole file it still shows up sliced at the actual firewall. Is there a specific way I have to enter the contents of the PAC file so this does not happen?
Thanks
Hi,
I'm using the readthedocs site of your project to keep up with your changelogs.
I recently discovered that your up to version 2.1.5 already, but the page still shows 2.1.3 as the most recent.
Hello
I've already configured a lot of policies with ansible on fortigates, but it seems that I can't add a dnsfilter profile to a policy.
No matter what I enter next to "dnsfilter_profile:" this gets ignored, even for non-existing names.
I don't receive an error, it just gets ignorded.
My (test)task looks like this:
- name: Create Policy 2
fortios_firewall_policy:
vdom: "{{ vdom }}"
state: "present"
firewall_policy:
policyid: 2
srcintf:
- name: "lan"
dstintf:
- name: "wan"
srcaddr:
- name: "all"
dstaddr:
- name: "all"
schedule: "always"
service:
- name: "DNS"
dnsfilter_profile: "test-dns"
ssl_ssh_profile: "certificate-inspection"
nat: enable
action: accept
logtraffic: all
This is the output on the fortigate with "diag debug cli 8":
0: config firewall policy
0: edit 2
0: set srcintf "lan"
0: set dstintf "wan"
0: set srcaddr "all"
0: set dstaddr "all"
0: unset srcaddr6
0: unset dstaddr6
0: unset src-vendor-mac
0: set action accept
0: set schedule "always"
0: set service "DNS"
0: set ssl-ssh-profile "certificate-inspection"
0: set logtraffic all
0: unset groups
0: unset users
0: unset fsso-groups
0: unset custom-log-fields
0: set nat enable
0: end
So as you can see, it isn't trying to push it to the fortigate.
I am using Ansible 2.12.3 and FortiOS Galaxy version 2.1.3 (latest)
Can you please look into this?
Thanks in advance!
FYI : Running this against a Fortigate 501E v6.0.9 build0335 (GA) the "schedule" param for this module is required.
Please delete unnecessary space before parameter "access_token" in documentation - in readthedocs listing parameter description and example.
link
I have tried using execute__tree__reboot
as the selector for fortinet.fortios.fortios_configuration_fact
, but when I got a Traceback, and checked the code, I noticed that all the selectors containing the string __
(e.g. diagnose__tree___settings
, or execute__tree__reboot
) are not listed, so there is a mismatch between the selector list and the code.
As noted in release notes the collection version must match the FortiOS one.
However the specified workaround of installing the right version is not relevant in a scenario, where managing of multiple FG with different versions for multiple clients is required.
(Ansible does not allow installing multiple versions of the same collection https://docs.ansible.com/ansible/devel/user_guide/collections_using.html#installing-an-older-version-of-a-collection).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.