Artica Wiki

FortiGate WCCP mode for Artica Proxy

Redirect HTTP and HTTPS traffic from a FortiGate to one or several Artica proxies with WCCPv2, using the WCCP mode of the FortiGate integration.

About

WCCP lets your FortiGate steer web traffic to Artica Proxy.
The FortiGate is the WCCP router.
Each Artica Proxy is a WCCP cache.
Clients need no proxy setting and no route change.

The FortiGate redirects HTTP (port 80) and HTTPS (port 443) at layer 2.
It only rewrites the destination MAC address.
The proxy therefore sees the real IP address and the real MAC address of each client.

Unlike the transparent mode, which relies on FortiOS policy routes toward one proxy, WCCP accepts several proxies behind the same FortiGate.
The FortiGate shares the traffic between them by hash.
A proxy that stops answering leaves the group in about 30 seconds, and its share goes to the others.
Security teams often prefer WCCP because the FortiGate drives the redirection with a standard protocol.

Artica never connects to the FortiGate.
The console generates the FortiOS commands and you paste them into the FortiGate CLI.

Clients --(HTTP 80, HTTPS 443)--> FortiGate (WCCP router)
FortiGate --(layer 2 redirection)--> Artica Proxy (WCCP cache)
Artica Proxy --(policy "proxies egress", NAT)--> Internet

Requirements

Item Requirement
FortiOS 7.0 or later (validated on FortiOS 7.0.6)
Artica Proxy Squid 7.8 build that carries the Artica WCCP fix
Network The proxy and the FortiGate share the same layer 2 segment
FortiGate One FortiGate per deployment (HA pairs and several FortiGates are not supported)
UDP 2048 Open between the FortiGate and each proxy, in both directions
HTTPS An SSL inspection certificate on the proxy, otherwise only HTTP is redirected

The stock Squid 7.8 rejects the capabilities sent by the FortiGate.
Artica ships a fixed build for Debian 10, 12 and 13.
The audit of the Status tab tells you if the installed build carries the fix.

The legacy WCCP service (Your Proxy » WCCP) uses the same interception ports.
It cannot run at the same time as the FortiGate integration.
Artica refuses to enable one while the other is active.

Switch the integration to WCCP mode

  1. In the left menu, open Your Proxy » Fortigate.
  2. If the integration is not installed yet, click Install in the page header.
  3. Click WCCP mode in the page header and confirm.

The switch restarts the proxy.
Expect a cut of about 20 seconds.
The FortiGate then needs about 30 seconds to assign the traffic to the proxy.

In WCCP mode the page shows four tabs:

Tab Purpose
Status Proxy service state and readiness audit
WCCP wizard FortiGate, proxy and FortiOS settings, with the remaining setup steps
FortiGate rules Groups of redirected clients and exceptions
Statistics Intercepted HTTP and HTTPS traffic

To go back, click Transparent mode in the page header.
The FortiGate stops redirecting to this proxy in about 30 seconds.

Configure the WCCP wizard

Open the WCCP wizard tab and click Parameters.

WCCP parameters

Setting Description
FortiGate address IP address of the FortiGate interface that faces the clients.
It must sit on the proxy subnet.
WCCP password Optional shared secret, 1 to 8 characters (letters, digits, ., _, -).
It is never displayed again once saved.
HTTPS service ID WCCP service used for HTTPS, from 51 to 255.
The default is 70.
HTTP always uses the standard service 0.
Weight Share of the traffic given to this proxy.
Keep the default (10000) on every proxy.
Proxy addresses IP addresses or networks of all the proxies of the group, at most a /24.
FortiOS LAN interface FortiGate interface where the clients come from, for example internal.
Use a physical interface or a VLAN, never a zone.
FortiOS WAN interface FortiGate interface toward the Internet, for example wan1.
First policy ID ID of the first firewall policy that the commands create.
The default is 900.
Move policies before policy ID Existing policy that the new policies must precede.
Leave empty to add them at the end.

Set a password when the proxy addresses cover hosts that are not proxies.
Without it, any host of that range could register as a cache.

The wizard tracks four steps: FortiGate, proxy addresses, FortiOS interfaces and at least one enabled group.
The FortiOS commands button becomes available once all four are done.

WCCP wizard with the four setup steps done

Unequal weights between proxies have not been validated with FortiOS.
Keep the same value on every proxy.

Define the FortiGate rules

The FortiGate rules tab holds two tables.

Groups of the FortiGate rules tab

Groups list the clients whose web traffic goes to the proxy.

Exceptions list what the FortiGate must never redirect.

A destination given only as an FQDN works only if the FortiGate and the clients resolve it to the same addresses.
Use the same DNS servers on both sides, or add the IP addresses.

Up to 200 groups and 200 exceptions are allowed.

Generate and paste the FortiOS commands

Generated FortiOS commands

Click FortiOS commands, copy the script and paste it into the FortiGate CLI.
The script creates or updates, in this order:

  1. The WCCP services 0 (HTTP) and <HTTPS service ID> in config system wccp.
  2. set wccp enable on the FortiOS LAN interface.
  3. The addresses and address groups of the proxies, the groups and the exceptions.
  4. The firewall policies, then move commands that put them in the right order:
    • the exception policies, with wccp disable
    • the proxies egress policy, with nat enable, so a proxy is never redirected to itself
    • one WCCP policy per group, with wccp enable and nat disable

Pasting the same script twice gives the same result.
Each policy name carries its ID, so a new paste overwrites the policies of the previous one.
Delete by hand any WCCP ... policy left outside the ID range of the script.

Example generated for one proxy (192.168.1.29) and one group (192.168.1.190):

config system wccp
    edit "0"
        set router-id 192.168.1.1
        set server-list 192.168.1.29 255.255.255.255
        set server-type proxy
        set authentication disable
        set forward-method L2
        set return-method L2
        set assignment-method HASH
    next
    edit "70"
        set router-id 192.168.1.1
        set server-list 192.168.1.29 255.255.255.255
        set server-type proxy
        set authentication disable
        set forward-method L2
        set return-method L2
        set assignment-method HASH
    next
end
config system interface
    edit "internal"
        set wccp enable
    next
end
config firewall policy
    edit 900
        set name "WCCP 900 proxies egress"
        set srcintf "internal"
        set dstintf "wan1"
        set action accept
        set srcaddr "WCCP-PROXIES"
        set dstaddr "all"
        set schedule "always"
        set service "ALL"
        set nat enable
        set wccp disable
    next
    edit 901
        set name "WCCP 901 Proxy-190"
        set srcintf "internal"
        set dstintf "wan1"
        set action accept
        set srcaddr "WCCP-G-Proxy-190"
        set dstaddr "all"
        set schedule "always"
        set service "HTTP" "HTTPS"
        set nat disable
        set wccp enable
    next
end
config firewall policy
    move 900 before 12
    move 901 after 900
end

The address objects are left out of this excerpt.

Warning: when no proxy is registered, the FortiGate lets the traffic of the WCCP policies go out without NAT.
On a public WAN, web access is then lost until a proxy registers again.

The WCCP policies must stay in nat disable.
With NAT, the FortiGate translates the source before the redirection and the proxy only sees the FortiGate address.

The WCCP policies only target the WAN interface.
Traffic toward internal networks never crosses them and is not redirected.

Check the status

The Status tab shows the proxy service and a readiness audit.
The audit checks the local side only:

Status tab with the readiness audit

Check What it verifies
FortiGate integration enabled The integration is installed
Legacy WCCP service disabled No conflict with Your Proxy » WCCP
Proxy running Squid is up
Squid carries the WCCP fix The installed build accepts the FortiGate capabilities
HTTP / HTTPS interception port listening Squid listens on 35025 and 35026
TPROXY kernel modules, routing table, firewall rules The local interception chain is in place
WCCP configuration consistent /etc/squid3/wccp.conf matches the settings
WCCP port UDP 2048 open Squid has opened its WCCP socket
FortiGate on the same subnet Layer 2 redirection is possible
Squid WCCP log The last WCCP messages of Squid

Ready for the FortiGate does not prove that the FortiGate accepted the proxy.
Check it on the FortiGate:

diagnose test application wccpd 3

Each service (0 and the HTTPS service ID) must list the proxy with usable=1:

service-70 in vdom-root: num=1, usable=1
cache server ID:
len=44, addr=192.168.1.29, weight=4135, status=0
rcv_id=1316, usable=1, fm=2, nq=0, dev=23(k23), to=192.168.1.1

diagnose test application wccpd 2 shows the services and interfaces known to the FortiGate.
diagnose debug application wccpd -1 then diagnose debug enable follow the WCCP exchanges live.
The FortiGate displays a weight that differs from the value set on the proxy (4135 for 10000).
This is why the same weight must be kept on every proxy.

From a client of a redirected group, browse a site.
The proxy access log then shows the real client address.

Statistics

The Statistics tab shows the HTTP and HTTPS traffic that clients send toward the proxy.
It works in transparent mode and in WCCP mode.
Choose the period in the page header: 48 h (5-minute samples), 7 d (hourly totals), 30 d (daily totals) or Weeks.

Statistics tab

The counters only see the client to proxy direction.
Downloaded responses are not included.
A collection gap is drawn as a gap, never as zero.

Several proxies with Artica Meta

Several proxies can share one FortiGate.
The Fortigate WCCP policy of Artica Meta gives them the same settings and the same rules:

  1. Import the settings and rules from a configured proxy.
  2. Attach the policy to the other proxies.
  3. Paste the FortiOS commands shown by the policy into the FortiGate.

On a managed proxy, the settings and the objects delivered by the policy are read-only.
Only the weight can still be changed locally.

Troubleshooting

Symptom Cause and fix
The audit reports Squid not patched The proxy runs a stock Squid.
Update the proxy package.
The proxy only sees the FortiGate address A WCCP policy has nat enable.
Set nat disable.
No traffic reaches the proxy Check set wccp enable on the LAN interface, UDP 2048 and the policy order (move commands).
Web access lost for redirected clients No proxy is registered.
The FortiGate sends the traffic out without NAT.
HTTPS is not redirected No SSL inspection certificate on the proxy, so the HTTPS service is not declared.
The legacy WCCP service cannot be enabled The FortiGate integration is active.
Uninstall it first.