0

I have an GCP provided Unix/Linux (RHEL7 and CentOS7 in this case, at the time of writing this SO question) files, for example:

/etc/sysctl.d/60-gce-network-security.conf

The check can be done by simply grepping/catting/sedding , but it will be hardcoded, unmantainable and simply stupid.

Therefore, is there a way to actually scan the files and try to guess if they are native to distribution or not?

My idea is to scan all files, used by sysctl / systemd unit files, but I want to have more input before implementing the logic, if that is really a viable solution by industry professionals.

HX_unbanned
  • 583
  • 1
  • 15
  • 51

1 Answers1

0

There is no one-step procedure for this but you can guess based on the information the package manager provides for each file you are interested in.

For the RPM-based distributions like CenOS you can use rpm -qf and rpm -qif.

Also, you may find some input from the tools and customization files Google uses to prepare GCE images:

https://github.com/GoogleCloudPlatform/compute-image-tools

https://github.com/GoogleCloudPlatform/compute-image-tools/blob/master/daisy_workflows/image_build/enterprise_linux/kickstart/el7-post.cfg

mebius99
  • 2,495
  • 1
  • 5
  • 9