Intune-managed Linux Client
Last updated
Last updated
Applicable to SCEPman version 2.9 and above
This method can be used to enroll certificates for users and devices that are managed by Intune.
Intune will in this case push a script to leverage the SCEPman REST API that in turn will either enroll a new certificate or renew an already existing one.
This scenario will enroll certificates of the type IntuneUser and IntuneDevice depending on your choice.
Follow the linked documentation to enroll your Linux client to Intune.
The enrollrenewcertificate.sh script will be used to initially receive a certificate as well as checking it on a regular schedule and attempt a renewal in case the threshold is reached.
While the script is usually operated by passing the parameters in the terminal we will need to modify some parts of it to be deployed over Intune.
Locate the part of the script that assigns the passed terminal arguments to the variable and adjust them to your needs:
Example configuration:
The URL of the SCEPman app service.
Example: "https://scepman.contoso.net/"
This is the Application ID URI of the SCEPman-api app registration in your environment.
Example: "api://a7a1d6c8-51b9-48ec-9ca0-a363dc2c8436"
The directory the certificate will be created or tried to be renewed. The private key and root certificate will also be placed in here.
Example: ~/certs/
The filename (without extension) of the certificate that will be created or read for renewal.
Example: "myCertificate"
The amount of days the certificate will need to expire in for the script to begin the renewal process.
Example: 30
The type of certificate that will be enrolled.
Can be either "user" or "device"
If you are enrolling or renewing a device certificate the DeviceId will be retrieved from ~/.config/intune/registration.toml and the authenticated user will need to match the owner of the object in the configured DeviceDirectory.
This script does not encrypt the generated keys (this requires passphrase input, so encryption has been omitted to allow for automatic renewal.)
If you are renewing passphrase-protected certificates from Certificate Master, you will need to input this passphrase in order to renew them.
Using Intune we can deploy the modified script on a schedule to initially enroll a certificate with the given parameters and regularly check if it needs to be renewed.
Add a new Linux script deployment and make sure to set the Execution context to User and either upload or paste the content of the modified bash script you created in the prior section.
Adjust the Execution frequency in accordance to your renewal threshold.
The user will be prompted to login to the Azure CLI application on the first execution as they are required to authenticate.
The following prerequisites must be present on the executing client/host to be able to use the Enrollment REST API.
The Azure CLI is used to authenticate the enrolling user to check their eligibility and to retrieve the access token.
Used to send the created CSR to the SCEPman Enrollment API Endpoint and receive certificate.
OpenSSL is used to generate a private key and create a CSR for enrolling or renewing a certificate.
To enroll certificates, users must be authenticated to verify their eligibility. Follow this guide for step-by-step instructions on how to set this up
Required for certificate renewal
Configure your SCEPman App Service to accept mTLS client certificates. In the Configuration blade of the Settings section, verify that the Client certificate mode in Incoming client certificates is set to Optional.
Do not set the Client certificate mode to Require or Allow, as that would break normal operation of SCEPman on the SCEP endpoints!
In order to make use of this scenario, you must set the following Environment Variables on the SCEPman app service.
Required for certificate enrollment and renewal
Set this variable to true to enable the validation of certificate signing requests (CSRs).
Required for certificate renewal
Set this variable to true to enable certificate renewals.
Required for certificate renewal
Set this variable to a comma separated list of certificate types that you want to allow the renewal. See the linked variable documentation for a list of possible certificate types.
Example: Static,IntuneUser,IntuneDevice