Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean geoip.paths before using the path #4306

Merged
merged 1 commit into from
May 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ https://github.com/elastic/beats/compare/v5.3.0...master[Check the HEAD diff]

*Packetbeat*

- Clean configured geoip.paths before attempting to open the database. {pull}4306[4306]

*Winlogbeat*


Expand Down
1 change: 1 addition & 0 deletions libbeat/common/geolite.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func LoadGeoIPData(config Geoip) *libgeo.GeoIP {
// look for the first existing path
var geoipPath string
for _, path := range geoipPaths {
path = filepath.Clean(path)
fi, err := os.Lstat(path)
if err != nil {
logp.Err("GeoIP path could not be loaded: %s", path)
Expand Down
6 changes: 5 additions & 1 deletion packetbeat/tests/system/test_0011_geoip.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from packetbeat import BaseTest
import os
import unittest
import sys

from packetbeat import BaseTest

"""
Tests for reading the geoip files.
Expand Down Expand Up @@ -43,6 +46,7 @@ def test_geoip_config_from_file(self):
assert o["real_ip"] == "89.247.39.104"
assert o["client_location"] == "52.528503, 13.410904"

@unittest.skipIf(sys.platform.startswith("win"), "requires unix for symlinks")
def test_geoip_symlink(self):
"""
Should be able to follow symlinks to GeoIP libs.
Expand Down