20 Commits

Author SHA1 Message Date
Sergio Garcia 633d7bd8a8 fix(instance-metadata): Credentials recovering (#1207)
* fix(instance-metadata): Credentials recovering

* fix(expr): Dockerfile to root and expr in SESSION_TIME_REMAINING.

Co-authored-by: Pepe Fagoaga <pepe@verica.io>
Co-authored-by: sergargar <sergio@verica.io>
2022-06-17 14:23:56 +02:00
Pepe Fagoaga da000b54ca refactor(Prowler): Main logic refactor (#1189)
* fix(aws_profile_loader): New functions

* fix(shellcheck): Temporary remove Shellcheck

* fix(aws_cli_detector): new function

* fix(jq_detector): New function

* fix(os_detector): New function

* fix(output_bucket): Output bucket input check in main

* fix(python_detector): deleted unused python detector

* fix(credentials): credentials check out of whoami

* [break]refactor(main)

* [BREAK] Get list of checks parsing all input options

* [break]refactor(main): execute checks functions

* [break]refactor(main): move functions to libs

* fix(validations): custom check validation and typos

* refactor(validate_options): Include comments

* fix(custom_checks): Minor fixes

* refactor(closing_files): include libraries

* refactor(loader): Include ignored checks

* refactor(main): Fix shellcheck

* refactor(loader): beautify

* refactor(monochrome): without variables

* refactor(modes): MODES array not needed

* refactor(whoami): get error from AWSCLI

* refactor(secrets-detector)

* refactor(secrets-detector)

* fix(html_scoring): html scoring was fixed.

* fix(load_checks_from_file)

* fix(color-code): Print if not mono

* fix(not extra): Fixed if EXCLUDE_CHECK_ID is empty

* fix(IFS): Restore default IFS once modes are parsed

* fix(bucket): validate before whoami

* fix(bucket): validate before whoami

Co-authored-by: n4ch04 <nachor1992@gmail.com>
Co-authored-by: sergargar <sergio@verica.io>
Co-authored-by: Nacho Rivera <59198746+n4ch04@users.noreply.github.com>
2022-06-13 17:34:31 +02:00
Toni de la Fuente 48d7381822 Fix issue #871 2021-11-09 14:21:32 +01:00
Pablo Pagani 5385c4e546 Improved error handling sts get-caller-identity
Instead of looking for a fixed error string, it uses error codes from aws cli
Previos condition was not catching this error message:
An error occurred (ExpiredToken) when calling the GetCallerIdentity operation: The security token included in the request is expired
Also forced the output of the command to json. In some tests I was doing was failing becuase it was sending output as text
2021-05-01 17:54:11 -03:00
Toni de la Fuente dacfea6b32 Included Risk, Remediation and Link support for CSV and HTML outputs 2021-04-07 18:42:44 +02:00
Toni de la Fuente c0f3265754 Better handle permissions and errors 2021-03-24 15:41:51 +01:00
Toni de la Fuente e298158bcd Enhanced error handling without credentials 2020-12-17 17:15:17 +01:00
Toni de la Fuente 91ce905a5a Fix issue assuming role in regions with STS disabled 2020-12-17 16:34:10 +01:00
Toni de la Fuente c34535f585 Fix report metadata in html output 2020-10-15 22:01:28 +02:00
Toni de la Fuente fa925bdef2 Fix account id in output file name 2020-10-15 21:56:44 +02:00
Toni de la Fuente 7e9a5dc8f5 Allow list checks and groups without credentials 2020-09-16 23:11:33 +02:00
Toni de la Fuente 7dc790a3f5 Fixed issue with govcloud on extra764 #536 2020-04-22 20:05:39 +02:00
Toni de la Fuente 8c9aea1231 Improved GetCallerIdentity handling / credentials 2020-04-22 13:54:17 +02:00
Toni de la Fuente 43fb877109 Added account id to the output filename 2020-04-22 12:28:31 +02:00
Toni de la Fuente ef952ce9cc Simplified caller id info on outputs 2020-04-22 12:07:20 +02:00
Marc Jay 92e1f17a80 Adds 'json-asff' and 'securityhub' output modes
json-asff mode outputs JSON, similar to the standard 'json' mode with one check per line, but in AWS Security Finding Format - used by AWS Security Hub
Currently uses a generic Type, Resources and ProductArn value, but sets the Id to a unique value that includes the details of the message, in order to separate out checks that run against multiple resources and output one result per resource per check. This ensures that findings can be updated, should the resource move in or out of compliance

securityhub mode generates the ASFF JSON and then passes it to an 'aws securityhub batch-import-findings' call, once per resource per check. Output to the screen is similar to the standard mode, but prints whether or not the finding was submitted successfully

Fixes #524
2020-04-07 16:08:07 +01:00
Ben Hecht 84e9ef2f94 Add JSON support 2018-05-29 15:22:08 -04:00
Toni de la Fuente e3e038127f license changes for checks 2018-04-09 15:09:30 -04:00
Toni de la Fuente 07b166baa9 changed outputs to the new ones 2018-03-28 11:07:46 -04:00
Toni de la Fuente a21bff31a5 create check files 2018-03-20 22:59:34 -04:00