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

CLOUDP-136708: AtlasCLI: Support Get/Update Audit configs for projects #3036

Merged
merged 25 commits into from
Jun 20, 2024

Conversation

andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Jun 18, 2024

Proposed changes

Jira ticket: CLOUDP-136708

@andreaangiolillo
Copy link
Collaborator Author

andreaangiolillo commented Jun 18, 2024

./bin/atlas auditing update --help                                                     
To use this command, you must authenticate with a user account or an API key with the Project Owner role.

Usage:
  atlas auditing update [flags]

Examples:
  # Audit all authentication events for known users:
  atlas auditing update --auditFilter "{"atype": "authenticate"}"

  # Audit all authentication events for known user via a configuration file:
  atlas auditing update -f filter.json


Flags:
      --auditAuthorizationSuccess   Flag that indicates whether someone set auditing to track successful authentications. This only applies to the "atype" : "authCheck" audit filter. Setting this parameter to true degrades cluster performance.
      --auditFilter string          JSON document that specifies which events to record. Escape any characters that may prevent parsing, such as single or double quotes, using a backslash (\).
      --enabled                     Flag that indicates whether someone enabled database auditing for the specified project.
  -f, --file string                 Path to an optional JSON configuration file that defines auditing filters. To learn more about auditing configuration files for the Atlas CLI, see https://www.mongodb.com/docs/atlas/database-auditing/#example-auditing-filters
  -h, --help                        help for update
  -o, --output string               Output format. Valid values are json, json-path, go-template, or go-template-file. To see the full output, use the -o json option.
      --projectId string            Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.

Global Flags:
  -P, --profile string   Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.
./bin/atlas auditing update --auditFilter "{"atype": "authenticate"}" --enabled -o json  
{
  "auditAuthorizationSuccess": false,
  "auditFilter": "{atype: authenticate}",
  "configurationType": "FILTER_JSON",
  "enabled": true
}
./bin/atlas auditing update -f test.json --enabled --auditAuthorizationSuccess  
Auditing configuration successfully updated.
cat test.json                                                            
{
  "atype": "authCheck",
  "param.command": {
    "$in": [
      "insert",
      "update",
      "delete"
    ]
  }
}

./bin/atlas auditing update -f test.json --enabled --auditAuthorizationSuccess -o json 
{
  "auditAuthorizationSuccess": true,
  "auditFilter": "{\n  \"atype\": \"authCheck\",\n  \"param.command\": {\n    \"$in\": [\n      \"insert\",\n      \"update\",\n      \"delete\"\n    ]\n  }\n}",
  "configurationType": "FILTER_JSON",
  "enabled": true
}

@andreaangiolillo andreaangiolillo marked this pull request as ready for review June 18, 2024 14:18
@andreaangiolillo andreaangiolillo requested a review from a team as a code owner June 18, 2024 14:18
@andreaangiolillo andreaangiolillo requested a review from a team June 18, 2024 14:18
@github-actions github-actions bot added the need-doc-review Improvements or additions to documentation, will be reviewed by the docs team label Jun 18, 2024
Copy link
Contributor

APIx Bot :bowtie:: a message has been sent to Docs Slack channel 🚀.

erabil-mdb
erabil-mdb previously approved these changes Jun 18, 2024
Copy link
Contributor

@erabil-mdb erabil-mdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@andreaangiolillo andreaangiolillo merged commit adb62fa into master Jun 20, 2024
17 of 19 checks passed
@andreaangiolillo andreaangiolillo deleted the CLOUDP-136708 branch June 20, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-doc-review Improvements or additions to documentation, will be reviewed by the docs team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants