View Source Agent Internals

introduction

Introduction

The main tasks of the Paraxial.io agent are:

  1. Record incoming HTTP requests and send them to the Paraxial.io backend for processing

  2. Enforce bans against IP addresses

  3. Enforce rules with a time period of < 30 seconds, using local ETS tables for state

information-sent-received-by-agent

Information Sent/Received by Agent

Sent to backend:

  • Bundles of HTTP requests, Paraxial.HTTPBuffer.send_http(state),

Retrieved from backend for local use:

  • Local rules in Paraxial.Crow
  • Bans from backend in Paraxial.Crow

Important values:

  • How often are HTTP request bundles sent to backend? (3 seconds)
  • Max length of local rules (30 seconds)
  • Local bans cleared (60 seconds)

Paraxial Agent: Crow:

  • Every 3 seconds, update_local_rules() and update_backend_bans()
  • Every 60 seconds, clear local bans

HTTPBuffer:

  • Every 3 seconds, send http bundle and clear local state.

Paraxial.io backend: @local_rule_max_seconds 30

  • only rules with a time period < @local_rule_max_seconds are sent to agent

plug-module-function-map

Plug -> Module -> Function Map

AllowedPlug -> Paraxial.Crow.eval_http(conn)

RecordPlug ->

  • if conn.assigns[:allowed] == false, halt the conn
  • Paraxial.HTTPBuffer.add_http_event(conn/halted_conn)

ets-tables

ETS Tables

Crow:

  • :backend_bans
  • :local_bans
  • :rule_names

LocalRule:

  • :local_rule_n
  • ets_atom is used for table name
  • etsatom is :"local_rule#{rule.id}"