|
1 | | -MaxMind DB Verifier |
2 | | -------------------- |
| 1 | +# mmdbverify |
3 | 2 |
|
4 | | -This is a utility to verify that a MaxMind DB is valid. The search tree, |
5 | | -data section, and metadata are all checked for validity and sanity. If the |
6 | | -database cannot be parsed or is otherwise invalid, a short description will |
7 | | -be sent to `stderr` and the utility will exit with a non-zero exit code. If |
8 | | -successful, no output will be printed and an exit code of zero will be |
9 | | -returned. |
| 3 | +A command-line utility to verify the validity of MaxMind DB (MMDB) files. |
10 | 4 |
|
11 | | -Note that this tool may flag a database as invalid even though it is |
12 | | -completely parseable. This may happen if there is unexpected data in the |
13 | | -data section or metadata that is not well-formed. |
| 5 | +[](https://opensource.org/licenses/Apache-2.0) |
| 6 | +[](https://golang.org) |
14 | 7 |
|
15 | | -Usage |
16 | | -===== |
| 8 | +## Overview |
17 | 9 |
|
18 | | -Required: |
| 10 | +This utility verifies that a MaxMind DB file is valid by checking: |
19 | 11 |
|
20 | | -* -file=[FILENAME] - The path to the database to test. |
| 12 | +- **Search tree** - Validates the tree structure used for IP lookups |
| 13 | +- **Data section** - Ensures all data is properly formatted and accessible |
| 14 | +- **Metadata** - Verifies metadata is well-formed and contains expected fields |
21 | 15 |
|
22 | | -Copyright and License |
23 | | -===================== |
| 16 | +If the database is valid, the tool exits silently with status code `0`. If |
| 17 | +invalid, an error description is printed to `stderr` and the tool exits with a |
| 18 | +non-zero status code. |
24 | 19 |
|
25 | | -This software is Copyright (c) 2015-2025 by MaxMind, Inc. |
| 20 | +**Note:** This tool may flag a database as invalid even if it can be parsed. |
| 21 | +This occurs when there is unexpected or malformed data in the data section or |
| 22 | +metadata. |
26 | 23 |
|
27 | | -This is free software, licensed under the Apache License, Version 2.0. |
| 24 | +## Installation |
| 25 | + |
| 26 | +### Binary Releases (Recommended) |
| 27 | + |
| 28 | +Download pre-built binaries from the |
| 29 | +[GitHub Releases page](https://github.com/maxmind/mmdbverify/releases). |
| 30 | + |
| 31 | +> **Architecture Guide:** |
| 32 | +> |
| 33 | +> - `amd64` = x86-64 / x64 (most common for Intel/AMD processors) |
| 34 | +> - `arm64` = ARM 64-bit (Apple Silicon, AWS Graviton, Raspberry Pi 4+) |
| 35 | +> - `darwin` = macOS |
| 36 | +
|
| 37 | +#### Linux |
| 38 | + |
| 39 | +**Using .deb package (Debian/Ubuntu):** |
| 40 | + |
| 41 | +```bash |
| 42 | +# Download the .deb file for your architecture from the releases page |
| 43 | +sudo dpkg -i mmdbverify_<VERSION>_linux_<ARCH>.deb |
| 44 | +``` |
| 45 | + |
| 46 | +**Using .rpm package (RedHat/CentOS/Fedora):** |
| 47 | + |
| 48 | +```bash |
| 49 | +# Download the .rpm file for your architecture from the releases page |
| 50 | +sudo rpm -i mmdbverify_<VERSION>_linux_<ARCH>.rpm |
| 51 | +``` |
| 52 | + |
| 53 | +**Using tar.gz archive:** |
| 54 | + |
| 55 | +```bash |
| 56 | +# Download and extract |
| 57 | +tar -xzf mmdbverify_<VERSION>_linux_<ARCH>.tar.gz |
| 58 | +sudo mv mmdbverify/mmdbverify /usr/local/bin/ |
| 59 | +``` |
| 60 | + |
| 61 | +#### macOS |
| 62 | + |
| 63 | +```bash |
| 64 | +# Download the appropriate file for your Mac: |
| 65 | +# - darwin_arm64 for Apple Silicon (M1/M2/M3/M4) |
| 66 | +# - darwin_amd64 for Intel Macs |
| 67 | +tar -xzf mmdbverify_<VERSION>_darwin_<ARCH>.tar.gz |
| 68 | +sudo mv mmdbverify/mmdbverify /usr/local/bin/ |
| 69 | +``` |
| 70 | + |
| 71 | +#### Windows |
| 72 | + |
| 73 | +1. Download the Windows zip file for your architecture from the releases page |
| 74 | +2. Extract the zip file |
| 75 | +3. Add `mmdbverify.exe` to your PATH or run it directly |
| 76 | + |
| 77 | +**Using PowerShell:** |
| 78 | + |
| 79 | +```powershell |
| 80 | +# Extract |
| 81 | +Expand-Archive -Path mmdbverify_<VERSION>_windows_<ARCH>.zip -DestinationPath . |
| 82 | +
|
| 83 | +# Run |
| 84 | +.\mmdbverify\mmdbverify.exe -file C:\path\to\database.mmdb |
| 85 | +``` |
| 86 | + |
| 87 | +### From Source |
| 88 | + |
| 89 | +```bash |
| 90 | +go install github.com/maxmind/mmdbverify@latest |
| 91 | +``` |
| 92 | + |
| 93 | +### Build Locally |
| 94 | + |
| 95 | +```bash |
| 96 | +git clone https://github.com/maxmind/mmdbverify.git |
| 97 | +cd mmdbverify |
| 98 | +go build |
| 99 | +``` |
| 100 | + |
| 101 | +## Usage |
| 102 | + |
| 103 | +```bash |
| 104 | +# Verify a database file (silent on success) |
| 105 | +mmdbverify -file /path/to/GeoIP2-City.mmdb |
| 106 | + |
| 107 | +# Verify with verbose output |
| 108 | +mmdbverify -file /path/to/GeoIP2-City.mmdb -verbose |
| 109 | +# Verifying /path/to/GeoIP2-City.mmdb... |
| 110 | +# /path/to/GeoIP2-City.mmdb is valid |
| 111 | + |
| 112 | +# Check exit code |
| 113 | +echo $? |
| 114 | +# 0 |
| 115 | + |
| 116 | +# Failure (error printed to stderr with filename, non-zero exit code) |
| 117 | +mmdbverify -file /path/to/invalid.mmdb |
| 118 | +# Error verifying /path/to/invalid.mmdb: invalid database metadata |
| 119 | +echo $? |
| 120 | +# 1 |
| 121 | +``` |
| 122 | + |
| 123 | +### Command-Line Flags |
| 124 | + |
| 125 | +- `-file` - **Required.** Path to the MaxMind DB file to verify |
| 126 | +- `-verbose` - Print verification status messages |
| 127 | + |
| 128 | +## Examples |
| 129 | + |
| 130 | +### Verify GeoIP2 Database |
| 131 | + |
| 132 | +```bash |
| 133 | +# Silent mode (default) |
| 134 | +mmdbverify -file GeoIP2-City.mmdb |
| 135 | + |
| 136 | +# Verbose mode |
| 137 | +mmdbverify -file GeoIP2-City.mmdb -verbose |
| 138 | +``` |
| 139 | + |
| 140 | +### Verify Multiple Databases |
| 141 | + |
| 142 | +```bash |
| 143 | +# Verify all MMDB files with verbose output |
| 144 | +for db in *.mmdb; do |
| 145 | + mmdbverify -file "$db" -verbose |
| 146 | +done |
| 147 | +``` |
| 148 | + |
| 149 | +### Use in CI/CD Pipeline |
| 150 | + |
| 151 | +```bash |
| 152 | +# Exit immediately if validation fails |
| 153 | +mmdbverify -file GeoIP2-Country.mmdb || exit 1 |
| 154 | +``` |
| 155 | + |
| 156 | +## Use Cases |
| 157 | + |
| 158 | +- **Pre-deployment validation** - Verify databases before deploying to |
| 159 | + production |
| 160 | +- **Download verification** - Ensure downloaded MMDB files are not corrupted |
| 161 | +- **CI/CD pipelines** - Validate databases in automated testing workflows |
| 162 | +- **Quality assurance** - Check custom MMDB files created with |
| 163 | + [mmdbwriter](https://github.com/maxmind/mmdbwriter) |
| 164 | + |
| 165 | +## Requirements |
| 166 | + |
| 167 | +- Go 1.24 or later (for building from source) |
| 168 | +- MaxMind DB files to verify (GeoIP2, GeoLite2, or custom MMDB files) |
| 169 | + |
| 170 | +## Related Tools |
| 171 | + |
| 172 | +- [mmdbinspect](https://github.com/maxmind/mmdbinspect) - Inspect and query MMDB |
| 173 | + files |
| 174 | +- [mmdbwriter](https://github.com/maxmind/mmdbwriter) - Create custom MMDB files |
| 175 | +- [mmdbconvert](https://github.com/maxmind/mmdbconvert) - Convert MMDB to |
| 176 | + CSV/Parquet |
| 177 | + |
| 178 | +## License |
| 179 | + |
| 180 | +Copyright (c) 2015-2025 by MaxMind, Inc. |
| 181 | + |
| 182 | +This software is licensed under the Apache License, Version 2.0. See |
| 183 | +[LICENSE](LICENSE) for details. |
| 184 | + |
| 185 | +## Support |
| 186 | + |
| 187 | +- **Issues:** [GitHub Issues](https://github.com/maxmind/mmdbverify/issues) |
| 188 | +- **MaxMind Support:** |
| 189 | + [https://support.maxmind.com](https://support.maxmind.com) |
0 commit comments