Skip to content
Snippets Groups Projects
Commit 0a200936 authored by ale's avatar ale
Browse files

Add some documentation on external sources

parent 289f0292
Branches
No related tags found
No related merge requests found
......@@ -39,7 +39,32 @@ submission and querying. The query API is a simple IP lookup,
returning a score. This conceivably could be turned into a DNS-based
API as well.
## Third-party sources
## External sources
It would be nice to allow the scoring script to consult other IP-based
third-party sources, such as DNSBLs, or GeoIP lookups, etc.
The scoring script can consult other IP-based third-party sources, such
as DNSBLs, or GeoIP lookups, etc.
These are configured via YAML snippets in a directory, each file
corresponding to a separate external source.
Each source configuration should specify the following parameters:
* *name*, the name of the source
* *type*, one of the supported source types (either *dnsbl* or *geoip*
at the moment)
* *params*, a dictionary of further type-specific configuration
parameters.
The parameters for *dnsbl* source type are:
* *domain*, the DNSBL domain to query
* *match*, a regexp pattern for the DNS query result. The default is
".*", i.e. any result will be regarded as a positive match.
The parameters for *geoip* source type are:
* *paths*, a list of paths to MaxMind GeoIP databases. The default
list contains a single path, /var/lib/GeoIP/GeoLite2-Country.mmdb
External sources can be used in the scoring script by calling the
*ext()* function, with the source name and IP address as parameters.
......@@ -29,7 +29,7 @@ func New(sourceType string, params map[string]interface{}) (ExternalSource, erro
}
match, ok := params["match"].(string)
if !ok {
return nil, errors.New("missing parameter 'match'")
match = ".*"
}
return dnsbl.New(domain, match)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment