Discussion:
Unable to add target with credentials using OMP
o***@xoxy.net
2014-09-17 22:06:30 UTC
Permalink
Hi,

The Greenbone interface for OpenVAS 7 won't let me add a target with
credentials, so I'm trying to do it with OMP ... but I'm getting an error
message.

Would anyone be able to give me a workaround or tell me what I'm doing
wrong? Maybe I just need another pair of eyes on it. Here are the details:

# omp -X '
<create_lsc_credential>
<name>OpenVAS SSH Key</name>
<login>root</login>
<key>
<private>-----BEGIN RSA PRIVATE KEY-----
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-----END RSA PRIVATE KEY-----</private>
<public>ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQCjoIDsiJWLMtGp7dNa4KinMsJroEceK/DkgZmGcGInctAUDfj5wFoFMKjPsuPn9dvRWqG9NYJBazCAK6OeqowEGJ4FcAHDGRSn1JB27a4/8KlHopwikMXHlSIZPnSp/xeiKRnBV+MBN433CovigVsh0NsRyB4Wzl5Ng+NYNPP0TkoTc+gWwBO7icIbyeg4epqOVL9LjVlh2dpRNQpx9yyDatLOie8cgrvbsMiVG9gC/aqVSiXwW2cgyckEz+2mDmgCIGf7Spd3Fi5Ohw9zebn7aw54qoYaAbThEyeWRKwie/DvvO7U4RtAijHDzvQ48NOYFQx7nlqWyCoiY+SGtATZ
***@openvas</public>
</key>
</create_lsc_credential>
'


This appears to succeed.

# cat bin/ompx
#!/bin/bash
omp -i -X "<$*/>"
# ompx get_lsc_credentials
<get_lsc_credentials_response status_text="OK" status="200">
<lsc_credential id="d50da9b2-58a3-4c19-8194-a3d1d5d7ca14">
<owner>
<name>admin</name>
</owner>
<name>OpenVAS SSH Key</name>
<comment></comment>
<creation_time>2014-09-17T20:17:36Z</creation_time>
<modification_time>2014-09-17T21:04:59Z</modification_time>
<writable>1</writable>
<in_use>0</in_use>
<permissions>
<permission>
<name>Everything</name>
</permission>
</permissions>
<user_tags>
<count>0</count>
</user_tags>
<login>root</login>
<type>gen</type>
</lsc_credential>
...


But adding a target with these credentials fails.

# omp -v -X '
<create_target>
<name>Johns Test VM</name>
<hosts>10.0.1.17</hosts>
<ssh_lsc_credential id=”d50da9b2-58a3-4c19-8194-a3d1d5d7ca14”>
<port>22</port>
</ssh_lsc_credential>
</create_target>
'
WARNING: Verbose mode may reveal passwords!
Will try to connect to host localhost, port 9390...
Sending to manager:
<create_target>
<name>Johns Test VM</name>
<hosts>10.0.1.17</hosts>
<ssh_lsc_credential id=”d50da9b2-58a3-4c19-8194-a3d1d5d7ca14”>
<port>22</port>
</ssh_lsc_credential>
</create_target>
lib xml-Message: Error: Error on line 1 char 1: Document was empty or
contained only whitespace
(omp:3776): lib xml-WARNING **: End error: Error on line 1 char 1:
Document was empty or contained only whitespace
Failed to read response.



I'm using the OpenVAS 7 virtual appliance, which I updated to the latest:

greenbone-security-assistant-5.0.3.tar.gz
openvas-cli-1.3.0.tar.gz
openvas-libraries-7.0.4.tar.gz
openvas-manager-5.0.4.tar.gz
openvas-scanner-4.0.3.tar.gz


Any help would be much appreciated!

--John
Sept 17, 2014
Matthew Mundell
2014-09-18 07:55:01 UTC
Permalink
Post by o***@xoxy.net
Any help would be much appreciated!
The Manager logs (var/log/openvas/openvasmd.log) may indicate why the
CREATE_TARGET is failing. To enable logging: add -v to openvasmd, and
replace 127 with 128 in etc/openvas/openvasmd_log.conf.

--
Greenbone Networks GmbH
Neuer Graben 17, 49074 Osnabrueck, Germany | AG Osnabrueck, HR B 202460
Executive Directors: Lukas Grunwald, Dr. Jan-Oliver Wagner
Matthew Mundell
2014-09-18 21:10:16 UTC
Permalink
Post by o***@xoxy.net
<create_target>
<name>Johns Test VM</name>
<hosts>10.0.1.17</hosts>
<ssh_lsc_credential id=”d50da9b2-58a3-4c19-8194-a3d1d5d7ca14”>
The UTF-8 quotation marks here seem to be the problem. Try with a regular ".
Post by o***@xoxy.net
<port>22</port>
</ssh_lsc_credential>
</create_target>
lib xml-Message: Error: Error on line 1 char 1: Document was empty or
contained only whitespace
Document was empty or contained only whitespace
Failed to read response.
--
Greenbone Networks GmbH
Neuer Graben 17, 49074 Osnabrueck, Germany | AG Osnabrueck, HR B 202460
Executive Directors: Lukas Grunwald, Dr. Jan-Oliver Wagner
John Lammers
2014-09-18 14:59:30 UTC
Permalink
Thanks Matthew. I added -v and replaced all 127's with 128's.
Oddly, trying to add the target only produced 3 debug messages.

Here's the last 30 lines of openvasmd.log

event lsc_credential:MESSAGE:2014-09-16 22h28.42 UTC:7176: LSC Credential
8d8897ba-1aec-493c-b9eb-ba671703a36d has been created by admin
lib rer:WARNING:2014-09-16 22h28.55 UTC:7203: Target source configuration
could not be loaded.
lib auth: INFO:2014-09-17 14h59.53 utc:2026: Authentication configuration
not found.
event lsc_credential:MESSAGE:2014-09-17 18h12.50 UTC:17279: LSC Credential
8d8897ba-1aec-493c-b9eb-ba671703a36d has been modified by admin
lib rer:WARNING:2014-09-17 18h13.39 UTC:17299: Target source
configuration could not be loaded.
event lsc_credential:MESSAGE:2014-09-17 20h16.11 UTC:17849: LSC Credential
8d8897ba-1aec-493c-b9eb-ba671703a36d has been deleted by admin
base gpgme:MESSAGE:2014-09-17 20h17.36 UTC:17864: Setting GnuPG homedir to
'/usr/local/var/lib/openvas/gnupg'
base gpgme:MESSAGE:2014-09-17 20h17.36 UTC:17864: Using OpenPGP engine
version '1.4.12'
event lsc_credential:MESSAGE:2014-09-17 20h17.36 UTC:17864: LSC Credential
d50da9b2-58a3-4c19-8194-a3d1d5d7ca14 has been created by admin
event report:MESSAGE:2014-09-17 20h32.10 UTC:17936: Report
581aaa3b-50b2-452d-9049-5a8e8feac34e has been deleted by admin
lib rer:WARNING:2014-09-17 20h32.23 UTC:17946: Target source
configuration could not be loaded.
event lsc_credential:MESSAGE:2014-09-17 20h33.04 UTC:17958: LSC Credential
d50da9b2-58a3-4c19-8194-a3d1d5d7ca14 has been modified by admin
lib rer:WARNING:2014-09-17 20h37.05 UTC:17985: Target source
configuration could not be loaded.
lib rer:WARNING:2014-09-17 20h37.11 UTC:17988: Target source
configuration could not be loaded.
event target:MESSAGE:2014-09-17 20h37.19 UTC:17991: Target
f59262d8-cb92-4200-93f7-7b1277b89663 has been modified by admin
event target:MESSAGE:2014-09-17 20h37.44 UTC:18001: Target
f59262d8-cb92-4200-93f7-7b1277b89663 has been modified by admin
event lsc_credential:MESSAGE:2014-09-17 21h04.59 UTC:18206: LSC Credential
d50da9b2-58a3-4c19-8194-a3d1d5d7ca14 has been modified by admin
event task:MESSAGE:2014-09-17 21h18.22 UTC:18282: Status of task
(94daaefb-89ec-401d-bdaa-096f3f744a48) has changed to New
event task:MESSAGE:2014-09-17 21h18.22 UTC:18282: Task
94daaefb-89ec-401d-bdaa-096f3f744a48 has been created by admin
event task:MESSAGE:2014-09-17 21h18.47 UTC:18287: Status of task Scan Johns
Test VM (94daaefb-89ec-401d-bdaa-096f3f744a48) has changed to Requested
event task:MESSAGE:2014-09-17 21h18.47 UTC:18287: Task
94daaefb-89ec-401d-bdaa-096f3f744a48 has been requested to start by admin
lib serv:WARNING:2014-09-17 21h18.47 UTC:18287: Failed to gnutls_bye:
Error in the push function.
event task:MESSAGE:2014-09-17 21h18.48 UTC:18289: Status of task Scan Johns
Test VM (94daaefb-89ec-401d-bdaa-096f3f744a48) has changed to Running
event task:MESSAGE:2014-09-17 21h28.09 UTC:18289: Status of task Scan Johns
Test VM (94daaefb-89ec-401d-bdaa-096f3f744a48) has changed to Done
md main:WARNING:2014-09-17 21h28.09 UTC:18289: sql_giveup: cannot start a
transaction within a transaction
lib auth: INFO:2014-09-18 14h12.44 utc:2120: Authentication configuration
not found.
lib auth: INFO:2014-09-18 14h29.48 utc:4103: Authentication configuration
not found.
lib serv: DEBUG:2014-09-18 14h32.03 utc:4176: Shook hands with peer.
lib serv: DEBUG:2014-09-18 14h32.03 utc:4176: Connected to server on
socket 10.
lib serv: DEBUG:2014-09-18 14h32.04 utc:4176: Shook hands with peer.


On Thu, Sep 18, 2014 at 3:55 AM, Matthew Mundell -
Post by Matthew Mundell
Post by o***@xoxy.net
Any help would be much appreciated!
The Manager logs (var/log/openvas/openvasmd.log) may indicate why the
CREATE_TARGET is failing. To enable logging: add -v to openvasmd, and
replace 127 with 128 in etc/openvas/openvasmd_log.conf.
--
Greenbone Networks GmbH
Neuer Graben 17, 49074 Osnabrueck, Germany | AG Osnabrueck, HR B 202460
Executive Directors: Lukas Grunwald, Dr. Jan-Oliver Wagner
On Thu, Sep 18, 2014 at 3:55 AM, Matthew Mundell -
Post by Matthew Mundell
Post by o***@xoxy.net
Any help would be much appreciated!
The Manager logs (var/log/openvas/openvasmd.log) may indicate why the
CREATE_TARGET is failing. To enable logging: add -v to openvasmd, and
replace 127 with 128 in etc/openvas/openvasmd_log.conf.
--
Greenbone Networks GmbH
Neuer Graben 17, 49074 Osnabrueck, Germany | AG Osnabrueck, HR B 202460
Executive Directors: Lukas Grunwald, Dr. Jan-Oliver Wagner
John Lammers
2014-09-18 20:46:12 UTC
Permalink
Thanks Matt, that was it.

The bad double quotes came from copying and pasting from
http://elastic-security.com/2013/07/18/automation-of-vulnerability-assessments-with-openvas/

Much appreciated.

By the way, I'm now rolling with the OpenVAS DEMO Virtual Appliance *Version
2.0*, released just this morning.

--John


On Thu, Sep 18, 2014 at 5:10 PM, Matthew Mundell -
Post by Matthew Mundell
Post by o***@xoxy.net
<create_target>
<name>Johns Test VM</name>
<hosts>10.0.1.17</hosts>
<ssh_lsc_credential id=”d50da9b2-58a3-4c19-8194-a3d1d5d7ca14”>
The UTF-8 quotation marks here seem to be the problem. Try with a regular
".
Post by o***@xoxy.net
<port>22</port>
</ssh_lsc_credential>
</create_target>
lib xml-Message: Error: Error on line 1 char 1: Document was empty
or
Post by o***@xoxy.net
contained only whitespace
Document was empty or contained only whitespace
Failed to read response.
--
Greenbone Networks GmbH
Neuer Graben 17, 49074 Osnabrueck, Germany | AG Osnabrueck, HR B 202460
Executive Directors: Lukas Grunwald, Dr. Jan-Oliver Wagner
Loading...