Skip to content

Configuration Overview

cs-routeros-bouncer can be configured via YAML file and/or environment variables. Environment variables override values from the config file.

The default config file location is /etc/cs-routeros-bouncer/cs-routeros-bouncer.yaml. Override with the -c flag:

Terminal window
cs-routeros-bouncer -c /path/to/config.yaml

A full annotated reference is included in the repository at config/cs-routeros-bouncer.yaml.

All options at a glance. See the dedicated pages for detailed descriptions.

The essential settings to get the bouncer running. Most deployments only need these.

Config KeyEnv VariableDefaultDescription
crowdsec.api_urlCROWDSEC_URLhttp://localhost:8080/CrowdSec LAPI URL
crowdsec.api_keyCROWDSEC_BOUNCER_API_KEY(required)Bouncer API key
mikrotik.addressMIKROTIK_HOST192.168.0.1:8728RouterOS API address (host:port)
mikrotik.usernameMIKROTIK_USERcrowdsecAPI username
mikrotik.passwordMIKROTIK_PASS(required)API password
firewall.ipv4.enabledFIREWALL_IPV4_ENABLEDtrueEnable IPv4 blocking
firewall.ipv6.enabledFIREWALL_IPV6_ENABLEDtrueEnable IPv6 blocking
firewall.filter.enabledFIREWALL_FILTER_ENABLEDtrueCreate filter firewall rules
firewall.raw.enabledFIREWALL_RAW_ENABLEDtrueCreate raw/prerouting rules
firewall.deny_actionFIREWALL_DENY_ACTIONdropAction: drop or reject
logging.levelLOG_LEVELinfoLog level: debug, info, warn, error

Fine-tuning options for decision filtering, TLS, performance, firewall customization, and observability. The defaults work well for most setups.

Config KeyEnv VariableDefaultDescription
crowdsec.update_frequencyCROWDSEC_UPDATE_FREQUENCY10sPoll interval
crowdsec.lapi_metrics_intervalCROWDSEC_LAPI_METRICS_INTERVAL15mUsage metrics reporting interval (0 = disabled)
crowdsec.originsCROWDSEC_ORIGINS[] (all)Filter by origin
crowdsec.scopesCROWDSEC_SCOPES["ip","range"]Decision scopes
crowdsec.supported_decisions_typesCROWDSEC_DECISIONS_TYPES["ban"]Decision types (only ban is implemented)
crowdsec.scenarios_containingCROWDSEC_SCENARIOS_CONTAINING[]Include only matching scenarios
crowdsec.scenarios_not_containingCROWDSEC_SCENARIOS_NOT_CONTAINING[]Exclude matching scenarios
crowdsec.retry_initial_connectCROWDSEC_RETRY_INITIAL_CONNECTtrueRetry on startup
crowdsec.insecure_skip_verifyCROWDSEC_INSECURE_SKIP_VERIFYfalseSkip TLS verify
crowdsec.cert_pathCROWDSEC_CERT_PATHClient cert path
crowdsec.key_pathCROWDSEC_KEY_PATHClient key path
crowdsec.ca_cert_pathCROWDSEC_CA_CERT_PATHCA cert path
Config KeyEnv VariableDefaultDescription
mikrotik.tlsMIKROTIK_TLSfalseUse TLS
mikrotik.tls_insecureMIKROTIK_TLS_INSECUREfalseSkip TLS verify
mikrotik.connection_timeoutMIKROTIK_CONN_TIMEOUT10sConnect timeout
mikrotik.command_timeoutMIKROTIK_CMD_TIMEOUT30sCommand timeout
mikrotik.pool_sizeMIKROTIK_POOL_SIZE4Parallel API connections (1–20)
Config KeyEnv VariableDefaultDescription
firewall.ipv4.address_listFIREWALL_IPV4_ADDRESS_LISTcrowdsec-bannedIPv4 list name
firewall.ipv6.address_listFIREWALL_IPV6_ADDRESS_LISTcrowdsec6-bannedIPv6 list name
firewall.filter.chainsFIREWALL_FILTER_CHAINS["input"]Filter chains
firewall.raw.chainsFIREWALL_RAW_CHAINS["prerouting"]Raw chains
firewall.rule_placementFIREWALL_RULE_PLACEMENTtopPlacement: top or bottom
firewall.comment_prefixFIREWALL_COMMENT_PREFIXcrowdsec-bouncerComment prefix
firewall.logFIREWALL_LOGfalseEnable rule logging
firewall.log_prefixFIREWALL_LOG_PREFIXcrowdsec-bouncerGlobal log prefix
firewall.reject_withFIREWALL_REJECT_WITHReject type when deny_action=reject
firewall.filter.log_prefixFIREWALL_FILTER_LOG_PREFIXOverride log prefix for filter rules
firewall.filter.connection_stateFIREWALL_FILTER_CONNECTION_STATEConnection-state matcher for filter rules
firewall.raw.log_prefixFIREWALL_RAW_LOG_PREFIXOverride log prefix for raw rules
firewall.block_input.interfaceFIREWALL_INPUT_INTERFACERestrict input/raw rules to interface (empty = all)
firewall.block_input.interface_listFIREWALL_INPUT_INTERFACE_LISTRestrict input/raw rules to interface list (empty = all)
firewall.block_input.whitelistFIREWALL_INPUT_WHITELISTAddress-list for input whitelist (accept before drop)
firewall.block_output.enabledFIREWALL_BLOCK_OUTPUTfalseBlock outbound
firewall.block_output.interfaceFIREWALL_OUTPUT_INTERFACEWAN interface
firewall.block_output.interface_listFIREWALL_OUTPUT_INTERFACE_LISTWAN interface list
firewall.block_output.log_prefixFIREWALL_OUTPUT_LOG_PREFIXOverride log prefix for output rules
firewall.block_output.passthrough_v4FIREWALL_OUTPUT_PASSTHROUGH_V4IPv4 client to bypass output blocking
firewall.block_output.passthrough_v4_listFIREWALL_OUTPUT_PASSTHROUGH_V4_LISTIPv4 list to bypass output blocking
firewall.block_output.passthrough_v6FIREWALL_OUTPUT_PASSTHROUGH_V6IPv6 client to bypass output blocking
firewall.block_output.passthrough_v6_listFIREWALL_OUTPUT_PASSTHROUGH_V6_LISTIPv6 list to bypass output blocking
Config KeyEnv VariableDefaultDescription
logging.formatLOG_FORMATtextLog format: text or json
logging.fileLOG_FILELog file path (empty = stdout only)
metrics.enabledMETRICS_ENABLEDfalseEnable Prometheus /metrics endpoint
metrics.listen_addrMETRICS_ADDR0.0.0.0Listen address
metrics.listen_portMETRICS_PORT2112Listen port
metrics.routeros_poll_intervalMETRICS_ROUTEROS_POLL_INTERVAL30sRouterOS system metrics poll interval (0 to disable)