<?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>topic Re: [systemd] splunk start keeps on asking to enter password in Security</title>
    <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471512#M15210</link>
    <description>&lt;P&gt;Here's what you need to do to achieve what you want,&lt;/P&gt;

&lt;P&gt;[root]$visudo   "to add the below further to the what you have done earlier"&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl restart Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl stop Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl start Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl status Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /opt/splunk/bin/splunk restart &lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /opt/splunk/bin/splunk stop &lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /opt/splunk/bin/splunk start  &lt;/P&gt;

&lt;P&gt;Then, "sudo ./splunk start" or "sudo /opt/splunk/bin/splunk start" will work without requesting password. And still "sudo splunk start" will needs authentication.&lt;/P&gt;

&lt;P&gt;To make "sudo splunk start" work passwordless then add /opt/splunk/bin to secure_path.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;visudo &amp;amp; locate "secure_path", then add "/opt/splunk/bin"  to the end. i.e that would look like as below;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;EM&gt;Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/opt/splunk/bin&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Save the change, confirm it has been configured Okay by "$ visudo -c " &lt;/P&gt;

&lt;P&gt;Use sudo command to splunk start/stop/restart, such as&lt;BR /&gt;
$sudo splunk start &lt;/P&gt;

&lt;P&gt;If you have concerns about the Security by using secure_path you better use systemctl or just use /opt/splunk/bin/splunk command with full path.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Feb 2020 01:16:22 GMT</pubDate>
    <dc:creator>sylim_splunk</dc:creator>
    <dc:date>2020-02-13T01:16:22Z</dc:date>
    <item>
      <title>[systemd] splunk start keeps on asking to enter password</title>
      <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471511#M15209</link>
      <description>&lt;P&gt;I am running 7.3.3 using systemd and running into issues with running splunk restart as splunk user.&lt;BR /&gt;
I ran "splunk enable boot-start -systemd-managed 1 -user splunk"&lt;BR /&gt;
According to the splunk docs in &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/Admin/RunSplunkassystemdservice" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/Admin/RunSplunkassystemdservice&lt;/A&gt; it reads as below;&lt;/P&gt;

&lt;P&gt;*You must use sudo to run splunk start|stop|restart commands. If you do not use sudo, you must authenticate.  *&lt;BR /&gt;
I've read several articles below, but it doesn't appear to fix the issue.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;[splunk]$ sudo splunk restart&lt;BR /&gt;
Send restart to systemctl&lt;BR /&gt;
*&lt;/EM&gt;==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===**&lt;BR /&gt;
Authentication is required to manage system services or units.*&lt;/P&gt;

&lt;P&gt;I followed the steps below and added the commands to sudoers.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;A href="https://answers.splunk.com/answers/724473/major-boot-start-change-with-723-1.html" target="_blank"&gt;https://answers.splunk.com/answers/724473/major-boot-start-change-with-723-1.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/710045/splunk-722-systemd-root-privileges-required-when-s.html" target="_blank"&gt;https://answers.splunk.com/answers/710045/splunk-722-systemd-root-privileges-required-when-s.html&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Here's my current systemd script&lt;BR /&gt;
[root]# cat /etc/systemd/system/Splunkd.service&lt;/P&gt;

&lt;H1&gt;This unit file replaces the traditional start-up script for systemd&lt;/H1&gt;

&lt;H1&gt;configurations, and is used when enabling boot-start for Splunk on&lt;/H1&gt;

&lt;H1&gt;systemd-based Linux distributions.&lt;/H1&gt;

&lt;P&gt;[Unit]&lt;BR /&gt;
Description=Systemd service file for Splunk, generated by 'splunk enable boot-start'&lt;BR /&gt;
After=network.target&lt;/P&gt;

&lt;P&gt;[Service]&lt;BR /&gt;
Type=simple&lt;BR /&gt;
Restart=always&lt;BR /&gt;
ExecStart=/opt/splunk/bin/splunk _internal_launch_under_systemd&lt;BR /&gt;
LimitNOFILE=65536&lt;BR /&gt;
SuccessExitStatus=51 52&lt;BR /&gt;
RestartPreventExitStatus=51&lt;BR /&gt;
RestartForceExitStatus=52&lt;BR /&gt;
User=splunk&lt;BR /&gt;
Delegate=true&lt;BR /&gt;
CPUShares=1024&lt;BR /&gt;
MemoryLimit=7831937024&lt;BR /&gt;
PermissionsStartOnly=true&lt;BR /&gt;
ExecStartPost=/bin/bash -c "chown -R 1003:1003 /sys/fs/cgroup/cpu/system.slice/%n"&lt;BR /&gt;
ExecStartPost=/bin/bash -c "chown -R 1003:1003 /sys/fs/cgroup/memory/system.slice/%n"&lt;/P&gt;

&lt;P&gt;[Install]&lt;BR /&gt;
WantedBy=multi-user.target&lt;/P&gt;

&lt;P&gt;I also tried adding the following in my /etc/sudoers&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl restart Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl stop Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl start Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl status Splunkd.service&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:11:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471511#M15209</guid>
      <dc:creator>sylim_splunk</dc:creator>
      <dc:date>2020-09-30T04:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: [systemd] splunk start keeps on asking to enter password</title>
      <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471512#M15210</link>
      <description>&lt;P&gt;Here's what you need to do to achieve what you want,&lt;/P&gt;

&lt;P&gt;[root]$visudo   "to add the below further to the what you have done earlier"&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl restart Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl stop Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl start Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /usr/bin/systemctl status Splunkd.service&lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /opt/splunk/bin/splunk restart &lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /opt/splunk/bin/splunk stop &lt;BR /&gt;
splunk ALL=(root) NOPASSWD: /opt/splunk/bin/splunk start  &lt;/P&gt;

&lt;P&gt;Then, "sudo ./splunk start" or "sudo /opt/splunk/bin/splunk start" will work without requesting password. And still "sudo splunk start" will needs authentication.&lt;/P&gt;

&lt;P&gt;To make "sudo splunk start" work passwordless then add /opt/splunk/bin to secure_path.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;visudo &amp;amp; locate "secure_path", then add "/opt/splunk/bin"  to the end. i.e that would look like as below;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;EM&gt;Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/opt/splunk/bin&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Save the change, confirm it has been configured Okay by "$ visudo -c " &lt;/P&gt;

&lt;P&gt;Use sudo command to splunk start/stop/restart, such as&lt;BR /&gt;
$sudo splunk start &lt;/P&gt;

&lt;P&gt;If you have concerns about the Security by using secure_path you better use systemctl or just use /opt/splunk/bin/splunk command with full path.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 01:16:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471512#M15210</guid>
      <dc:creator>sylim_splunk</dc:creator>
      <dc:date>2020-02-13T01:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: [systemd] splunk start keeps on asking to enter password</title>
      <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471513#M15211</link>
      <description>&lt;P&gt;Also refer to &lt;A href="https://answers.splunk.com/answers/738877/splunk-systemd-unit-file-in-versions-722-and-newer.html"&gt;Splunk systemd unit file in versions 7.2.2 and newer - how do I stop this prompting for the root password? (Q&amp;amp;A)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 07:25:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471513#M15211</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2020-02-13T07:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: [systemd] splunk start keeps on asking to enter password</title>
      <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471514#M15212</link>
      <description>&lt;P&gt;Hmm, The first lines are fine but they require to call sudo &lt;BR /&gt;
The last 2 lines seems risky. &lt;BR /&gt;
Adding a sudo sentence that run the splunk binary as root is kind of defeating the whole initial thing of not having splunk run as root &lt;BR /&gt;
If you are the attacker running as splunk, you could just replace the splunk binary with whatever you want and become easily root....&lt;BR /&gt;
The proper and secure way is to use to the os way of allowing a unpriviledge process to call systemd, which is policykit.&lt;BR /&gt;
Unfortunaltely, it is os systemd and policykit dependent and requir some conf but that' perfectly work on at least the RH7/8 + Centos7/8 + AWS2 distributions.&lt;BR /&gt;
The answer post linked below is pointing at this solution&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 08:46:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471514#M15212</guid>
      <dc:creator>maraman_splunk</dc:creator>
      <dc:date>2020-02-13T08:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: [systemd] splunk start keeps on asking to enter password</title>
      <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471515#M15213</link>
      <description>&lt;P&gt;The solution in the linked answer is much more safer to use as leverage the os mechanism to give access to systemd from splunk. (with a little bit of help of a additional script to be more fine grained)&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 08:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471515#M15213</guid>
      <dc:creator>maraman_splunk</dc:creator>
      <dc:date>2020-02-13T08:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: [systemd] splunk start keeps on asking to enter password</title>
      <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471516#M15214</link>
      <description>&lt;P&gt;I agree on your points. That'd be the same, as risky as adding systemctl command to sudo which eventually runs splunk as root, then setuid to splunk..&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 20:14:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/471516#M15214</guid>
      <dc:creator>sylim_splunk</dc:creator>
      <dc:date>2020-02-13T20:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: [systemd] splunk start keeps on asking to enter password</title>
      <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/654087#M17210</link>
      <description>&lt;P&gt;IF YOU NEED TO SET THE USER AS ROOT THEN WHY IS THERE EVEN A **bleep**ING USER?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 14:18:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/654087#M17210</guid>
      <dc:creator>kringo</dc:creator>
      <dc:date>2023-08-11T14:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: [systemd] splunk start keeps on asking to enter password</title>
      <link>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/681437#M17714</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Did u find the secure solution ??&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 17:41:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/systemd-splunk-start-keeps-on-asking-to-enter-password/m-p/681437#M17714</guid>
      <dc:creator>evinasco08</dc:creator>
      <dc:date>2024-03-20T17:41:14Z</dc:date>
    </item>
  </channel>
</rss>

