munkireport / munkireport-php

A reporting tool for munki
MIT License
393 stars 139 forks source link

Add support to disable parts of reportdata and other modules #986

Open lifeunexpected opened 6 years ago

lifeunexpected commented 6 years ago

In munkireport v2 i managed to disable parts of the module "report data" and other modules that had parts i didnt want/need becuase of privacy concerns, but i v3 when i use the same method it causes a problem that clients cant connect.

Q: What are you trying to accomplish?

A: Not getting unwanted or not needed information into MunkiReport because of privacy concerns.

The way i used to do it in v2 was this way but that stopped working i v3 :confused: can i disable them in the config.php file? // $this->rs['console_user'] = ''; // $this->rs['long_username'] = ''; // $this->rs['remote_ip'] = '';

A user named tuxedo gave me this solution, but a supported solution built into MunkiReport-PHP would be better.

// Remove serial_number from mylist, use the cleaned serial that was provided in the constructor. unset($mylist['serial_number']);

    unset($mylist['console_user']);
    unset($mylist['long_username']);
    unset($mylist['remote_ip']);
bochoven commented 6 years ago

I think the best way to handle this is to prevent the uploading of sensitive data on the client. To accomplish that, a filtering function could be build into the process method inreportcommon.

This would require that the admin puts filtering config on the clients that need it.

lifeunexpected commented 6 years ago

yes that would probably be even better since no unwanted or sensetive data ever leaves the client machine

lifeunexpected commented 5 years ago

Something changed in version 4.3.x so now the "unset($mylist['console_user']);" dont work anymore is it possible to add exceptions to what you want imported in the .env file or do you have to change it in the vendor --> MunkiReport --> Machine --> machine_model.php file like before ? I cant seem to figure out how to to it at least but i wanted to log less info them it set by default.

bochoven commented 5 years ago

You could hack the submit script and set console_user and long_username to an empty string:

https://github.com/munkireport/munkireport-php/blob/master/public/assets/client_installer/submit.preflight#L45-L46

lifeunexpected commented 5 years ago

I have tried doing that with

Original report_info['console_user'] = "%s" % osutils.getconsoleuser() report_info['long_username'] = reportcommon.get_long_username(report_info['console_user'])

Modified: report_info['console_user'] = "" report_info['long_username'] = ""

But i must be doing something wrong or not doing it in the correct places.

The modules i am using is munkiinfo, munkireport, managedinstalls and the defualts modules that might always be active.

I looked in the folder munkireport-php/vendor/munkireport/machine and the sub files to see if i could understand what file i might need to modifie.

I also looked into https://github.com/munkireport/munkireport-php/tree/master/public/assets/client_installer - Postflight, preflight and submit.preflight without any luck with getting the information i want completely removed to be removed.

bochoven commented 5 years ago

If you change the sources, you need to send a new package to your clients with the modified code. Or you could just send a patched file to your clients with Munki (which may be easier to do)