Sign inSign up

f4sx/blacklist-checker

By f4sx

•Updated almost 2 years ago

Is Your IP Blacklisted? Don't Get Blocked! Stay Ahead of Threats

Image
Networking
0

1.1K

f4sx/blacklist-checker repository overview

Instructions:

This project provides a service that checks if IP addresses are blacklisted. It's containerized with Docker and designed to integrate with other services like RabbitMQ and PostgreSQL, while storing data in MongoDB.

Prerequisites:

  • Docker and Docker Compose installed
  • A running RabbitMQ instance
  • A running PostgreSQL instance
  • A MongoDB database

Setup:

  1. Pull the image from Docker Hub: docker pull f4sx/blacklist-checker:tagname (Replace tagname with the appropriate tag if needed)
  2. Create a config.env file: Use the following example as a template and fill in your actual settings for MongoDB, RabbitMQ, and PostgreSQL. Do not include any sensitive information like passwords or IP addresses in this file.
# MongoDB Ayarları
MONGO_URL="mongodb+srv://<username>:<password>@<cluster-address>/<database-name>" 
MONGO_DB_NAME="<database-name>"

# RabbitMQ Ayarları
RABBITMQ_HOST="<rabbitmq-host>"
RABBITMQ_PORT=<rabbitmq-port>
RABBITMQ_USERNAME="<rabbitmq-username>"
RABBITMQ_WEB_UI_PORT=<rabbitmq-web-ui-port>
RABBITMQ_AMQP_PORT=<rabbitmq-amqp-port>
RABBITMQ_DEFAULT_QUEUE="<rabbitmq-queue-name>"
RABBITMQ_CONCURRENCY_LIMIT=<rabbitmq-concurrency-limit>

# PostgreSQL Ayarları
POSTGRES_USERNAME="<postgres-username>"
POSTGRES_DB="<postgres-database-name>"
POSTGRES_HOST="<postgres-host>"
POSTGRES_PORT=<postgres-port>

# Log Dosyaları
APP_LOG_PATH=logs/application.log
ERROR_LOG_PATH=logs/error.log
  1. Create a docker-compose.yml file:
version: "3.7"

services:
  spdnet_ip_tracker:
    image: f4sx/blacklist-checker
    secrets:
      - rabbitmq_password
      - rabbitmq_erlang_cookie
      - postgres_password
    env_file:
      - config.env
    environment:
      RUN_ENV: "docker"
      RABBITMQ_PASSWORD_FILE: /run/secrets/rabbitmq_password
      RABBITMQ_ERLANG_COOKIE_FILE: /run/secrets/rabbitmq_erlang_cookie
      POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
      MONGO_URL: "mongodb+srv://<username>:<password>@<cluster-address>/<database-name>" 
    ports:
      - "127.0.0.1:8000:8000"  # Sadece localhost erişimi
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
      placement:
        constraints: [node.role == manager]  # Sadece manager node'larda çalıştır
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

secrets:
  rabbitmq_password:
    external: true
  rabbitmq_erlang_cookie:
    external: true
  postgres_password:
    external: true
  1. Create Docker secrets for sensitive information:

    echo "<your_rabbitmq_password>" | docker secret create rabbitmq_password -
    echo "<your_rabbitmq_erlang_cookie>" | docker secret create rabbitmq_erlang_cookie -
    echo "<your_postgres_password>" | docker secret create postgres_password -
    
  2. Start the containers: docker-compose up -d

Docker Swarm:

If you want to deploy the service on a Docker Swarm cluster, follow these steps:

  1. Initialize Swarm: docker swarm init
  2. Create secrets (same as above):
    echo "<your_rabbitmq_password>" | docker secret create rabbitmq_password -
    echo "<your_rabbitmq_erlang_cookie>" | docker secret create rabbitmq_erlang_cookie -
    echo "<your_postgres_password>" | docker secret create postgres_password -
    
  3. Deploy the stack: docker stack deploy -c docker-compose.yml spdnet_ip_tracker

Notes:

  • Replace the placeholder values (e.g., <your_rabbitmq_password>, <username>, <cluster-address>) with your actual credentials.
  • The config.env file and Docker secrets contain sensitive information, so keep them secure.
  • If you're not using Docker Swarm, you can remove the deploy section from the docker-compose.yml file.

Tag summary

Content type

Image

Digest

sha256:5070f5fd4…

Size

3.2 GB

Last updated

almost 2 years ago

docker pull f4sx/blacklist-checker