diff --git a/Dockerfile b/Dockerfile index 7a2cb2b..94a7538 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ ADD Gemfile /sectools ADD Gemfile.lock /sectools # required for ssh-keyscan -RUN apk --update add openssh-client && apk --update add bash +RUN apk --update add openssh-client && apk --update add bash && \ + rm -rf /var/cache/apk/* RUN gem install ssh_scan bundler @@ -17,7 +18,6 @@ RUN apk --update add --virtual build-dependencies ruby-dev build-base && \ COPY . /ssh_scan - HEALTHCHECK --interval=30s --timeout=5s --start-period=120s --retries=3 CMD curl --fail http://localhost:8080/status || exit 1 COPY src/ src/ diff --git a/Gemfile b/Gemfile index 0eac804..a9ddc98 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,6 @@ source 'https://rubygems.org' gem "sinatra" gem "rest-client" -gem "ssh_scan" +gem "ssh_scan", :git => "https://github.com/secureCodeBox/ssh_scan.git" gem "ruby-scanner-scaffolding", :git => "https://github.com/secureCodeBox/ruby-scanner-scaffolding.git", :tag => "v1.0.0" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 7a17932..acdfba8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,16 @@ GIT specs: ruby-scanner-scaffolding (1.0.0) +GIT + remote: https://github.com/secureCodeBox/ssh_scan.git + revision: 414332a84546afaf89485a1268e3824c70914616 + specs: + ssh_scan (0.0.41) + bindata (= 2.4.3) + net-ssh (= 5.0.2) + netaddr (= 1.5.1) + sshkey + GEM remote: https://rubygems.org/ specs: @@ -38,11 +48,6 @@ GEM rack (~> 2.0) rack-protection (= 2.0.5) tilt (~> 2.0) - ssh_scan (0.0.40) - bindata (= 2.4.3) - net-ssh (= 5.0.2) - netaddr (= 1.5.1) - sshkey sshkey (2.0.0) tilt (2.0.9) unf (0.1.4) @@ -58,7 +63,7 @@ DEPENDENCIES rest-client ruby-scanner-scaffolding! sinatra - ssh_scan + ssh_scan! BUNDLED WITH 2.0.1 diff --git a/src/main.rb b/src/main.rb index 37cfa0f..5b1a9ef 100644 --- a/src/main.rb +++ b/src/main.rb @@ -16,13 +16,13 @@ ['PROCESS_TARGETS'] ) - healthcheckClient = Healthcheck.new +healthcheckClient = Healthcheck.new get '/status' do status 500 if client.healthy? status 200 - end + end content_type :json healthcheckClient.check(client) end diff --git a/src/ssh_scan.rb b/src/ssh_scan.rb index b9fa171..3ebfe0b 100644 --- a/src/ssh_scan.rb +++ b/src/ssh_scan.rb @@ -6,7 +6,7 @@ require_relative './ssh_result_transformer' $logger = Logger.new(STDOUT) - +$logger.level = if ENV.key? 'DEBUG' then Logger::DEBUG else Logger::INFO end class SshScan attr_reader :raw_results diff --git a/src/ssh_worker.rb b/src/ssh_worker.rb index b37a870..eb86856 100644 --- a/src/ssh_worker.rb +++ b/src/ssh_worker.rb @@ -29,7 +29,6 @@ def work(job_id, targets) if scan.errored @errored = true end - scan { findings: scan.results,