NGINX Ingress Controller Integration

OMetaScan NGINX Ingress Controller Configuration

This document covers the new approach using the OPSWAT-customised image on top of the NGINX Ingress Controller Helm chart (maintained by NGINX Org). For the Kubernetes Ingress Controller (EOL March 2026), starting from version of the controller 5.4.2 will be compatible with the Ingress Controller provided by NGINX Org.

ConfigMaps

ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable.

The ConfigMap API resource stores configuration data as key-value pairs. The data provides the configurations for system components for the nginx-controller.

NameTypeDefaultUsage
enable-ometascanbool“false”

Enable or Disable ometascan module globally

Note: You must enable this config to use ometascan module

Annotations

NameTypeDefaultUsage
nginx.org/ometascan-send-timeoutnumber60Sets a timeout for transmitting a request to the proxied server. The timeout is set only between two successive write operations, not for the transmission of the whole request. If the proxied server does not receive anything within this time, the connection is closed.
nginx.org/ometascan-read-timeoutnumber

86400

(1 day)

Defines a timeout for reading a response from the proxied server. The timeout is set only between two successive read operations, not for the transmission of the whole response. If the proxied server does not transmit anything within this time, the connection is closed.
nginx.org/ometascan-pre-cache-sizenumber

9223372036854775807

(maximum number of Nginx)

Config maximum caching size per request.
nginx.org/ometascan-pre-cache"true" or "false""false"Turn on/off pre-caching request when sending to ICAP Server
nginx.org/ometascan-passstringNo default

Sets the protocol and address of a ICAP server and an optional URI to which a location should be mapped.

e.g: http://icap-address:8043

Note: Must have it for enable annotation

nginx.org/ometascan-methodsstringGET HEAD POST PUT PATCH DELETEThis directive specifies HTTP request methods that are considered by ometascan_pass. HTTP request methods not listed will be skipped completely. The following HTTP methods are allowed: GET, HEAD, POST, PUT, PATCH, and DELETE
nginx.org/ometascan-connect-timeoutnumber60Defines a timeout for establishing a connection with a proxied server. It should be noted that this timeout cannot usually exceed 75 seconds.
nginx.org/ometascan-x-forwarded-forstringoffParse X-Forwarded-For for client IP
nginx.org/ometascan-intercept-errorsstringoffIntercept error responses for scanning
nginx.org/ometascan-allow-bad-request-trafficstringoffAllow traffic on ICAP bad request
nginx.org/ometascan-set-headerstringCustom headers to send to ICAP (multi-line)
nginx.org/ometascan-ssl-trusted-certificatestringCA secret reference (namespace/name)
nginx.org/ometascan-ssl-ciphersstringDEFAULTSSL ciphers
nginx.org/ometascan-ssl-protocolsstringTLSv1.2 TLSv1.3SSL protocols
nginx.org/ometascan-ssl-namestring$proxy_hostSSL server name
nginx.org/ometascan-ssl-verifynumber1Certificate chain depth
nginx.org/ometascan-ssl-server-namestringoffEnable SNI
nginx.org/ometascan-ssl-session-reusestringonSSL session reuse
nginx.org/ometascan-health-checkstringThe annotation enables active health checking of the MD ICAP Server upstream. When enabled, NGINX periodically probes the ICAP server and automatically marks it UP or DOWN based on the results. Requests are not sent to servers marked DOWN. E.g: nginx.org/ometascan-health-check: "interval=<ms> [passes=<n>] [fails=<n>] [timeout=<ms>] [jitter=<ms>] [mandatory [persistent]]"

You can add these Kubernetes annotations to specific Ingress objects to customize their behavior.

OMetaScan NGINX Ingress on Minikube

Requirement

Pre-setup

Enable Nginx ingress on Minikube

  • Start minikube
Copy
  • Install the NGINX Ingress controller, following this CLI
Copy
  • Verify that the NGINX Ingress controller is running
Copy

The output is similar to:

Copy

Change the default Nginx Ingress image to Nginx Ingress with the OMetascan module image

  • Update the default image to opswat/nginx-ingress using the following command:
Copy
  • Verify that the images have changed:
Copy

The output:

Copy
  • Verify that the NGINX Ingress controller is replaced and running
Copy

The output is similar to:

Copy

Enable OMetascan Module

  • Set enable-ometascan: "true" to turn on the OMetascan module on ConfigMaps of ingress-nginx-controller:
Copy

Deploy Echo Server as Service A

refer to: https://github.com/Ealenn/Echo-Server#kubernetes

Copy

Example:

  • /path1 rewrite to /subpathA (use ometascan)

  • /path2 rewrite to /subpathB (use ometascan)

    • Only PUT methods
    • Max client body size 100 Mb
  • /path3 rewrite to /subpathC (do not use ometascan)

Copy

OMetaScan NGINX Ingress on Kubernetes

Requirements

  • An existing K8S cluster
  • Helm CLI
  • NGINX Ingress with OMetascan module images:
Copy
  • An existing MD ICAP Server on Kubernetes

Instructions

Example:

1. Install NGINX Ingress Controller via Helm Chart

Copy

Output:

Javascript
Copy

Verify the result, install nginx-ingress as CLI:

Copy

Output:

Javascript
Copy

Make sure your nginx install with status of the pod nginx-ingress is running!

2. Replace The Ingress Controller Image

To replace the ingress controller image, we need to patch the existing k8s resource (deployment, DaemonSet, etc.) for the existing ingress controller to include the new image. For this, edit the ingress-controller-patch-image.yml file and replace the container name to match the existing controller and run the following command (replace 'deployment' and 'ingress-nginx-controller' with your specific resource type and name for the controller):

ingress-controller-patch-image.yml

Copy
Copy

Output:

Javascript
Copy

Create the file update-configmap-ingress-controller.yml

Javascript
Copy
Copy

Output:

Javascript
Copy

3. Deploy A Service To Test with MetaDefender ICAP Server

3.1. Create deployment sample:

Copy

Output:

3.2.Expose service sample:

Copy

Output:

3.3.Create file ingress for sample app:

ingress-be.yml

Copy
Copy

Output:

Add the following line to the bottom of the /etc/hosts file on your computer (you will need administrator access):

Copy

The expected MD ICAP Server will scan requests

VariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches
  Last updated