Skip to content

mekutr/http-secure-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP Secure Proxy

This is a reverse proxy server implementation to detect attack vectors while proxying http traffic to the downstream services.


Features

  • Reverse proxy implementation in Go
  • Request and response inspection
  • Attack detection
    • Brute force
    • SQL injection
    • File inclusion

Example Output

2:23AM WRN SQL injection attack detected Addr=192.168.65.1 Description="logical expression pattern" Pattern="or 1=1"
2:23AM WRN SQL injection attack detected Addr=192.168.65.1 Description="comment pattern" Pattern=--
2:23AM WRN File inclusion attack detected Addr=192.168.65.1 Reason="traversal path"
2:23AM WRN File inclusion attack detected Addr=192.168.65.1 Reason="forbidden path"
2:24AM WRN Bruteforce attack detected Addr=192.168.65.1 Reason="high ip-token count"

Architecture

/cmd/server

Main application directory for the http reverse proxy server.

/app/attack

This directory has the core implementation for attack detectors.

/app/proxy

This directory includes the core implementation of the reverse proxy. This is where various detectors are used while proxying traffic.

/app/util

Util implements the common utility libraries that are shared by different implementations in this package.

/app/config

Implements the configuration layer for the application. This is where we define the bootstrapper, logger, etc.


Getting Started

Prerequisites

  • Go >= 1.25
  • Docker (optional)

Installation

Clone the repository:

git clone https://github.com/mekutr/http-reverse-proxy.git
cd http-reverse-proxy

Configure environment variables:

PROXY_PORT=9090 # This is the port where the reverse proxy listens to the incoming traffic.
PROXY_TARGET_URL=http://localhost:9191 # Target URL to proxy the incoming traffic.
ENABLE_PRETTY_LOGGING=true # Pretty logs makes it more readable while testing locally.

Build and run the project:

go build -o hsp ./cmd/server/main.go
./hsp

Installation (Docker)

Clone the repository:

git clone https://github.com/mekutr/http-reverse-proxy.git
cd http-reverse-proxy

Configure environment variables: Edit the following environment variables in the Dockerfile if you would like to

# Environment variables
ENV PROXY_PORT=9090 \
    PROXY_TARGET_URL=http://host.docker.internal:9191 \
    ENABLE_PRETTY_LOGGING=true

Build and run the project:

docker build -t http-secure-proxy:1.0 . # builds the docker image
docker run --name hsp -d -it -p 9090:9090 http-secure-proxy:1.0  # Enables interactive terminal in detached mode
docker logs -f hsp # read logs from the interactive terminal

About

This is a reverse proxy server implementation to detect attack vectors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published