Skip to content

[BUG] cloudbeat crash once etcd folder changed group and user #118

@CohenIdo

Description

@CohenIdo

Describe the bug
After changing /var/lib/etcd user and/or group to etcd cloudbeat carsh.

Preconditions
Environment state and/or platform specific configurations.

To Reproduce
Write the exact actions one should perform in order to reproduce the bug.
Steps to reproduce the behavior:

  1. initiate cloudbeat
  2. ssh to the cluster
  3. run:
    groupadd etcd
    useradd -g etcd etcd
    chown etcd:etcd /var/lib/etcd/
    
  4. wait 5-10 seconds and check for cloudbeat logs

Expected behavior
get findings as usual

Screenshots

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x204cee4]

goroutine 150 [running]:
github.com/elastic/cloudbeat/resources/fetchers.FromFileInfo({0x2f1b060, 0x40007cd200}, {0x40001460c0, 0x14})
	/Users/idocohen/Documents/es/cloudbeat/resources/fetchers/file_system_fetcher.go:113 +0x1c4
github.com/elastic/cloudbeat/resources/fetchers.(*FileSystemFetcher).fetchSystemResource(0x40007d0ea0, {0x40001460c0, 0x14})
	/Users/idocohen/Documents/es/cloudbeat/resources/fetchers/file_system_fetcher.go:84 +0x150
github.com/elastic/cloudbeat/resources/fetchers.(*FileSystemFetcher).Fetch(0x40007d0ea0, {0x2efa680, 0x400079abc0})
	/Users/idocohen/Documents/es/cloudbeat/resources/fetchers/file_system_fetcher.go:66 +0x2a8
github.com/elastic/cloudbeat/resources/manager.(*fetchersRegistry).Run(0x40002fa7a0, {0x2efa680, 0x400079abc0}, {0x40004221e0, 0xb})
	/Users/idocohen/Documents/es/cloudbeat/resources/manager/registry.go:97 +0xc8
github.com/elastic/cloudbeat/resources/manager.(*Data).fetchWorker(0x40007ee2a0, {0x2efa680, 0x400079abc0}, 0x4000157440, {0x40004221e0, 0xb})
	/Users/idocohen/Documents/es/cloudbeat/resources/manager/data.go:97 +0xbc
github.com/elastic/cloudbeat/resources/manager.(*Data).Run.func1(0x40007b05f0, 0x40007ee2a0, {0x2efa680, 0x400079abc0}, 0x4000157440, {0x40004221e0, 0xb})
	/Users/idocohen/Documents/es/cloudbeat/resources/manager/data.go:74 +0x78
created by github.com/elastic/cloudbeat/resources/manager.(*Data).Run
	/Users/idocohen/Documents/es/cloudbeat/resources/manager/data.go:72 +0x198

code reference
cloudbeat/resources/fetchers/file_system_fetcher.go:84

uid := stat.Uid
	gid := stat.Gid
	u := strconv.FormatUint(uint64(uid), 10)
	g := strconv.FormatUint(uint64(gid), 10)
	usr, _ := user.LookupId(u)
	group, _ := user.LookupGroupId(g)
	mod := strconv.FormatUint(uint64(info.Mode().Perm()), 8)
	inode := strconv.FormatUint(uint64(stat.Ino), 10)

	data := FileSystemResource{
		FileName: info.Name(),
		FileMode: mod,
		Uid:      usr.Name,
		Gid:      group.Name,
		Path:     path,
		Inode:    inode,
	}

Desktop (please complete the following information):

  • OS:
  • Browser:
  • Kibana Version:
  • Endpoint Version:
  • Other Version:

Additional context
cloudbeat commit sha: 03423461f38b60d89925bb810f40f997a4143a4c

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingverifiedlabel for fixed and retested issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions