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

MunkiReport using wrong path to Munki ApplicationInventory.plist #1553

Open
jelockwood opened this issue Sep 12, 2024 · 4 comments
Open

MunkiReport using wrong path to Munki ApplicationInventory.plist #1553

jelockwood opened this issue Sep 12, 2024 · 4 comments

Comments

@jelockwood
Copy link

I already have Munki deployed and working to all our Macs. I push out settings via a managed profile i.e. an MDM server.

The Munki working directory location is the usual /Library/Managed Installs/ and in that directory is ApplicationInventory.plist

Unfortunately MunkiReport seems to be confused and its setup shows it is looking in /Library/Preferences/Managed Installs/ does not exist and hence it does not find ApplicationInventory.plist

There is a /Library/Preferences/ManagedInstalls.plist but this is not the same thing.

munkireport_runner -S shows the following entry inventory = "/Library/Preferences/Managed Installs/ApplicationInventory.plist"; and the actual execution gives the corresponding error of WARNING: Can't open /Library/Preferences/Managed Installs/ApplicationInventory.plist

As a result the Inventory choice in Listings is effectively empty as it only lists the computer, and App Versions Report shows no version information and clicking on an entry as per APPS_TO_TRACK in my .env goes to a table saying 'No data available in table', this includes the default Safari app.

I am using an Ubuntu 20 Server running Apache2 and PHP8 and MunkiReport-PHP 5.8.0.4284

@tuxudo
Copy link
Contributor

tuxudo commented Sep 12, 2024

Please create this issue in the https://github.com/munkireport/inventory module's GitHub repo for proper tracking.

@jelockwood jelockwood closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2024
@jelockwood
Copy link
Author

@tuxudo
Created at munkireport/inventory#11

@jelockwood
Copy link
Author

jelockwood commented Oct 1, 2024

@tuxudo
I have been on holiday and now back and had a chance to use Pacifist to examine the client installer pkg generated by MunkiReport. It seems the problem with the preference file for the MunkiReport client having the wrong file path for the ApplicationInventory.plist is being caused by MunkiReport-PHP itself generating an installer with the wrong path.

The PostInstall script in the installer pkg contains the following line

/usr/bin/defaults write "${TARGET}"/Library/Preferences/MunkiReport ReportItems -dict-add inventory "/Library/Preferences/Managed Installs/ApplicationInventory.plist"

It should be

/usr/bin/defaults write "${TARGET}"/Library/Preferences/MunkiReport ReportItems -dict-add inventory "/Library/Managed Installs/ApplicationInventory.plist"

Therefore the issue appears to be a bug in MunkReport-PHP 5.8.0.4284 and not my client Mac or setup or the inventory module. I have a suspicion this bug may have existed a while and therefore possibly also in 5.7.

Since the bug is I believe now shown to be in MunkiReport-PHP itself and not the Inventory module I am re-opening this issue for MunkiReport-PHP itself.

Note: I have tried generating the client installer pkg on two different Macs, a Mac running macOS Monterey 12.7.6 and a Mac running macOS Sonoma 14.6.1. I also tried using first an AutoPkg recipe and then using the direct URL approach as per the wiki.

/bin/bash -c "$(curl 'https://example.com/index.php?/install')" bash -i ~/Desktop

All these result in the same bad entry in the PostInstall script in the installer pkg.

@jelockwood jelockwood reopened this Oct 1, 2024
@tuxudo
Copy link
Contributor

tuxudo commented Oct 1, 2024

I am not able to reproduce this. However, this issue is not with MunkiReport core, but with the module.

Looking at line 76 of https://github.com/munkireport/munkireport-php/blob/5.x/app/views/install/install_script.php#L76, we can see the function that sets that line in the installer pkg. This function is called by the module's install.sh script. For the inventory module, this is either line 20 or 23 as seen here https://github.com/munkireport/inventory/blob/mr5-python3/scripts/install.sh#L20.

Line 20 is the default and specifies /Library/Managed Installs/ApplicationInventory.plist and line 23 is only used if a custom munki directory is set.

As a test, edit the install.sh script on your MunkiReport server in the inventory module's folder. Verify that when removing line 20, the defaults write command to the incorrect file is removed is removed from the client pkg.

Please discontinue this issue here and use the one in the inventory module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants