Skip to content
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

Can't limit resource of rds:DescribePendingMaintenanceActions IAM permission #96

Open
vmercierfr opened this issue Dec 20, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@vmercierfr
Copy link
Collaborator

Describe the bug

Prometheus RDS exporter rds:DescribePendingMaintenanceActions IAM permission can't be restricted to specific RDS instances

Desktop (please complete the following information):

  • OS: Linux
  • Prometheus RDS exporter's version: 0.5.1
  • RDS engine: All

To Reproduce

  1. Limit IAM permissions for rds:DescribePendingMaintenanceActions action to specific RDS instances or wildcard

    {
    	"Version": "2012-10-17",
    	"Statement": [
    		{
    			"Sid": "AllowMaintenanceDescriptions",
    			"Effect": "Allow",
    			"Action": "rds:DescribePendingMaintenanceActions",
    			"Resource": [
    				"arn:aws:rds:*:*:cluster:*",
    				"arn:aws:rds:*:*:db:*"
    			]
    		}
    	]
    }
  2. Scrape exporter metrics

    {"time":"2023-12-20T16:44:13.316531086Z","level":"ERROR","msg":"can't scrape metrics: can't fetch RDS metrics: can't get RDS maintenances: can't describe pending maintenance actions: operation error RDS: DescribePendingMaintenanceActions, https response error StatusCode: 403, RequestID: truncated, api error AccessDenied: User: arn:aws:sts::truncated:assumed-role/service.prometheus-rds-exporter/1703090605975336014 is not authorized to perform: rds:DescribePendingMaintenanceActions because no identity-based policy allows the rds:DescribePendingMaintenanceActions action"}

Expected behavior

The exporter should not return any error when all RDS instances/clusters are allowed

Additional context

No parameters specified in DescribePendingMaintenanceActions input parameters (see code)

inputMaintenance := &aws_rds.DescribePendingMaintenanceActionsInput{}
maintenances, err := r.client.DescribePendingMaintenanceActions(context.TODO(), inputMaintenance)

Second bug: Maintenance should be incorrect in environments with more than 100 RDS instances since DescribePendingMaintenanceActions is limited to 100 instances, and we are not using the pagination.

@vmercierfr vmercierfr added the bug Something isn't working label Dec 20, 2023
@vmercierfr vmercierfr self-assigned this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant