-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mechanism to check the regions parameter for AWS buckets #23431
Comments
UpdateThe idea for this issue is to throw an error message as root@wazuh-master:/# /var/ossec/wodles/aws/aws-s3 -sr cloudwatchlogs -g 4_5_test -d 2 -s 2022-JUL-29 -p default -r us-fake-1
DEBUG: +++ Debug mode on - Level: 2
DEBUG: +++ ERROR: Invalid region 'us-fake-1' |
Update
root@wazuh-master:/# /var/ossec/wodles/aws/aws-s3 -b wazuh-aws-wodle-config -t config -s 2021-DEC-9 -p default -d2 --regions us-fake-1
DEBUG: +++ Debug mode on - Level: 2
DEBUG: +++ ERROR: Invalid region 'us-fake-1' |
UpdateTests conducted to verify its functionality:Bucket root@wazuh-master:/# /var/ossec/wodles/aws/aws-s3 -b wazuh-aws-wodle-config -t config -s 2021-DEC-9 -p default -d2 --regions us-fake-1
DEBUG: +++ Debug mode on - Level: 2
DEBUG: +++ ERROR: Invalid region 'us-fake-1' Bucket root@wazuh-master:/# /var/ossec/wodles/aws/aws-s3 -b wazuh-aws-wodle-config -t config -s 2021-DEC-9 -p default -d2
DEBUG: +++ Debug mode on - Level: 2
DEBUG: No retries configuration found in profile config. Generating default configuration for retries: mode: standard - max_attempts: 10
DEBUG: Created Config object using profile: 'default' configuration
DEBUG: +++ Working on 123456789 - us-east-1
DEBUG: +++ Marker: AWSLogs/123456789/Config/us-east-1/2021/12/9
DEBUG: ++ Found new log: AWSLogs/123456789/Config/us-east-1/2021/12/9/166157441623_Config_us-east-1_ConfigHistory_AWS::Config::ResourceCompliance_20211209T004303Z_20211209T025123Z_1.json.gz
DEBUG: ++ Found new log: AWSLogs/123456789/Config/us-east-1/2022/1/25/166157441623_Config_us-east-1_ConfigHistory_AWS Config ResourceCompliance_20220125T004303Z_20220125T025123Z_1.json.gz
DEBUG: ++ Found new log: AWSLogs/123456789/Config/us-east-1/2022/11/1/166157441623_Config_us-east-1_ConfigHistory_AWS Config ResourceCompliance_20220216T004303Z_20220216T025123Z_1.json.gz
DEBUG: ++ Found new log: AWSLogs/123456789/Config/us-east-1/2022/11/22/166157441623_Config_us-east-1_ConfigHistory_AWS Config ResourceCompliance_20220216T004303Z_20220216T025123Z_1.json.gz
DEBUG: ++ Found new log: AWSLogs/123456789/Config/us-east-1/2022/2/11/166157441623_Config_us-east-1_ConfigHistory_AWS Config ResourceCompliance_20220211T004303Z_20220211T025123Z_1.json.gz
DEBUG: ++ Found new log: AWSLogs/123456789/Config/us-east-1/2022/2/16/166157441623_Config_us-east-1_ConfigHistory_AWS Config ResourceCompliance_20220216T004303Z_20220216T025123Z_1.json.gz
DEBUG: ++ Found new log: AWSLogs/123456789/Config/us-east-1/2022/8/22/166157441623_Config_us-east-1_ConfigHistory_AWS Config ResourceCompliance_20220216T004303Z_20220216T025123Z_1.json.gz
DEBUG: +++ DB Maintenance
root@wazuh-master:/# /var/ossec/wodles/aws/aws-s3 -b wazuh-aws-wodle-cloudtrail -t cloudtrail -s 2022-JAN-01 -p default -d2 --regions us-fake-1
DEBUG: +++ Debug mode on - Level: 2
DEBUG: +++ ERROR: Invalid region 'us-fake-1'
root@wazuh-master:/# /var/ossec/wodles/aws/aws-s3 -b wazuh-aws-wodle-cloudtrail -t cloudtrail -s 2022-JAN-01 -p default -d2 --regions us-east-1
DEBUG: +++ Debug mode on - Level: 2
DEBUG: No retries configuration found in profile config. Generating default configuration for retries: mode: standard - max_attempts: 10
DEBUG: Created Config object using profile: 'default' configuration
DEBUG: +++ Table does not exist; create
DEBUG: +++ Working on 123456789 - us-east-1
DEBUG: +++ Marker: AWSLogs/123456789/CloudTrail/us-east-1/2022/01/01
DEBUG: +++ No logs to process in bucket: 123456789/us-east-1
DEBUG: +++ DB Maintenance
DEBUG: +++ Working on 123456789 - us-east-1
DEBUG: +++ Marker: AWSLogs/123456789/CloudTrail/us-east-1/2022/01/01
DEBUG: +++ No logs to process in bucket: 123456789/us-east-1
DEBUG: +++ DB Maintenance
DEBUG: +++ Working on 123456789 - us-east-1
DEBUG: +++ Marker: AWSLogs/123456789/CloudTrail/us-east-1/2022/01/01
DEBUG: +++ No logs to process in bucket: 123456789/us-east-1
DEBUG: +++ DB Maintenance |
UpdateThe implemented code was modified so that instead of generating an error and terminating, it now issues a warning stating that the provided root@wazuh-master:/# /var/ossec/wodles/aws/aws-s3 -b wazuh-aws-wodle-config -t config -s 2021-DEC-9 -p default -d2 --regions us-fake-1
DEBUG: +++ Debug mode on - Level: 2
DEBUG: +++ WARNING: Invalid region 'us-fake-1'
DEBUG: No retries configuration found in profile config. Generating default configuration for retries: mode: standard - max_attempts: 10
DEBUG: Created Config object using profile: 'default' configuration
DEBUG: +++ Table does not exist; create
DEBUG: +++ Working on 123456789 - us-fake-1
DEBUG: +++ Marker: AWSLogs/123456789/Config/us-fake-1/2021/12/9
DEBUG: +++ No logs to process in bucket: 166157441623/us-fake-1
DEBUG: +++ DB Maintenance The same tests as in the previous update were performed, and the unit_tests were run |
Description
Since #22514, the AWS integration tests are generating their resources to test the module's behavior. Each launched test involving an S3 bucket creates the bucket, populates it with the corresponding logs, and at the end deletes the resources. For the
--regions
parameter, a test case involves requesting the logs for an unexistent region (us-fake-1
) which in a normal module execution treats the parameter as a part of the log path and would return the following:Nevertheless, since the test builds up the bucket entirely and the region is not part of the available AWS regions, it fails and does not find the mentioned fake region.
The objective of the present issue is to modify the bucket's behavior to check the input
--regions
parameter and in case a nonexistent region is passed, to display a warning message that the region does not exist.Tasks
The text was updated successfully, but these errors were encountered: