Ad Widget

Collapse

Running "nmap" with "-O" option doesn t run un external script.Why?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gunsthall
    Junior Member
    Zabbix Certified Specialist
    • Jul 2011
    • 15

    #1

    Running "nmap" with "-O" option doesn t run un external script.Why?

    Hi. I m new with this great Zabbix tool.
    I m trying to launch an "nmap -v -O x.x.x.x" order from an external script to check some information after a trigger change. It works without the "-O" option but WITH the -O option it doesn t run, I presume because he -O option requires root privileges. Am I right?
    I though the zabbix server running teh script had root privileges. (Sorry I m a old Windows guys, recently moved to Linux)

    Any suggestion? It s quite importat the get that info.

    Thanks!
  • JBo
    Senior Member
    • Jan 2011
    • 310

    #2
    Hi,

    Originally posted by Gunsthall
    I m trying to launch an "nmap -v -O x.x.x.x" order from an external script to check some information after a trigger change. It works without the "-O" option but WITH the -O option it doesn t run, I presume because he -O option requires root privileges. Am I right?
    That's right.

    Originally posted by Gunsthall
    I though the zabbix server running teh script had root privileges. (Sorry I m a old Windows guys, recently moved to Linux)
    zabbix server doesn't have root privilege (it is run as zabbix user).
    For security reasons, Linux services don't use root account unless necessary.

    Originally posted by Gunsthall
    Any suggestion? It s quite importat the get that info.
    You can try to use sudo to give nmap root privilege:
    Your command will be
    Code:
    sudo nmap -v -O x.x.x.x
    And you will need to allow it in /etc/sudoers file:
    Code:
    zabbix  ALL=NOPASSWD: /usr/bin/nmap
    Regards,
    JBo

    Comment

    • richlv
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Oct 2005
      • 3112

      #3
      btw, 1.8.6 virtual appliance has a frontend (global) script example exactly with nmap -O
      Zabbix 3.0 Network Monitoring book

      Comment

      • Gunsthall
        Junior Member
        Zabbix Certified Specialist
        • Jul 2011
        • 15

        #4
        Thnaks! Solved

        Thanks mate! That was the solution.

        Great and fast help!

        Comment

        • Jarne St
          Member
          • Sep 2019
          • 63

          #5
          Thank you for the solution! But the entry in the sudoers file produces some warnings:
          Originally posted by JBo
          Code:
          zabbix ALL=NOPASSWD: /usr/bin/nmap
          Produced the following warnings:
          Code:
          zabbix : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/nmap -O 172.27.0.149
          sudo[63377]: pam_unix(sudo:session): session opened for user root by (uid=0)
          sudo[63377]: pam_unix(sudo:session): session closed for user root
          How can you adapt this line to get rid of the warning?

          Comment

          • NE1Scott
            Member
            • Jan 2021
            • 49

            #6
            It would be nice to figure out how to make the change so the option withjin Zabbix when you click on a host that says "Detect operating system" would now work for all Zabbix users.

            Comment

            Working...