• Stars
    star
    107
  • Rank 323,587 (Top 7 %)
  • Language
    Go
  • Created over 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

REST server for fail2ban

fail2rest

Overview

fail2rest is a small REST server that aims to allow full administration of a fail2ban server via HTTP

fail2rest will eventually be used as a backend to a small web app to make fail2ban administration and reporting easier.

Requirements

fail2rest is written in Golang, so it requires a working Golang installation. If you have never used Golang before install it from your package manager, and then follow these instructions to setup your enviroment.

Some libraries currently are not building on older versions of Go, I recommend running the newest stable of Golang.

Installing

Once you have a working Golang installation all you need to do is run

go get -v github.com/Sean-Der/fail2rest
go install -v github.com/Sean-Der/fail2rest

fail2rest will now be available as a binary in your GOPATH, you can run 'fail2rest' from the command line, or copy it somewhere else to make it available to all users.

Use whereis fail2rest to locate your fail2rest binary. Next you need to configure fail2rest, and then finally make it a system service.

Configuration

fail2rest is configured via config.json, the default is located here. To load your config.json you use the --config flag fail2rest --config=my_config.json

fail2rest has two options that be configured via config.json

  • Fail2banSocket - The path to the fail2ban socket, can usually be found via grep socket /etc/fail2ban/fail2ban.conf you also have to run fail2rest as a user who has permissions to use this socket
  • Addr - The address that fail2rest is served upon, it is usually best so serve to the loopback, and then allow access via nginx see an example config in the fail2web repository

The default configuration file used by init-scripts is /etc/fail2rest.json. You should download the config to your /tmp/ dir and modify it to your needs.

cd /tmp/
wget https://raw.githubusercontent.com/Sean-Der/fail2rest/master/config.json

Once you finished editing the configuration file, you should move it from /tmp/config.json to /etc/fail2rest.json executing mv /tmp/config.json /etc/fail2rest.json

Running

Once you have a config.json all you need to do is run fail2rest --config config.json

However, fail2rest is designed to run as a service, so init scripts are provided that allow easy management of fail2rest. They can be found here Download the appropriate init file your Distribution. You may need to customize your init script to load your config.json, but most scripts default to /etc/fail2rest.json

Service

systemd

To run as a service you can either copy or create symlinks for systemd and the fail2rest binary. The systemd file shold be added to /etc/systemd/system/fail2rest.service and the the binary to /usr/bin/fail2rest. This scenario will use the symlinks in order to always use the latest files. You should run the commands with sudo if not logged in as root:

ln -s $GOPATH/bin/fail2rest /usr/bin/

Debian

ln -s $GOPATH/src/github.com/Sean-Der/fail2rest/init-scripts/systemd /etc/systemd/system/fail2rest.service

Other Linux

ln -s $GOPATH/src/github.com/Sean-Der/fail2rest/init-scripts/systemd /usr/lib/systemd/system/fail2rest.service

Enable fail2rest service to run at startup

systemctl enable fail2rest.service

Run the following systemd command to start the fail2rest service

systemctl start fail2rest.service

Verify that the fail2rest service it is active and running

systemctl status fail2rest.service

License

The MIT License (MIT)

Copyright (c) 2014 Sean DuBois

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

fail2web

a fail2ban GUI powered by fail2rest
JavaScript
542
star
2

OBS2Browser

Send OBS directly to your browser, no more wasting time on servers
Go
102
star
3

Therac

A Simple PHP Pair Debugger
PHP
95
star
4

rtmp-to-webrtc

Demonstrate a RTMP server that publishes to WebRTC
Go
74
star
5

obs-into-discord

Send OBS directly into Discord. No Virtual Camera or transcoding needed!
JavaScript
26
star
6

embedded-sdk

LiveKit SDK for Embedded
C++
19
star
7

fail2go

Go library to abstract away communication with the fail2ban socket
Go
18
star
8

wasm-audio-decode

An example of using pion/opus in WASM to decode audio files - https://sean-der.github.io/wasm-audio-decode/
JavaScript
15
star
9

ffmpeg-in-memory-rtp-decoder

A example of decoding RTP packets that are in memory using FFmpeg
C++
12
star
10

WebSQL-For-FireFox

HTML5 WebSQL for Firefox
JavaScript
9
star
11

webrtc-uri

WebRTC URI for remote resource identification and local configuration
Makefile
8
star
12

pipeshout

Easily combine multiple outputs. Allowing you to filter, examine and debug multiple processes at once.
Go
7
star
13

pion-bidirectional-simulcast

An example that shows Sending and Receiving Simulcast with Pion
Go
6
star
14

pion-webrtc-shared-socket

Demonstration of using Pion WebRTC with a shared socket
Go
6
star
15

play-from-disk-h264

Example of using Pion WebRTC to play H264 + Ogg from disk
Go
6
star
16

pion-unbundled

An example of using Pion WebRTC with a Unbundled PeerConnection.
Go
6
star
17

dot_files

Collection of my configs and personal programs.
Vim Script
4
star
18

pipelisten

A frontend to pipeshout https://github.com/Sean-Der/pipeshout
JavaScript
4
star
19

pion-ulaw-player

Give a file containing ulaw play in the browser using Pion WebRTC
Go
4
star
20

Go-WebRTC-GStreamer

Go
4
star
21

appsrc-to-appsink

Example of using Pion to accept WebRTC, GStreamer to Decode and return the buffers back to Go
Go
4
star
22

goWHOIS

A very simple Golang WHOIS client
Go
3
star
23

pion-bench

Repo to run profiling/benching of Pion WebRTC.
Go
3
star
24

avcodec-avformat-rtmp

An example of using avcodec + avformat to encode H264 and send to a RTMP Server
C++
3
star
25

whep-static

A WHEP Server that serves a static file. Useful for testing WHEP Clients
Go
2
star
26

Firefox2dwb

Python Script to convert Firefox bookmarks to dwb's format
Python
2
star
27

pion-pcm-e2e

Example of using Pion WebRTC with PCM E2E
Go
2
star
28

audio-spew

Demo to show sending a directory of Opus samples using Pion WebRTC
Go
2
star
29

ice-tcp-test

Repo to test ICE-TCP and allows Pion to be Offer or Answerer
Go
2
star
30

resume

Code for resume, written in LaTeX
TeX
1
star
31

webWaiter

A simple threaded HTTP server
C
1
star
32

go-h264-decode-scale-encode

Example in Go of Decoding+Scaling+Encoding H264
Go
1
star
33

gst-plugins-rs

Personal fork of https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs
Rust
1
star