> ## Documentation Index
> Fetch the complete documentation index at: https://docs.iru.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy SAP Privileges Auto App with Privileges Checker

> Deploy SAP Privileges with the Privileges Checker script in Iru Endpoint. Automate temporary admin access and enforce standard user permissions on Mac.

<Callout icon="apple" color="#B84A7A" iconType="regular">This guide applies to Mac computers</Callout>

<Warning>
  SAP Privileges 2 includes native support for much of the functionality provided by Iru Endpoint's Privileges Checker. For detailed guidance on managing SAP Privileges 2, visit [SAP's wiki](https://github.com/SAP/macOS-enterprise-privileges/wiki/Managing-Privileges). A sample .mobileconfig containing all available settings for SAP Privileges 2 can be found in their [GitHub repo](https://github.com/SAP/macOS-enterprise-privileges/blob/main/source/Privileges/Privileges.mobileconfig).
</Warning>

### About SAP Privileges

SAP Privileges is an open-source tool for macOS that allows users to temporarily elevate their user accounts from standard to administrative when needed. This is particularly useful in environments where security best practices suggest that users should operate with the least privileges necessary for daily tasks but occasionally need administrative rights for specific actions.

### How SAP Privileges Works

The SAP Privileges app for macOS allows users to elevate their privileges to perform administrative tasks temporarily. The built-in functionality of SAP Privileges supports time-based rights expiration, but only if the privileges are first granted by right-clicking the Dock icon and selecting the "Toggle Privileges" option. This means that the app will revert the user to standard privileges after a set period if they use this specific method to elevate their rights.

However, users can also launch the full SAP Privileges app to elevate their privileges, which bypasses the Dock icon method. To address this, we have released companion code that enforces the timeout even when privileges are escalated through other methods, such as launching the full app.

### Configuring SAP Privileges in Iru Endpoint

#### Requirements

* Privileges Checker audit script ([GitHub Link](https://github.com/kandji-inc/support/blob/main/PrivilegesChecker/audit_privileges_checker.zsh))
* Privileges Checker remediation script ([GitHub Link](https://github.com/kandji-inc/support/blob/main/PrivilegesChecker/install_privileges_checker.zsh))
* A tool for custom profile creation, such as [iMazing Profile Editor](https://imazing.com/profile-editor/download)
* The SAP Privileges Auto App, Custom Script, and Custom Profile must all be added to the same Blueprint(s)
* The Demote user accounts to standard Parameter must be disabled on any Assignment Maps where Privileges is assigned

#### Adding the SAP Privileges Auto App

This Auto App deploys a configuration profile allowing background items for SAP Privileges and Privileges Checker. This is to ensure core functionality for the add-on, and has no impact if Privileges Checker is not present.

To add this Library Item to your Iru Endpoint Library, follow the steps outlined in the [Library Overview](/en/endpoint/library/library-items-profiles/library-overview) article.

<Steps>
  <Step title="Assign to Blueprint">
    Assign the Auto App to a test **Blueprint**.
  </Step>

  <Step title="Configure Installation">
    Select desired installation method and hit **Save**.
  </Step>
</Steps>

#### Adding and Configuring the Privileges Checker Script

<Warning>
  Once this script is deployed, Privileges Checker will revoke rights for the logged-in user after the set timeout has expired.
</Warning>

**Add a Custom Script Library Item**

To add this Library Item to your Iru Endpoint Library, follow the steps outlined in the [Library Overview](/en/endpoint/library/library-items-profiles/library-overview) article.

<Steps>
  <Step title="Name the Script">
    Give the new Accessory & Storage Access Library Item a **Name**.
  </Step>

  <Step title="Assign to Blueprint">
    Assign to your desired [Assignment Maps](/en/endpoint/getting-started/blueprints-and-library/configuring-blueprints).

    <Frame>
      <img src="https://mintcdn.com/iru/Pp4ndpzRp4nipP1L/assets/media/images/2ewwbfwhscgv6nfgm_cxg34d03xbpna5tg.png?fit=max&auto=format&n=Pp4ndpzRp4nipP1L&q=85&s=2adeacd29bd584a9cd54920755fa76ae" alt="Custom Script configuration showing Blueprint assignment options" width="2431" height="1294" data-path="assets/media/images/2ewwbfwhscgv6nfgm_cxg34d03xbpna5tg.png" />
    </Frame>
  </Step>

  <Step title="Set Execution Frequency">
    Select **Run every 15 minutes** as the **Execution Frequency**.

    <Frame>
      <img src="https://mintcdn.com/iru/mol1UbnodotF3fFx/assets/media/images/ixonpqwgbgmraacl0zam1bivgrrfnyvlia.png?fit=max&auto=format&n=mol1UbnodotF3fFx&q=85&s=ee5a31f33f3efafeafe69f9bbea0a186" alt="Custom Script execution frequency configuration" width="2432" height="528" data-path="assets/media/images/ixonpqwgbgmraacl0zam1bivgrrfnyvlia.png" />
    </Frame>
  </Step>

  <Step title="Configure Audit Script">
    Paste the audit script you downloaded earlier into the **Audit Script** text field. Edit the script on line 65 to set a Boolean value for **USE\_PROFILE\_TIMEOUT**, and a string value for **USERS\_TO\_EXCLUDE**.

    **For USE\_PROFILE\_TIMEOUT:**

    * Set to either **True** or **False**: Enforces a timeout in minutes from **DockToggleTimeout** key set in the Privileges configuration profile (see below)
    * If the value is marked **True** but no profile is installed, or if the **DockToggleTimeout** key is not defined, the timeout will default to **MINUTES\_TO\_WAIT**. Otherwise, the configuration profile will override the locally set value **MINUTES\_TO\_WAIT**

    **For USERS\_TO\_EXCLUDE:**

    * If no admin is defined, all admins will get demoted
    * Admin names must be placed inside the double quotes

    <Frame>
      <img src="https://mintcdn.com/iru/TTV4GXkIHgRpdDZ5/assets/media/images/txjn7xjze27itpti3fj5e2ik-dzdm2yfbw.png?fit=max&auto=format&n=TTV4GXkIHgRpdDZ5&q=85&s=842f97e7c62400afed0da066debecc9f" alt="Custom Script audit script configuration showing timeout and user exclusion settings" width="2356" height="882" data-path="assets/media/images/txjn7xjze27itpti3fj5e2ik-dzdm2yfbw.png" />
    </Frame>
  </Step>

  <Step title="Configure Remediation Script">
    Paste the remediation script you downloaded earlier into the **Remediation Script** text field. Edit the script on line 56 to set an integer value for **MINUTES\_TO\_WAIT.** This is the number of minutes an end user should be allowed admin rights once granted.
  </Step>

  <Step title="Set Profile Timeout">
    Edit the script on line 64 to set a Boolean value for **USE\_PROFILE\_TIMEOUT**.

    * Set to either **True** or **False**: Enforces a timeout in minutes from **DockToggleTimeout** key set in the Privileges configuration profile (see below)
    * If the value is marked **True** but no profile is installed, or if the **DockToggleTimeout** key is not defined, the timeout will default to **MINUTES\_TO\_WAIT**. Otherwise, the configuration profile will override the locally set value **MINUTES\_TO\_WAIT**
  </Step>

  <Step title="Set User Exclusions">
    Edit the script on line 72 to set a string value for **USERS\_TO\_EXCLUDE**.

    * Admin names must be placed inside the double quotes
  </Step>

  <Step title="Save Script">
    Click **Save**.

    <Frame>
      <img src="https://mintcdn.com/iru/eqrMRa098FywfIL4/assets/media/images/rt0fhkecszxtqvkrl9x-6jk_cng-97zfaa.png?fit=max&auto=format&n=eqrMRa098FywfIL4&q=85&s=929518583f45c15cb849a5723233685d" alt="Custom Script remediation script configuration showing timeout and user exclusion settings" width="2214" height="884" data-path="assets/media/images/rt0fhkecszxtqvkrl9x-6jk_cng-97zfaa.png" />
    </Frame>
  </Step>
</Steps>

### Create a Custom Profile

Profile creation steps are optional if you are setting the rights timeout via script. You can also review additional profile options that SAP Privileges supports on [their GitHub page](https://github.com/SAP/macOS-enterprise-privileges/wiki/Managing-Privileges).

<Warning>
  If the EnforcePrivileges key in the Custom Profile is set with any value, it will disable the PrivilegesCLI used in the Privileges Checker and override its ability to demote users.
</Warning>

<Steps>
  <Step title="Open Profile Editor">
    Open iMazing Profile Editor.
  </Step>

  <Step title="Select SAP Privileges">
    On the left side, locate and click **SAP Privileges** under Available System Domains.
  </Step>

  <Step title="Add Configuration Payload">
    Click **Add Configuration Payload**.
  </Step>

  <Step title="Set Dock Toggle Timeout">
    Enter a value for **Dock Toggle Timeout**.

    If Privileges is configured with the DockToggleTimeout payload, but Privileges Checker is not deployed, timed rights revocation will only occur if a user right-clicks the Privileges Dock icon and selects Toggle privileges.
  </Step>

  <Step title="Configure Additional Settings">
    Optionally, configure any additional settings for SAP Privileges as desired.
  </Step>

  <Step title="Set General Information">
    Click the **General** section; populate the required values for **Name** and **Identifier**.
  </Step>

  <Step title="Save Profile">
    Hit **Command+S** to save your profile.

    <Frame>
      <img src="https://mintcdn.com/iru/ra-017G2NJ9qGfJp/assets/media/images/Kandji-Support-KB-0902AM@2x.png?fit=max&auto=format&n=ra-017G2NJ9qGfJp&q=85&s=4ba489798cf7468966dc4c6ff7e436d1" alt="iMazing Profile Editor showing SAP Privileges configuration with Dock Toggle Timeout setting" width="2768" height="2358" data-path="assets/media/images/Kandji-Support-KB-0902AM@2x.png" />
    </Frame>
  </Step>
</Steps>

### Add and Configure the Custom Profile

To add this Library Item to your Iru Endpoint Library, follow the steps outlined in the [Library Overview](/en/endpoint/library/library-items-profiles/library-overview) article.

<Steps>
  <Step title="Name the Profile">
    Give the profile a **Name**.
  </Step>

  <Step title="Assign to Blueprint">
    **Assign** your custom profile to a test **Blueprint**.
  </Step>

  <Step title="Set Device Families">
    Set the **Device Families** to Mac.
  </Step>

  <Step title="Upload Configuration">
    **Upload** the **.mobileconfig** you customized and saved above.
  </Step>

  <Step title="Save Profile">
    **Save** your custom profile.
  </Step>
</Steps>

Technical details about Privileges Checker can be found in our [Iru Endpoint Support GitHub repo](https://github.com/kandji-inc/support/tree/main/PrivilegesChecker).
