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

[Emulation Tuning] Adjusts Add Admin Roles to User(s) emulation #72

Merged
merged 5 commits into from
Aug 31, 2023

Conversation

terrancedejesus
Copy link
Collaborator

@terrancedejesus terrancedejesus commented Aug 28, 2023

Overview

This pull request adjusts the emulation Add Admin Roles to User(s). Previously, this emulation served as a hello world for examples of running emulations. This emulation is now fully operational.

Emulation workflow

  1. create a user in google workspace
  2. dynamically generate a 12 character password for user
  3. get a list of pre-built administrator roles from Google Workspace
  4. for every admin role, assign it to the new user
  5. delete the created user
Screenshot 2023-08-28 at 1 20 10 PM

Additional Information

  • updated base_emulation.py to set self.domain from the etc/config.yaml value. This is important when dealing with the admin SDK API regarding users, groups, role's etc. If the user has not set this domain, emulations will not run as assumptions are made in emulations when dealing with users.
  • this emulation requires a config admin_add_admin_roles_to_users.yaml which includes all the information for the user being added
  • priority wise, the emulation sets user information based on arguments -> config -> default (dynamic)
  • if an existing user exists, then roles are added to this user
  • cleanup is optional but included
  • required ['admin.directory.user', 'admin.directory.rolemanagement', 'admin.directory.user.security'] roles to operate therefore the default session referenced needs to accept this. These scopes were added to the config.yaml for SWAT to be globally set within the application since this is an OOTB emulation
  • while doing this emulation, I noticed that the emulations should include descriptions and references if applicable. This will be good for users who may want to read Google Workspace documentation, 3rd-party blogs, or understand what the emulation is attempting to accomplish

@Mikaayenson
Copy link
Collaborator

Are you generating an alert or some event data to validate that the emulation works as expected, or do you have a screenshot to show that the automation works?

@terrancedejesus
Copy link
Collaborator Author

terrancedejesus commented Aug 29, 2023

Are you generating an alert or some event data to validate that the emulation works as expected, or do you have a screenshot to show that the automation works?

@Mikaayenson For sure. The audit command allows us to pull logs from Google Workspace and output to console in a tabular format.
Command: audit admin 24h --export --export-format=csv
Results: admin_24h.csv

Command: audit admin 24h --interactive
Results: Below
Screenshot 2023-08-29 at 10 00 25 AM

  • In the screenshot above, you will see a user swat-user@dejesusarcheology.com created, followed by admin roles being assigned before the cleanup method removes the user, which is the USER_LICENSE_REVOKE event name. Happy to do a demo as well to make sure we thoroughly review.

Also, SWAT has a global and emulation specific logger for both console and file, so here is the log file for this emulation. Starting at line 135 reflects the existing code changes for this pull request. Before this are logs captured during dev and troubleshooting.

persistence_admin_add_admin_roles_to_users.log - User has been deleted.

@terrancedejesus terrancedejesus merged commit 80f5c8c into main Aug 31, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants