]> git.ipfire.org Git - location/libloc.git/blob - man/location.txt
importer: Drop EDROP as it has been merged into DROP
[location/libloc.git] / man / location.txt
1 = location(1)
2
3 == NAME
4 location - Query the location database
5
6 == SYNOPSIS
7 [verse]
8 `location export --directory=DIR [--format=FORMAT] [--family=ipv6|ipv4] [ASN|CC ...]`
9 `location get-as ASN [ASN...]`
10 `location list-countries [--show-name] [--show-continent]`
11 `location list-networks-by-as ASN`
12 `location list-networks-by-cc COUNTRY_CODE`
13 `location list-networks-by-flags [--anonymous-proxy|--satellite-provider|--anycast|--drop]`
14 `location lookup ADDRESS [ADDRESS...]`
15 `location search-as STRING`
16 `location update [--cron=daily|weekly|monthly]`
17 `location verify`
18 `location version`
19
20 == DESCRIPTION
21 `location` retrieves information from the location database.
22 This data can be used to determine someone's location on the Internet
23 and for building firewall rulesets to block access from certain ASes
24 or countries.
25
26 == OPTIONS
27
28 --database FILE::
29 -d FILE::
30 The path of the database which is being opened.
31 +
32 If this option is omitted, the system's database will be opened.
33
34 --quiet::
35 Enable quiet mode
36
37 --debug::
38 Enable debugging mode
39
40 == COMMANDS
41
42 'export [--directory=DIR] [--format=FORMAT] [--family=ipv6|ipv4] [ASN|CC ...]'::
43 This command exports the whole database into the given directory.
44 +
45 The output can be filtered by only exporting a certain address family, or by passing
46 a list of country codes and/or ASNs. The default is to export all known countries.
47 +
48 The output format can be chosen with the '--format' parameter. For possible formats,
49 please see below.
50 +
51 If the '--directory' option is omitted, the output will be written to stdout which
52 is useful when you want to load any custom exports straight into nftables or ipset.
53
54 'get-as ASN [ASN...]'::
55 This command returns the name of the owning organisation of the Autonomous
56 System.
57
58 'list-countries [--show-name] [--show-continent]'::
59 Lists all countries known to the database.
60 +
61 With the optional parameters '--show-name' and '--show-continent', the name and
62 continent code will be printed, too.
63
64 'list-networks-by-as [--family=[ipv6|ipv4]] [--format=FORMAT] ASN'::
65 Lists all networks which belong to this Autonomous System.
66 +
67 The '--family' parameter can be used to filter output to only IPv6 or
68 IPv4 addresses.
69 +
70 The '--format' parameter can change the output so that it can be
71 directly loaded into other software. For details see below.
72
73 'list-networks-by-cc [--family=[ipv6|ipv4]] [--format=FORMAT] COUNTRY_CODE'::
74 Lists all networks that belong to a country.
75 +
76 The country has to be encoded in ISO3166 Alpha-2 notation.
77 +
78 See above for usage of the '--family' and '--format' parameters.
79
80 'list-networks-by-flags [--family=[ipv6|ipv4]] [--format=FORMAT] [--anonymous-proxy|--satellite-provider|--anycast|--drop]'::
81 Lists all networks that have a certain flag.
82 +
83 See above for usage of the '--family' and '--format' parameters.
84
85 'list-bogons [--family=[ipv6|ipv4]] [--format=FORMAT]'::
86 Lists all bogons (i.e. networks that are unknown to the database).
87 +
88 See above for usage of the '--family' and '--format' parameters.
89
90 'lookup ADDRESS [ADDRESS...]'::
91 This command returns the network the given IP address has been found in
92 as well as its Autonomous System if that information is available.
93
94 'search-as STRING'::
95 Lists all Autonomous Systems which match the given string.
96 +
97 The search will be performed case-insensitively.
98
99 'update'::
100 This command will try to update the local database.
101 +
102 It will terminate with a return code of zero if the database has been
103 successfully updated. 1 on error, 2 on invalid call and 3 if the
104 database was already the latest version.
105 +
106 The '--cron' option allows limiting updates to once a day ('daily'), once a week
107 ('weekly'), or once a month ('monthly'). If the task is being called, but the
108 database has been updated recently, an update will be skipped.
109
110 'verify'::
111 Verifies the downloaded database.
112
113 'version'::
114 Shows the version information of the downloaded database.
115
116 '--help'::
117 Shows a short help text on using this program.
118
119 '--version'::
120 Shows the program's version and exists.
121
122 == EXIT CODES
123 The 'location' command will normally exit with code zero.
124 If there has been a problem and the requested action could not be performed,
125 the exit code is unequal to zero.
126
127 == FORMATS
128 Some commands allow specifying the output format. This is helpful if the exported
129 data should be imported into a packet filter for example.
130 The following formats are understood:
131
132 * 'list' (default): Just lists all networks, one per line
133 * 'ipset': For ipset
134 * 'nftables': For nftables
135 * 'xt_geoip': Returns a list of networks to be loaded into the
136 xt_geoip kernel module
137
138 == HOW IT WORKS
139 The downloader checks a DNS record for the latest version of the database.
140 It will then try to download a file with that version from a mirror server.
141 If the downloaded file is outdated, the next mirror will be tried until we
142 have found a file that is recent enough.
143
144 == BUG REPORTS
145 Please report all bugs to the bugtracker at https://bugzilla.ipfire.org/;
146 refer to https://wiki.ipfire.org/devel/bugzilla for details.
147
148 == AUTHORS
149 Michael Tremer