# Project    : ipv6calc/mod_ipv6calc
# File       : ipv6calc.conf
# Version    : $Id$

## Information
# Depending on module options and available databases following environment variables are set
#  IPV6CALC_CLIENT_IP_ANON		anonymized IP address
#  IPV6CALC_CLIENT_COUNTRYCODE		country code of IP address
#  IPV6CALC_CLIENT_ASN			ASN of IP address
#  IPV6CALC_CLIENT_REGISTRY		Registry of IP address
#  IPV6CALC_CLIENT_GEONAMEID		GeonameID of IP address
#  IPV6CALC_ANON_METHOD			used anonymization method

## Activation
# following steps are necessary to activate all the features, see also below
# 1. enable loading of module
# 2. enable module itself
# 3. enable (additional) custom log directive 
# optional for testing/demonstration
# 4. extend ACL to ipv6calc.cgi
# 5. copy ipv6calc.cgi to /var/www/cgi-bin

## enable this config option to activate the module (step 1)
#LoadModule ipv6calc_module modules/mod_ipv6calc.so

<IfModule mod_ipv6calc.c>
	#### module options

	## enable module (step 2)
	#ipv6calcEnable				on

	## activate by default (can be controlled by environment 'ipv6calcActive' or 'ipv6calcPassive' using SetEnv/SetEnvIf)
	# depending on final selection (active or passive) following tokens will be found in environment variables
	# -PbD- : Passive by Default
	# -PbE- : Passive by Environment
	ipv6calcDefaultActive			on

	## do not activate fallbacks or stop (don't start Apache) if this module has an issue
	#ipv6calcNoFallback			on

	## set module debug level (bitwise, see also source code), understands hex and decimal
	# debug all
	#ipv6calcDebuglevel                      -1

	# IPV6CALC_DEBUG_CACHE_LOOKUP
	#ipv6calcDebuglevel                      0x0010
	# IPV6CALC_DEBUG_CACHE_ENTRIES
	#ipv6calcDebuglevel                      0x0020
	# IPV6CALC_DEBUG_CACHE_ENTRIES
	#ipv6calcDebuglevel                      0x0040
	# IPV6CALC_DEBUG_CACHE_STORE
	#ipv6calcDebuglevel                      0x0080

	# IPV6CALC_DEBUG_SHOW_DB_INFO
	#ipv6calcDebuglevel                      0x0100

	# IPV6CALC_DEBUG_SHOW_CLIENT_IP
	#ipv6calcDebuglevel                      0x1000
	#
	# IPV6CALC_DEBUG_SHOW_ENVIRONMENT
	#ipv6calcDebuglevel                      0x2000


	## disable internal cache (default: ON)
	#ipv6calcCache				off

	## change cache limit (min,default/max see source code)
	#ipv6calcCacheLimit			40

	## log cache statistics after amount of requests
	#ipv6calcCacheStatisticsInterval		1000


	### module actions
	## set IPV6CALC_CLIENT_IP_ANON
	ipv6calcActionAnonymize            	on

	## set IPV6CALC_CLIENT_COUNTRYCODE
	ipv6calcActionCountrycode        	on

	## set IPV6CALC_CLIENT_ASN
	ipv6calcActionAsn	        	on
	
	## set IPV6CALC_CLIENT_REGISTRY
	ipv6calcActionRegistry	        	on

	## set IPV6CALC_CLIENT_GEONAMEID
	ipv6calcActionGeonameid	        	on

	#### options forwarded into ipv6calc libraries

	## debugging
	#ipv6calcOption	debug			0x8

	## general database configuration
	#ipv6calcOption	db-external-disable	yes
	#ipv6calcOption	db-ip2location-disable	yes
	#ipv6calcOption	db-geoip2-disable	yes
	#ipv6calcOption	db-dbip2-disable	yes

	## database path configuration (see also ipv6calc -h|-vv)
	#ipv6calcOption db-external-dir		/usr/share/ipv6calc/db
	#ipv6calcOption db-ip2location-dir	/usr/share/IP2Location
	#ipv6calcOption db-geoip2-dir		/usr/share/GeoIP
	#ipv6calcOption db-dbip2-dir		/usr/share/DBIP


	### anonymization settings, see also
	### ipv6calc -A anonymize -h

	## anonymization method: keep-type-asn-cc (requires ASN & CountryCode database)
	ipv6calcOption	anonymize-preset	keep-type-asn-cc

	## anonymization method: zeroize (optional with custom values)
	#ipv6calcOption anonymize-method	zeroize
	#ipv6calcOption mask-ipv4               16
	#ipv6calcOption mask-ipv6               32
	#ipv6calcOption mask-eui64              16
	#ipv6calcOption mask-mac                16
	#ipv6calcOption mask-autoadjust         yes

	## anonymization method: anonymize (optional with custom values)
	#ipv6calcOption anonymize-method	anonymize
	#ipv6calcOption mask-ipv4               16
	#ipv6calcOption mask-ipv6               32
	#ipv6calcOption mask-eui64              16
	#ipv6calcOption mask-mac                16
	#ipv6calcOption mask-autoadjust         yes


	#### log with anonymized client IP (instead of %a/%h) and country code/ASN/Registry/AnonymizationMethod/GeonameID (instead of %l)
	LogFormat "%{IPV6CALC_CLIENT_IP_ANON}e \"%{IPV6CALC_CLIENT_COUNTRYCODE}e/%{IPV6CALC_CLIENT_ASN}e/%{IPV6CALC_CLIENT_REGISTRY}e/%{IPV6CALC_ANON_METHOD}e/%{IPV6CALC_CLIENT_GEONAMEID}e\" %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined_anon

	## enable this config option to get an extra access log (step 3)
	#CustomLog logs/access_anon_log combined_anon
</IfModule>

## Access control
<Location /cgi-bin/ipv6calc.cgi>
	Order	Deny,Allow

	# Allow from localhost
	Allow	from 127.0.0.1
	Allow	from ::1

	# Allow from all (enable this once you want to serve this as a public service
	#Allow	from all

	# Final default
	Deny	from all
</Location>
