To configure how Dynatrace Managed elevates operating system permissions for maintenance operations, follow these steps.
Review elevated permissions
Configure during installation
Reconfigure dtrun
Verify elevated permissions
The command examples on this page assume the following configuration:
dynatrace (default) is a user that runs all Dynatrace OS services/opt/dynatrace-managed//var/opt/dynatrace-managed/If your configuration is different, adjust your actions accordingly.
An OS user who runs Dynatrace Managed services needs elevated permissions to perform the following tasks:
For the complete list of commands that require elevated permissions, check the /opt/dtrun/dtrun.conf file. The root user owns the /opt/dtrun directory and all files inside it for security reasons.
By default, Dynatrace Managed uses sudo to elevate permissions for maintenance operations. You don't need to configure a different command when sudo is available and allowed by your operating system policies.
If sudo isn't available, or if your operating system policies require a different elevation command, specify the command during installation.
pbrun, sesudo, or suexec when the installer asks about elevated permissions.Dynatrace Managed uses the dtrun script to run commands that require elevated permissions. The dtrun script wraps sudo or the alternative command you provide during installation.
The location of dtrun is /opt/dtrun/dtrun. The /opt/dtrun/dtrun.conf file lists the commands that dtrun can run. dtrun can run only the scripts and commands included in /opt/dtrun/dtrun.conf.
If a Managed Cluster node needs to run a command as the root user, the Managed Cluster uses the SUDO_COMMAND set during installation to gain elevated permissions. Examples include adding iptables rules, restarting a component, or running the upgrader.
If you need to reconfigure an existing installation to use a sudo alternative, you can run a reconfiguration script. For example, to change the sudo command to pbrun, use this script to rerun the installer:
sudo /opt/dynatrace-managed/installer/reconfigure.sh --sudo-cmd "/usr/bin/pbrun \$CMD"
Verify that dtrun can run commands with elevated permissions.
To verify permission elevation with sudo, run the following command as the root user:
su - dynatrace -s /bin/bash -c 'sudo /opt/dtrun/dtrun service dynatrace-server status'
To verify permission elevation with the pbrun sudo alternative, run the following command as the root user:
su - dynatrace -s /bin/bash -c 'pbrun /opt/dtrun/dtrun service dynatrace-server status'
After verification succeeds, Dynatrace Managed can use the configured elevated permissions command for maintenance operations.
If there is an issue with permissions, installation logs can contain entries such as:
sudo: pam_open_session: System errorsudo: policy plugin failed session initialization
Check the following logs for elevated permission issues:
/var/opt/dynatrace-managed/log/dtrun.log (dtrun logs)/var/opt/dynatrace-managed/log/launch-logging.log (Services launcher script logs)When troubleshooting sudo or elevated permission issues, run the entire configuration check and compare the output. The following commands should generate output when you run them as the root user:
cat /etc/sudoers | grep -i includecat /etc/sudoers.d/dynatracesu - dynatrace -s /bin/bash -c 'sudo /opt/dtrun/dtrun iptables -L -n'cat /etc/sudoers | grep dynatracecat /etc/passwd | grep dynatracecat /etc/shadow | grep dynatracechage -l dynatrace
The chage command tells you if the password is about to expire. Password expiration can cause issues with sudo access.
While adding a node to the Managed Cluster as a root user, you may encounter the following authentication error:
Installation failed, with status: installer unpacked, system verified, connected to Mission Control, connected to Dynatrace cluster, added to Dynatrace cluster, agent downloaded after 2 minutes 44 seconds.Exit code: 5Errors:Installation failed, with error Dtrun doesn't work properly, check if command "/opt/dtrun/dtrun" is permitted to run with elevated privileges. The dtrun validation failed with error: sudo: PAM account management error: Authentication service cannot retrieve authentication info
The cause may be that the dynatrace user can't gain elevated privileges for /opt/dtrun/dtrun. During Managed installation, the installer automatically adds these privileges to the sudo configuration if sudo is present and active in the system.
/etc/sudoers file:
#includedir /etc/sudoers.d
/etc/sudoers.d/dynatrace with the following contents:
Defaults:dynatrace !requirettyDefaults:dynatrace !env_resetdynatrace ALL=(root:root) NOPASSWD:/opt/dtrun/dtrun
dynatrace user start /opt/dtrun/dtrun with root rights without entering a password.sudo-1.8.23-1.el7 and later evaluate the PAM account stack and enforce account restrictions through PAM. The PAM account stack evaluation affects host-based access control and password expiration.
Add sudo to the list of allowed services in your access control rules. Make sure users don't have an expired password, even when they use SSH keys to sign in.
When you perform additional security checks to control what dtrun can run, verify that the configured elevation command still works.
To verify sudo, run the following command as the root user:
su - dynatrace -s /bin/bash -c 'sudo /opt/dtrun/dtrun service dynatrace-server status'
To verify the pbrun sudo alternative, run the following command as the root user:
su - dynatrace -s /bin/bash -c 'pbrun /opt/dtrun/dtrun service dynatrace-server status'