joshua-d-miller / macOSLAPS

Swift binary that will change a local administrator password to a random generated password. Similar behavior to LAPS for Windows
MIT License
383 stars 57 forks source link

request for local_admin_path to be a dynamic value. #23

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello Joshua

We are in the process of setting up a proof of concept using your project. In our environment the Jamf provisioning process creates the admin account we want to implement LAPS elsewhere and not in /Users/. Having said that there are cases of manual setups where the same account is in /Users/. I know we need to do some house keeping.

I would like to request a possible change in PWChange.swift where the home user path is dynamic. As we do not have our environment ready for any testing I just changed the file but unable to test it, apologies for that.

The implementation would be:

line 41 remove > let local_admin_path = "/Users/" + local_admin + "/Library/Keychains"

   if keychain_remove == true {
        // get the local_admin home directory path (it can be elsewhere and not in /Users/
        let local_admin_home_path = NSHomeDirectoryForUser(local_admin)
        let local_admin_path = local_admin_home_path! + "/Library/Keychains"
        do {...

Could you have a look and consider this request, please? Thank you Mauricio

joshua-d-miller commented 5 years ago

Mauricio,

I have gone ahead and processed this request but a little differently than the code you provided. Please give it a try and let me know. I have attached a new prerelease under releases.

Thanks for the heads up!