Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fabriziofiorucci/nap-compiler-rest-api

A REST API for NGINX App Protect WAF 5.0 Compiler
https://github.com/fabriziofiorucci/nap-compiler-rest-api

app-protection nginx rest-api

Last synced: 4 days ago
JSON representation

A REST API for NGINX App Protect WAF 5.0 Compiler

Awesome Lists containing this project

README

        

# REST API for NGINX App Protect WAF Compiler

This repository provides a set of REST API to use the NGINX App Protect policy compiler within an automation pipeline.
The service can be run either on `docker-compose` or on `Kubernetes`.

## Requirements

- NGINX App Protect WAF Compiler
- docker version v24+ to build the image
- One of:
- Docker-compose v2.20+
- Kubernetes cluster

## REST API Endpoints

- `/v1/compile/policy` - compiles a JSON policy into a bundle
- Method: `POST`
- Payload: `{"global-settings": "", "policy": ""}`
- `/v1/compile/logprofile` - compiles a log profile JSON into a bundle
- Method: `POST`
- Payload: `{"logprofile": ""}`
- `/v1/bundle/info` - returns details on a compiled bundle
- Method: `POST`
- Payload: `{"bundle": ""}`

Headers required for all endpoints:

```
Content-Type: application/json
```

## Building the Docker image

The docker image can be built using:

```
docker build --no-cache -f Dockerfile \
--secret id=nginx-key,src= --secret id=nginx-crt,src= \
-t .
```

Example:

```
docker build --no-cache -f Dockerfile \
--secret id=nginx-key,src=/etc/ssl/nginx/nginx-repo.key --secret id=nginx-crt,src=/etc/ssl/nginx/nginx-repo.crt \
-t nap-compiler:latest .
```

Note: the docker image is automatically built by the `docker-compose.yaml` in the example

## How to run

This repository can be run on:

- [Docker compose](contrib/docker-compose)
- [Kubernetes](contrib/kubernetes)

## How to test

- See the [examples](contrib/examples)
- Use the [Postman collection](contrib/postman)