A service which updates the WAF IP blocklist

autowaf

A service which updates the WAF IP blocklist

Development

Project is currently in development phase.

Build

Build and run locally

go build -o autowaf && ./autowaf -ldb

The -ldb argument will change the database port to 54300 and change the update-rate to 1 minute. It will also prevent the app from trying to get database credentials from cloudfoundry environmental variables.

Environmental vars

BLOCKLIST_NAME

BLOCKLIST_NAME is the name of the blocklist to update on the WAF. Defaults to: autoblocklist-DEV

AWS_REGION

AWS_REGION is a comma separated list with the AWS region(s) of the blocklist(s). It defaults to us-east-1. Currently 1+ regions are supported.

SHORT_PERIOD

SHORT_PERIOD is the duration used for a short term ban query. It defaults to 6 (hours) and must be an integer.

LONG_PERIOD

LONG_PERIOD is the duration used for a long term ban query. It defaults to 720 (hours) and must be an integer.

SHORT_LIMIT

SHORT_LIMIT is the limiting number of requests over SHORT_PERIOD that results in a short term ban. It defaults to 10 and must be an integer.

LONG_LIMIT

LONG_LIMIT is the limiting number of requests over LONG_PERIOD that results in a long term ban. It defaults to 15 and must be an integer.

UPDATE_RATE

UPDATE_RATE is the number of minutes before the background thread updates the WAF. It defaults to 5.

RETENTION_PERIOD

RETENTION_PERIOD is the number of days to keep records in the logon_audit table. It defaults to 90 and must be an integer.

DB_USER

DB_USER is the username used for connecting to a postgres database. It is ignored unless -ldb is passed. It defaults to postgres.

DB_NAME

DB_NAME is the database named used for connecting to a postgres database. It is ignored unless -ldb is passed. It defaults to postgres.

DB_PASSWORD

DB_PASSWORD is the database password used when connecting to a postgres database. It is ignored unless -ldb is passed. It defaults to mysecretpassword.

DB_HOSTNAME

DB_HOSTNAME is the database hostname used when connecting to a postgres database. It is ignored unless -ldb is passed. It defaults to localhost.

API

/loginfailure

This API takes in a JSON object with the following fields:

  • ts: a timestamp in RFC3339 format

  • ip: the IP address that’s the source of the failed login attempt. Can be IPv4, IPv6 or IPv4 vis IPv6

  • username: the username of the failed login attempt

  • pwhash: [optional] the password hash

  • reason: the reason for the failure (e.g. PASSWORD_FAILURE)

The service will return the following status code:

  • 200: Success

  • 422: Unprocessable Entity - there was a problem with the JSON object passed to the API

  • 500: Other internal error occurred in the service

/unblockIP

This API takes in a JSON object with the following fields:

  • ip: the IP address to be unbanned

The service will return the following status code:

  • 200: Success - Whether or not IP was found in database or blocklist

  • 422: Unprocessable Entity - there was a problem with the JSON object passed to the API

  • 500: Other internal error occurred in the service

/healthcheck

The healthcheck API takes in no values and returns a 200 if the service is healthy.

Owner
Jeremy Mill
I write code
Jeremy Mill
Similar Resources

A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy

A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy

Fake-SMS A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a pr

Dec 31, 2022

A webpage bookmarking and snapshotting service

Omnom A webpage bookmarking and snapshotting service. Omnom is a rebooted implementation of @stef's original omnom project, big thanks for it.

Nov 22, 2022

GoatCounter is an open source web analytics platform available as a hosted service or self-hosted app

GoatCounter is an open source web analytics platform available as a hosted service (free for non-commercial use) or self-hosted app. It aims to offer easy to use and meaningful privacy-friendly web analytics as an alternative to Google Analytics or Matomo.

Dec 29, 2022

Example patterns for distributed service

Cloud Native Tulisan ini akan mengulas hasil pembelajaran dari beberapa sumber #learn-from-books. Dan terinspirasi dari obrolan The Pursuit of Product

Jan 30, 2022

Minimal go library to relay webhook events back to an arbitrary service.

hookrelay Minimal go library to relay webhook events back to an arbitrary service. With the use of a primary HTTP mux router, we are able to register

Nov 3, 2021

Birthdays is a web service that stores the birthday date of users and calculates the remaining days until the user's birthday.

Birthdays is a web service that stores the birthday date of users and calculates the remaining days until the user's birthday.

Birthdays is a web service that stores the birthday date of users and calculates the remaining days until the user's birthday. Features Metrics servic

May 2, 2022

GoTrue is a small open-source API written in Golang, that can act as a self-standing API service for handling user registration and authentication for Jamstack projects.

GoTrue is a small open-source API written in Golang, that can act as a self-standing API service for handling user registration and authentication for Jamstack projects.

GoTrue is a small open-source API written in Golang, that can act as a self-standing API service for handling user registration and authentication for Jamstack projects.

Dec 13, 2021

Implement a REST API to drive a UI for service management

An implementation an API of the specification the drive a UI for engaging with services of an organization.

Nov 3, 2021

This service finds and — if necessary — generates icons for web sites

This service finds and — if necessary — generates icons for web sites

favicon-service (besticon) This is a favicon service: Supports favicon.ico and apple-touch-icon.png Simple URL API Fallback icon generation Docker ima

Nov 2, 2021
A simple file-based service to stand in for the remote-service proxy on Apigee.

Apigee-Remote-Service-File A simple file-based service to stand in for the remote-service proxy on Apigee. All configuration is done locally in a YAML

Nov 3, 2021
an online REST renting book platform which you can authenticate, order, reserve a book in your account.
an online REST renting book platform which you can authenticate, order, reserve a book in your account.

BOOK MAN an online REST renting book platform which you can authenticate, order, reserve a book in your account. it's a microservices project with hig

Jul 22, 2022
It is a clone of the CRUD operations on Instagram which can create, get, create posts and get the post along with pagination
It is a clone of the CRUD operations on Instagram which can create, get, create posts and get the post along with pagination

Instagram-API-Clone It is a basic version of a RESTful API based on Instagram where we can create user, get the users, create post and get post and ge

Jan 25, 2022
This is a very simple web-app which simply always returns HTTP status code 200

Responder This is a very simple web-app which simply always returns HTTP status code 200. It will also wait for an amount of time which can be set in

Dec 14, 2021
A simple web application written in Golang which listens on port 8080

GoWebApp It's a simple web application written in Golang which listens on port 8080 Building It can be build using the command go build -o metricsweba

Oct 21, 2021
There are 1,000,000 uatoms in an atom, a fact which I frequently forget and/or second-guess.

There are 1,000,000 uatoms in an atom, a fact which I frequently forget and/or second-guess. This repo contains a lot of programming to save myself a little bit of remembering.

Nov 14, 2021
This is application for Book Keeping which implements fully-fledged REST API

This is application for Book Keeping which implements fully-fledged REST API #We are using Gorilla Mux

Dec 28, 2021
Chat backend which serves REST APIs

Chat backend which serves REST APIs

Nov 24, 2021
Simple online shop which is implemented using golang

Espresso The service that we’re going to build is a simple OnlineShop. It will provide APIs for the frontend to do following things: Create and manage

Nov 28, 2021
A barebones Go app, which can easily be deployed to Heroku

go-getting-started A barebones Go app, which can easily be deployed to Heroku. This application supports the Getting Started with Go on Heroku article

Nov 29, 2021