Uploaded image for project: 'Qt Installer Framework'
  1. Qt Installer Framework
  2. QTIFW-699

Elevated operation "Execute" is run under wrong user

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 2.0.1
    • 2.0.0
    • General
    • None
    • Mac OS X 10.10.3

    Description

      Problem:

      • Adding elevated operation "Execute" which calls launchctl load <plist_file> loads the plist as normal user and thus the plist is loaded as LaunchAgent and not LaunchDaemon

      DoD:

      • Adding elevated operation "Execute" which calls launchctl load <plist_file> will load a plist as root and thus load it as LaunchDaemon
      • Adding operation (without elevation) "Execute" which calls launchctl load <plist_file> will load a plist as normal user and thus load it as LaunchAgent

      How to reproduce:

      1. Extract the plist file into /Library/LaunchDaemons
      2. Set permissions (644, root:wheel)
      3. Load the plist file
        component.addElevatedOperation("Extract", archive, "/Library/LaunchDaemons");
        
        component.addElevatedOperation("Execute", "chmod", "644", "/Library/LaunchDaemons/com.example.daemon.plist");
        component.addElevatedOperation("Execute", "chown", "root:wheel", "/Library/LaunchDaemons/com.example.daemon.plist");
        
        component.addElevatedOperation("Execute", "launchctl", "load", "/Library/LaunchDaemons/com.example.daemon.plist");
        
      4. Open terminal and run launchctl list and sudo launchctl list -> it should be listed in sudo launchctl list and not launchctl list

      Note:

      • Elevated:
        addElevatedOperation("Execute", "launchctl", "load", "<plist_file>")
        

        equals

        # This loads a plist as a LaunchDaemon
        sudo launchctl load <plist_file>
        
      • Normal:
        addOperation("Execute", "launchctl", "load", "<plist_file>")
        

        equals

        # This loads a plist as a LaunchAgent
        launchctl load <plist_file>
        

      Attachments

        Activity

          People

            kkohne Kai Köhne
            DavidKaya David Kaya
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: