Score:1

OpenSCAP ssh with keyfile

cn flag

I would like to test a CentOS system with OpenSCAP run from my Windows PC. The problem is that I can ssh to the CentOS with keyfile only, as per company policy. I did not find whether SCAP workbench supports this. Can it be done or I need ssh password?

Score:1
us flag

At least on scap-workbench 1.2.1 you can run the scan with Dry run toggled and this will give you the command line to be executed for the scan. With this command line you can override ssh options using the variable as seen in the oscap-ssh help:

To supply additional options to ssh/scp, define the SSH_ADDITIONAL_OPTIONS variable For instance, to ignore known hosts records, define SSH_ADDITIONAL_OPTIONS='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'

And from ssh options you can use the option -i identity_file to provide the filepath of the private key you want to use for authentication.

In the end you will have something like:

$ export SSH_ADDITIONAL_OPTIONS='-i /path/to/private/key'

$ oscap-ssh [email protected] 22 xccdf eval --datastream-id scap_org.open-scap_datastream_from_xccdf_ssg-fedora-xccdf-1.2.xml --xccdf-id scap_org.open-scap_cref_ssg-fedora-xccdf-1.2.xml --profile xccdf_org.ssgproject.content_profile_ospp --oval-results --results /tmp/xccdf-results.xml --results-arf /tmp/arf.xml --report /tmp/report.html /tmp/scap-workbench-XDOICh/ssg-fedora-ds.xml

Score:0
jp flag

It may be very late but I also ran into the same problem so I just added my key to ssh-agent so that I don't need to specify key to ssh command...on my mac I just checked the agent using ssh-agent command, which showed me that it's running and then I used ssh-add <path-to-key-file> to add the key (once added you can run ssh-add -l to list they added keys). And next time when you run your workbench it will automatically try the added key to ssh to the remote instance.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.