<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Preventing loading of the process module on Linux in Troubleshooting</title>
    <link>https://community.dynatrace.com/t5/Troubleshooting/Preventing-loading-of-the-process-module-on-Linux/ta-p/213303</link>
    <description>&lt;P&gt;There are two workarounds that can be used on Linux to fully prevent the loading of the process module.&lt;/P&gt;&lt;P&gt;This can be useful for applications you don't want or need to instrument. For instance if the process module is causing crashes in some application.&lt;/P&gt;&lt;H4&gt;LD_AUDIT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;environment variable&lt;/H4&gt;&lt;P&gt;You can prevent the process module from being loaded by setting the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://man7.org/linux/man-pages/man8/ld.so.8.html#ENVIRONMENT" target="_blank" rel="noopener"&gt;LD_AUDIT&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;environment variable to point to the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;oneagentaudit.so&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;library provided with the agent installation. This is a special "auditing" library that will be called by the Linux loader on process startup and which can then block the loading of the process module into that process. In a default full stack agent installation the correct value would be the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;LD_AUDIT=/opt/dynatrace/oneagent/agent/bin/current/linux-x86-64/liboneagentaudit.so&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Newer OneAgent versions may have this library in the following locations:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/opt/dynatrace/oneagent/agent/lib/liboneagentaudit.so
/opt/dynatrace/oneagent/agent/lib64/liboneagentaudit.so&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're having trouble locating the liboneagentaudit you can run something like the below to find the location on Linux systems&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;find / -name "liboneagentaudit.so" 2&amp;gt;/dev/null&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Important notes:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;The auditing interface using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;LD_AUDIT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;environment variable is only available on glibc based Linux systems (which covers almost all distributions except Alpine Linux)&lt;/LI&gt;&lt;LI&gt;The current implementation will cause the following error to be printed in the terminal:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ERROR: ld.so: object '/$LIB/liboneagentproc.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;This is&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;a problem and is simply a sign that the audit library is working correctly.&lt;/LI&gt;&lt;/UL&gt;&lt;H4&gt;Separate mount namespace&lt;/H4&gt;&lt;P&gt;The second alternative is to run the problematic program in a separate&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A title="mountnamespace" href="https://www.man7.org/linux/man-pages/man7/mount_namespaces.7.html" target="_blank" rel="noopener"&gt;mount namespace&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and mount an empty file on top of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;/etc/ld.so.preload&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;within that namespace. This basically hides the existence of the process module from that program while having no impact on the rest of the system. This can be achieved using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;unshare&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;command (with root rights):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;unshare -m -- sh -c 'mount --bind /dev/null /etc/ld.so.preload &amp;amp;&amp;amp; &amp;lt;program to execute&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a permanent effect, the customer might have to add this command to some kind of a startup script or a systemd service file. In case they don't want to start the program as root, one can extend the command to run the final program as some other user like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;unshare -m -- sh -c 'mount --bind /dev/null /etc/ld.so.preload &amp;amp;&amp;amp; su -c "&amp;lt;program to execute&amp;gt;" &amp;lt;user&amp;gt;'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The above command is, for example, necessary in case of a systemd service file where the user has been set to a non-root user. So a service file like this...:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ExecStart=/path/to/binary
User=someuser&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... needs to be modified into something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ExecStart=/usr/bin/unshare -m -- /bin/sh -c 'mount --bind /dev/null /etc/ld.so.preload &amp;amp;&amp;amp; su -c "/path/to/binary" someuser'
User=root&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2024 13:23:01 GMT</pubDate>
    <dc:creator>danmichael</dc:creator>
    <dc:date>2024-10-25T13:23:01Z</dc:date>
    <item>
      <title>Preventing loading of the process module on Linux</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/Preventing-loading-of-the-process-module-on-Linux/ta-p/213303</link>
      <description>&lt;P&gt;There are two workarounds that can be used on Linux to fully prevent the loading of the process module.&lt;/P&gt;&lt;P&gt;This can be useful for applications you don't want or need to instrument. For instance if the process module is causing crashes in some application.&lt;/P&gt;&lt;H4&gt;LD_AUDIT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;environment variable&lt;/H4&gt;&lt;P&gt;You can prevent the process module from being loaded by setting the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://man7.org/linux/man-pages/man8/ld.so.8.html#ENVIRONMENT" target="_blank" rel="noopener"&gt;LD_AUDIT&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;environment variable to point to the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;oneagentaudit.so&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;library provided with the agent installation. This is a special "auditing" library that will be called by the Linux loader on process startup and which can then block the loading of the process module into that process. In a default full stack agent installation the correct value would be the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;LD_AUDIT=/opt/dynatrace/oneagent/agent/bin/current/linux-x86-64/liboneagentaudit.so&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Newer OneAgent versions may have this library in the following locations:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/opt/dynatrace/oneagent/agent/lib/liboneagentaudit.so
/opt/dynatrace/oneagent/agent/lib64/liboneagentaudit.so&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're having trouble locating the liboneagentaudit you can run something like the below to find the location on Linux systems&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;find / -name "liboneagentaudit.so" 2&amp;gt;/dev/null&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Important notes:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;The auditing interface using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;LD_AUDIT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;environment variable is only available on glibc based Linux systems (which covers almost all distributions except Alpine Linux)&lt;/LI&gt;&lt;LI&gt;The current implementation will cause the following error to be printed in the terminal:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ERROR: ld.so: object '/$LIB/liboneagentproc.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;This is&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;a problem and is simply a sign that the audit library is working correctly.&lt;/LI&gt;&lt;/UL&gt;&lt;H4&gt;Separate mount namespace&lt;/H4&gt;&lt;P&gt;The second alternative is to run the problematic program in a separate&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A title="mountnamespace" href="https://www.man7.org/linux/man-pages/man7/mount_namespaces.7.html" target="_blank" rel="noopener"&gt;mount namespace&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and mount an empty file on top of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;/etc/ld.so.preload&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;within that namespace. This basically hides the existence of the process module from that program while having no impact on the rest of the system. This can be achieved using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;unshare&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;command (with root rights):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;unshare -m -- sh -c 'mount --bind /dev/null /etc/ld.so.preload &amp;amp;&amp;amp; &amp;lt;program to execute&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a permanent effect, the customer might have to add this command to some kind of a startup script or a systemd service file. In case they don't want to start the program as root, one can extend the command to run the final program as some other user like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;unshare -m -- sh -c 'mount --bind /dev/null /etc/ld.so.preload &amp;amp;&amp;amp; su -c "&amp;lt;program to execute&amp;gt;" &amp;lt;user&amp;gt;'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The above command is, for example, necessary in case of a systemd service file where the user has been set to a non-root user. So a service file like this...:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ExecStart=/path/to/binary
User=someuser&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... needs to be modified into something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ExecStart=/usr/bin/unshare -m -- /bin/sh -c 'mount --bind /dev/null /etc/ld.so.preload &amp;amp;&amp;amp; su -c "/path/to/binary" someuser'
User=root&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 13:23:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/Preventing-loading-of-the-process-module-on-Linux/ta-p/213303</guid>
      <dc:creator>danmichael</dc:creator>
      <dc:date>2024-10-25T13:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Preventing loading of the process module on Linux</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/Preventing-loading-of-the-process-module-on-Linux/tac-p/213319#M236</link>
      <description>&lt;P&gt;Thanks for sharing this work around&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/41759"&gt;@danmichael&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 15:54:21 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/Preventing-loading-of-the-process-module-on-Linux/tac-p/213319#M236</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2023-05-26T15:54:21Z</dc:date>
    </item>
  </channel>
</rss>

