"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) XML source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
4 <article>
5 <!--$Id$-->
6
7 <articleinfo>
8 <title>ISO 3661 Country Codes recognized by Shorewall</title>
9
10 <authorgroup>
11 <author>
12 <firstname>Tom</firstname>
13
14 <surname>Eastep</surname>
15 </author>
16 </authorgroup>
17
18 <pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
19
20 <copyright>
21 <year>2012</year>
22
23 <holder>Thomas M. Eastep</holder>
24 </copyright>
25
26 <legalnotice>
27 <para>Permission is granted to copy, distribute and/or modify this
28 document under the terms of the GNU Free Documentation License, Version
29 1.2 or any later version published by the Free Software Foundation; with
30 no Invariant Sections, with no Front-Cover, and with no Back-Cover
31 Texts. A copy of the license is included in the section entitled
32 <quote><ulink url="GnuCopyright.htm">GNU Free Documentation
33 License</ulink></quote>.</para>
34 </legalnotice>
35 </articleinfo>
36
37 <section>
38 <title>Introduction</title>
39
40 <para>Beginning with Shorewall 4.5.4, Shorewall allows matching packet
41 SOURCE and/or DEST IP addresses by their corresponding country. That is
42 done by specifying a comma-separated list of up to 15 ISO-3661 2-character
43 Country Codes enclosed in square brackets ('[...]') and prefixed by a
44 caret ('^'). When a single country code is given, the square brackets can
45 be omitted.</para>
46
47 <para>Example - Drop email from the Anonymous Proxy and Satellite Provider
48 networks.</para>
49
50 <para><filename>/etc/shorewall/rules</filename>:</para>
51
52 <programlisting> #ACTION SOURCE DEST PROTO DPORT
53
54 ?SECTION NEW
55
56 DROP:info net:^[A1,A2] dmz tcp 25
57 </programlisting>
58
59 <para>Using this feature requires the <firstterm>GeoIP Match</firstterm>
60 capability in your iptables and kernel. That capability requires <ulink
61 url="https://dev.maxmind.com/geoip/geoip2/geolite2/">creating a
62 country-code database</ulink>.</para>
63
64 <para>The Shorewall compiler uses the geoip country-code database to
65 determine the valid set of two-character alphanumeric country codes. The
66 location of that database is currently hard-coded in xtables-addons as
67 <filename>/usr/share/xt_geoip/</filename>. Within that directory are two
68 sub-directories:</para>
69
70 <itemizedlist>
71 <listitem>
72 <para>LE -- contains the little-endian database</para>
73 </listitem>
74
75 <listitem>
76 <para>BE -- contains the big-endian database</para>
77 </listitem>
78 </itemizedlist>
79
80 <para>To accomodate both big-endian and little-endian machines as well as
81 any future ability to install the database at another location, Shorewall
82 supports a GEOIPDIR option in <ulink
83 url="manpages/shorewall.conf.html">shorewall.conf</ulink>(5) and <ulink
84 url="manpages/shorewall.conf.html">shorewall6.conf</ulink>(5). The default
85 value of that option is
86 <filename>/usr/share/xt_geoip/LE</filename>.</para>
87
88 <important>
89 <para>Recent versions of the country-code database are installed in
90 <filename>/usr/share/xt_geoip/, regardless of endian convention. This
91 requires modifying the setting of GEOIPDIR in <ulink
92 url="manpages/shorewall.conf.html">shorewall.conf</ulink> (5) and <ulink
93 url="manpages/shorewall.conf.html">shorewall6.conf</ulink>(5).</filename></para>
94 </important>
95
96 <para>The country codes at the time of this writing are shown in the
97 following two sections.</para>
98 </section>
99
100 <section>
101 <title>IPv4</title>
102
103 <programlisting> A1 => "Anonymous Proxy" ,
104 A2 => "Satellite Provider" ,
105 AD => "Andorra" ,
106 AE => "United Arab Emirates" ,
107 AF => "Afghanistan" ,
108 AG => "Antigua and Barbuda" ,
109 AI => "Anguilla" ,
110 AL => "Albania" ,
111 AM => "Armenia" ,
112 AN => "Netherlands Antilles" ,
113 AO => "Angola" ,
114 AP => "Asia/Pacific Region" ,
115 AQ => "Antarctica" ,
116 AR => "Argentina" ,
117 AS => "American Samoa" ,
118 AT => "Austria" ,
119 AU => "Australia" ,
120 AW => "Aruba" ,
121 AX => "Aland Islands" ,
122 AZ => "Azerbaijan" ,
123 BA => "Bosnia and Herzegovina" ,
124 BB => "Barbados" ,
125 BD => "Bangladesh" ,
126 BE => "Belgium" ,
127 BF => "Burkina Faso" ,
128 BG => "Bulgaria" ,
129 BH => "Bahrain" ,
130 BI => "Burundi" ,
131 BJ => "Benin" ,
132 BM => "Bermuda" ,
133 BN => "Brunei Darussalam" ,
134 BO => "Bolivia" ,
135 BR => "Brazil" ,
136 BS => "Bahamas" ,
137 BT => "Bhutan" ,
138 BV => "Bouvet Island" ,
139 BW => "Botswana" ,
140 BY => "Belarus" ,
141 BZ => "Belize" ,
142 CA => "Canada" ,
143 CC => "Cocos (Keeling) Islands" ,
144 CD => "Congo, The Democratic Republic of the" ,
145 CF => "Central African Republic" ,
146 CG => "Congo" ,
147 CH => "Switzerland" ,
148 CI => "Cote D'Ivoire" ,
149 CK => "Cook Islands" ,
150 CL => "Chile" ,
151 CM => "Cameroon" ,
152 CN => "China" ,
153 CO => "Colombia" ,
154 CR => "Costa Rica" ,
155 CU => "Cuba" ,
156 CV => "Cape Verde" ,
157 CX => "Christmas Island" ,
158 CY => "Cyprus" ,
159 CZ => "Czech Republic" ,
160 DE => "Germany" ,
161 DJ => "Djibouti" ,
162 DK => "Denmark" ,
163 DM => "Dominica" ,
164 DO => "Dominican Republic" ,
165 DZ => "Algeria" ,
166 EC => "Ecuador" ,
167 EE => "Estonia" ,
168 EG => "Egypt" ,
169 EH => "Western Sahara" ,
170 ER => "Eritrea" ,
171 ES => "Spain" ,
172 ET => "Ethiopia" ,
173 EU => "Europe" ,
174 FI => "Finland" ,
175 FJ => "Fiji" ,
176 FK => "Falkland Islands (Malvinas)" ,
177 FM => "Micronesia, Federated States of" ,
178 FO => "Faroe Islands" ,
179 FR => "France" ,
180 GA => "Gabon" ,
181 GB => "United Kingdom" ,
182 GD => "Grenada" ,
183 GE => "Georgia" ,
184 GF => "French Guiana" ,
185 GG => "Guernsey" ,
186 GH => "Ghana" ,
187 GI => "Gibraltar" ,
188 GL => "Greenland" ,
189 GM => "Gambia" ,
190 GN => "Guinea" ,
191 GP => "Guadeloupe" ,
192 GQ => "Equatorial Guinea" ,
193 GR => "Greece" ,
194 GS => "South Georgia and the South Sandwich Islands" ,
195 GT => "Guatemala" ,
196 GU => "Guam" ,
197 GW => "Guinea-Bissau" ,
198 GY => "Guyana" ,
199 HK => "Hong Kong" ,
200 HN => "Honduras" ,
201 HR => "Croatia" ,
202 HT => "Haiti" ,
203 HU => "Hungary" ,
204 ID => "Indonesia" ,
205 IE => "Ireland" ,
206 IL => "Israel" ,
207 IM => "Isle of Man" ,
208 IN => "India" ,
209 IO => "British Indian Ocean Territory" ,
210 IQ => "Iraq" ,
211 IR => "Iran, Islamic Republic of" ,
212 IS => "Iceland" ,
213 IT => "Italy" ,
214 JE => "Jersey" ,
215 JM => "Jamaica" ,
216 JO => "Jordan" ,
217 JP => "Japan" ,
218 KE => "Kenya" ,
219 KG => "Kyrgyzstan" ,
220 KH => "Cambodia" ,
221 KI => "Kiribati" ,
222 KM => "Comoros" ,
223 KN => "Saint Kitts and Nevis" ,
224 KP => "Korea, Democratic People's Republic of" ,
225 KR => "Korea, Republic of" ,
226 KW => "Kuwait" ,
227 KY => "Cayman Islands" ,
228 KZ => "Kazakhstan" ,
229 LA => "Lao People's Democratic Republic" ,
230 LB => "Lebanon" ,
231 LC => "Saint Lucia" ,
232 LI => "Liechtenstein" ,
233 LK => "Sri Lanka" ,
234 LR => "Liberia" ,
235 LS => "Lesotho" ,
236 LT => "Lithuania" ,
237 LU => "Luxembourg" ,
238 LV => "Latvia" ,
239 LY => "Libyan Arab Jamahiriya" ,
240 MA => "Morocco" ,
241 MC => "Monaco" ,
242 MD => "Moldova, Republic of" ,
243 ME => "Montenegro" ,
244 MG => "Madagascar" ,
245 MH => "Marshall Islands" ,
246 MK => "Macedonia" ,
247 ML => "Mali" ,
248 MM => "Myanmar" ,
249 MN => "Mongolia" ,
250 MO => "Macau" ,
251 MP => "Northern Mariana Islands" ,
252 MQ => "Martinique" ,
253 MR => "Mauritania" ,
254 MS => "Montserrat" ,
255 MT => "Malta" ,
256 MU => "Mauritius" ,
257 MV => "Maldives" ,
258 MW => "Malawi" ,
259 MX => "Mexico" ,
260 MY => "Malaysia" ,
261 MZ => "Mozambique" ,
262 NA => "Namibia" ,
263 NC => "New Caledonia" ,
264 NE => "Niger" ,
265 NF => "Norfolk Island" ,
266 NG => "Nigeria" ,
267 NI => "Nicaragua" ,
268 NL => "Netherlands" ,
269 NO => "Norway" ,
270 NP => "Nepal" ,
271 NR => "Nauru" ,
272 NU => "Niue" ,
273 NZ => "New Zealand" ,
274 OM => "Oman" ,
275 PA => "Panama" ,
276 PE => "Peru" ,
277 PF => "French Polynesia" ,
278 PG => "Papua New Guinea" ,
279 PH => "Philippines" ,
280 PK => "Pakistan" ,
281 PL => "Poland" ,
282 PM => "Saint Pierre and Miquelon" ,
283 PR => "Puerto Rico" ,
284 PS => "Palestinian Territory, Occupied" ,
285 PT => "Portugal" ,
286 PW => "Palau" ,
287 PY => "Paraguay" ,
288 QA => "Qatar" ,
289 RE => "Reunion" ,
290 RO => "Romania" ,
291 RS => "Serbia" ,
292 RU => "Russian Federation" ,
293 RW => "Rwanda" ,
294 SA => "Saudi Arabia" ,
295 SB => "Solomon Islands" ,
296 SC => "Seychelles" ,
297 SD => "Sudan" ,
298 SE => "Sweden" ,
299 SG => "Singapore" ,
300 SH => "Saint Helena" ,
301 SI => "Slovenia" ,
302 SJ => "Svalbard and Jan Mayen" ,
303 SK => "Slovakia" ,
304 SL => "Sierra Leone" ,
305 SM => "San Marino" ,
306 SN => "Senegal" ,
307 SO => "Somalia" ,
308 SR => "Suriname" ,
309 ST => "Sao Tome and Principe" ,
310 SV => "El Salvador" ,
311 SY => "Syrian Arab Republic" ,
312 SZ => "Swaziland" ,
313 TC => "Turks and Caicos Islands" ,
314 TD => "Chad" ,
315 TF => "French Southern Territories" ,
316 TG => "Togo" ,
317 TH => "Thailand" ,
318 TJ => "Tajikistan" ,
319 TK => "Tokelau" ,
320 TL => "Timor-Leste" ,
321 TM => "Turkmenistan" ,
322 TN => "Tunisia" ,
323 TO => "Tonga" ,
324 TR => "Turkey" ,
325 TT => "Trinidad and Tobago" ,
326 TV => "Tuvalu" ,
327 TW => "Taiwan" ,
328 TZ => "Tanzania, United Republic of" ,
329 UA => "Ukraine" ,
330 UG => "Uganda" ,
331 UM => "United States Minor Outlying Islands" ,
332 US => "United States" ,
333 UY => "Uruguay" ,
334 UZ => "Uzbekistan" ,
335 VA => "Holy See (Vatican City State)" ,
336 VC => "Saint Vincent and the Grenadines" ,
337 VE => "Venezuela" ,
338 VG => "Virgin Islands, British" ,
339 VI => "Virgin Islands, U.S." ,
340 VN => "Vietnam" ,
341 VU => "Vanuatu" ,
342 WF => "Wallis and Futuna" ,
343 WS => "Samoa" ,
344 YE => "Yemen" ,
345 YT => "Mayotte" ,
346 ZA => "South Africa" ,
347 ZM => "Zambia" ,
348 ZW => "Zimbabwe" ,
349 </programlisting>
350 </section>
351
352 <section>
353 <title>IPv6</title>
354
355 <programlisting> AD => "Andorra" ,
356 AE => "United Arab Emirates" ,
357 AF => "Afghanistan" ,
358 AL => "Albania" ,
359 AM => "Armenia" ,
360 AO => "Angola" ,
361 AP => "Asia/Pacific Region" ,
362 AR => "Argentina" ,
363 AS => "American Samoa" ,
364 AT => "Austria" ,
365 AU => "Australia" ,
366 AW => "Aruba" ,
367 AZ => "Azerbaijan" ,
368 BA => "Bosnia and Herzegovina" ,
369 BD => "Bangladesh" ,
370 BE => "Belgium" ,
371 BF => "Burkina Faso" ,
372 BG => "Bulgaria" ,
373 BH => "Bahrain" ,
374 BI => "Burundi" ,
375 BJ => "Benin" ,
376 BM => "Bermuda" ,
377 BN => "Brunei Darussalam" ,
378 BO => "Bolivia" ,
379 BR => "Brazil" ,
380 BS => "Bahamas" ,
381 BT => "Bhutan" ,
382 BW => "Botswana" ,
383 BY => "Belarus" ,
384 BZ => "Belize" ,
385 CA => "Canada" ,
386 CD => "Congo, The Democratic Republic of the" ,
387 CH => "Switzerland" ,
388 CI => "Cote D'Ivoire" ,
389 CK => "Cook Islands" ,
390 CL => "Chile" ,
391 CM => "Cameroon" ,
392 CN => "China" ,
393 CO => "Colombia" ,
394 CR => "Costa Rica" ,
395 CU => "Cuba" ,
396 CW => "" ,
397 CY => "Cyprus" ,
398 CZ => "Czech Republic" ,
399 DE => "Germany" ,
400 DJ => "Djibouti" ,
401 DK => "Denmark" ,
402 DO => "Dominican Republic" ,
403 DZ => "Algeria" ,
404 EC => "Ecuador" ,
405 EE => "Estonia" ,
406 EG => "Egypt" ,
407 ES => "Spain" ,
408 EU => "Europe" ,
409 FI => "Finland" ,
410 FJ => "Fiji" ,
411 FM => "Micronesia, Federated States of" ,
412 FO => "Faroe Islands" ,
413 FR => "France" ,
414 GB => "United Kingdom" ,
415 GD => "Grenada" ,
416 GE => "Georgia" ,
417 GG => "Guernsey" ,
418 GH => "Ghana" ,
419 GI => "Gibraltar" ,
420 GL => "Greenland" ,
421 GM => "Gambia" ,
422 GP => "Guadeloupe" ,
423 GR => "Greece" ,
424 GT => "Guatemala" ,
425 GU => "Guam" ,
426 GY => "Guyana" ,
427 HK => "Hong Kong" ,
428 HN => "Honduras" ,
429 HR => "Croatia" ,
430 HT => "Haiti" ,
431 HU => "Hungary" ,
432 ID => "Indonesia" ,
433 IE => "Ireland" ,
434 IL => "Israel" ,
435 IM => "Isle of Man" ,
436 IN => "India" ,
437 IQ => "Iraq" ,
438 IR => "Iran, Islamic Republic of" ,
439 IS => "Iceland" ,
440 IT => "Italy" ,
441 JE => "Jersey" ,
442 JM => "Jamaica" ,
443 JO => "Jordan" ,
444 JP => "Japan" ,
445 KE => "Kenya" ,
446 KG => "Kyrgyzstan" ,
447 KH => "Cambodia" ,
448 KN => "Saint Kitts and Nevis" ,
449 KR => "Korea, Republic of" ,
450 KW => "Kuwait" ,
451 KY => "Cayman Islands" ,
452 KZ => "Kazakhstan" ,
453 LA => "Lao People's Democratic Republic" ,
454 LB => "Lebanon" ,
455 LI => "Liechtenstein" ,
456 LK => "Sri Lanka" ,
457 LS => "Lesotho" ,
458 LT => "Lithuania" ,
459 LU => "Luxembourg" ,
460 LV => "Latvia" ,
461 LY => "Libyan Arab Jamahiriya" ,
462 MA => "Morocco" ,
463 MC => "Monaco" ,
464 MD => "Moldova, Republic of" ,
465 ME => "Montenegro" ,
466 MG => "Madagascar" ,
467 MH => "Marshall Islands" ,
468 MK => "Macedonia" ,
469 ML => "Mali" ,
470 MM => "Myanmar" ,
471 MN => "Mongolia" ,
472 MO => "Macau" ,
473 MT => "Malta" ,
474 MU => "Mauritius" ,
475 MV => "Maldives" ,
476 MW => "Malawi" ,
477 MX => "Mexico" ,
478 MY => "Malaysia" ,
479 MZ => "Mozambique" ,
480 NA => "Namibia" ,
481 NC => "New Caledonia" ,
482 NF => "Norfolk Island" ,
483 NG => "Nigeria" ,
484 NI => "Nicaragua" ,
485 NL => "Netherlands" ,
486 NO => "Norway" ,
487 NP => "Nepal" ,
488 NR => "Nauru" ,
489 NU => "Niue" ,
490 NZ => "New Zealand" ,
491 OM => "Oman" ,
492 PA => "Panama" ,
493 PE => "Peru" ,
494 PF => "French Polynesia" ,
495 PG => "Papua New Guinea" ,
496 PH => "Philippines" ,
497 PK => "Pakistan" ,
498 PL => "Poland" ,
499 PR => "Puerto Rico" ,
500 PS => "Palestinian Territory" ,
501 PT => "Portugal" ,
502 PW => "Palau" ,
503 PY => "Paraguay" ,
504 QA => "Qatar" ,
505 RO => "Romania" ,
506 RS => "Serbia" ,
507 RU => "Russian Federation" ,
508 RW => "Rwanda" ,
509 SA => "Saudi Arabia" ,
510 SB => "Solomon Islands" ,
511 SC => "Seychelles" ,
512 SD => "Sudan" ,
513 SE => "Sweden" ,
514 SG => "Singapore" ,
515 SI => "Slovenia" ,
516 SK => "Slovakia" ,
517 SL => "Sierra Leone" ,
518 SM => "San Marino" ,
519 SN => "Senegal" ,
520 SO => "Somalia" ,
521 ST => "Sao Tome and Principe" ,
522 SV => "El Salvador" ,
523 SY => "Syrian Arab Republic" ,
524 SZ => "Swaziland" ,
525 TH => "Thailand" ,
526 TK => "Tokelau" ,
527 TN => "Tunisia" ,
528 TO => "Tonga" ,
529 TR => "Turkey" ,
530 TT => "Trinidad and Tobago" ,
531 TV => "Tuvalu" ,
532 TW => "Taiwan" ,
533 TZ => "Tanzania, United Republic of" ,
534 UA => "Ukraine" ,
535 UG => "Uganda" ,
536 US => "United States" ,
537 UY => "Uruguay" ,
538 UZ => "Uzbekistan" ,
539 VA => "Holy See (Vatican City State)" ,
540 VE => "Venezuela" ,
541 VI => "Virgin Islands, U.S." ,
542 VN => "Vietnam" ,
543 VU => "Vanuatu" ,
544 WS => "Samoa" ,
545 YE => "Yemen" ,
546 ZA => "South Africa" ,
547 ZM => "Zambia" ,
548 ZW => "Zimbabwe" ,
549 </programlisting>
550 </section>
551 </article>