1
0
-1

I'm still testing the software and I'm creating customized additions to the audit script (linux) to search out alternate web servers and configurations beyond just apache.

Currently working on nginx, but I'm finding that even though the code generates an xml file listing two server_item entries (two different websites), it's only importing one into the database when the xml is submitted.

I cannot determine if there's something that's required/mandatory in the server_item configs that is not clear from the database schema. At first I thought that it perhaps only allowed one website per port (i.e. - that if a second website was listed on port 80, it would just overwrite the first), but I have several other servers that are showing multiple sites with the same port.

Below is the snippet that is produced by the audit:

<item>
  <type>website</type>
  <parent_name>NGINX</parent_name>
  <name>ipm</name>
  <description></description>
  <id_internal>ipm</id_internal>
  <ip></ip>
  <hostname>[cannot share this here]</hostname>
  <port>80</port>
  <status></status>
  <instance></instance>
  <path>/ipm/bundle/public</path>
</item>
<item>
  <type>website</type>
  <parent_name>NGINX</parent_name>
  <name>nginx</name>
  <description></description>
  <id_internal>nginx</id_internal>
  <ip></ip>
  <hostname>localhost</hostname>
  <port>80</port>
  <status></status>
  <instance></instance>
  <path>/usr/share/nginx/html</path>
</item>

Only the second item is showing up in the database after this is imported. Any suggestions/ideas?

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      The server items must be unique in name + type + instance. Yours appear to be fine there.

      Do you have an entry item for server that has a name of NGINX and a type of "web" in your audit result XML?

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Thanks. I honestly have no idea what happened, but after a few tweaks to the code that was extracting the path data, it just started importing properly. There were no duplicates of that 3-field-key combo anywhere else.

        I'm chalking it up to a glitch that I'm not going to break my brain over. Thanks for your time! It is helpful at least to know the unique key combos for the future.

        Is there a community location for sharing code snippets like this? I can submit the nginx audit components and others as I continue development.

          CommentAdd your comment...