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

Add script to audit account logins for past 90 days #18

Open
wants to merge 112 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
b12356e
Update SUPPORT.md
wrenhunter May 18, 2021
354f3f7
Update SUPPORT.md
wrenhunter May 18, 2021
90dd52a
Update SUPPORT.md
wrenhunter May 18, 2021
a369ddc
Update SUPPORT.md
wrenhunter May 18, 2021
816a2d2
Update README-sample.md
wrenhunter May 18, 2021
5ed7c68
Update README.md
wrenhunter May 20, 2021
e09c2b7
Delete README-sample.md
wrenhunter May 20, 2021
9a0358a
Update SUPPORT.md
wrenhunter May 20, 2021
a890756
Update CONTRIBUTING.md
wrenhunter May 20, 2021
aa5e7ee
Update CONTRIBUTING.md
wrenhunter May 20, 2021
77d1428
Delete docs directory
wrenhunter May 20, 2021
4953d97
Add Okta shim script
wrenhunter May 20, 2021
bfbec01
Update to Okta folder docs
wrenhunter May 20, 2021
87171ed
Add script for extracting SSH logs
camposer May 28, 2021
022859e
Update extract_ssh_logs.sh
camposer May 31, 2021
d15356e
Update README.md
wrenhunter Jun 2, 2021
81dc344
Adding TF script for ssh_pub
wrenhunter Jun 2, 2021
dccc774
Adding health check script
wrenhunter Jun 3, 2021
345f23d
Remove "and" operator when generating ssh session files
camposer Jun 4, 2021
1c5603e
Add okta sync multi group
camposer Jun 4, 2021
596624f
Merge branch 'main' of https://github.com/strongdm/contrib
camposer Jun 4, 2021
00ce622
Add missing okta user information
camposer Jun 4, 2021
6ffe2e4
Add create users only when assigned to a group listed in matchers.yml
camposer Jun 17, 2021
bd5907f
Update docs
camposer Jun 17, 2021
7e19db8
Merge pull request #1 from strongdm/feat/only-create-users-with-group…
camposer Jun 17, 2021
de2de8c
Add user/roles sync with multiple Identity Providers
camposer Jun 21, 2021
27bfcb8
Update README.md
camposer Jun 21, 2021
1253346
Update README.md
camposer Jun 21, 2021
e45f5a3
Update README.md
camposer Jun 21, 2021
7ce4e61
Remove stale TODO comment
camposer Jun 21, 2021
5012976
Restructure repo layout
camposer Jun 22, 2021
7289799
Merge branch 'feat/auth-multi-idp' of https://github.com/strongdm/con…
camposer Jun 22, 2021
d5255d6
Update README.md
camposer Jun 22, 2021
4b2c34d
Merge pull request #2 from strongdm/feat/auth-multi-idp
camposer Jun 22, 2021
b242c1a
Add pagination to LoadOktaUsers
camposer Jun 28, 2021
f519209
Merge branch 'main' into feat/auth-multi-idp
camposer Jun 28, 2021
7e6325b
Merge pull request #3 from strongdm/feat/auth-multi-idp
camposer Jun 28, 2021
8db8756
Adding in some Ansible examples for SDM and AWS
b1tsized Jun 28, 2021
b68ad47
Adding k8s impersonation automation script
wrenhunter Jul 6, 2021
cad3413
Add'l files for k8s impersonation
wrenhunter Jul 6, 2021
be7d343
Merge branch 'main' of https://github.com/strongdm/contrib into main
wrenhunter Jul 6, 2021
9d8f798
Update README.md
wrenhunter Jul 6, 2021
0dbe391
Add script to list role resources
wrenhunter Jul 21, 2021
6a478ec
Add README for role list script
wrenhunter Jul 21, 2021
1d2265f
Add check for beta resources when getting resources
camposer Jul 21, 2021
336e9aa
fixed case issues
wrenhunter Jul 21, 2021
429dbbd
Merge branch 'main' of https://github.com/strongdm/contrib into main
wrenhunter Jul 21, 2021
1da6077
Add logging flag
camposer Jul 29, 2021
20c0945
Add comments to matchers file
camposer Jul 29, 2021
6b4fa8f
Merge pull request #4 from b1tsized/ansible
camposer Aug 10, 2021
9827e93
Adding gateway resources script
wrenhunter Sep 15, 2021
bcc9503
Add contributed_automations
wallrony Sep 20, 2021
1bd9cbb
Updating k8s UI script to multi-role
wrenhunter Sep 20, 2021
59fb5c4
updated README links
wrenhunter Sep 20, 2021
26a8189
README update
wrenhunter Sep 20, 2021
5746eca
Change automations folder name to external
wallrony Sep 21, 2021
12c9a97
Merge branch 'strongdm:main' into main
Sep 21, 2021
6de8837
Merge branch 'main' of https://github.com/wronyq/contrib into main
wallrony Sep 21, 2021
58264e2
Merge pull request #5 from wronyq/main
camposer Sep 21, 2021
5b5dacd
Better error handling for k8s MR script
wrenhunter Sep 21, 2021
202dca0
Merge branch 'main' of https://github.com/strongdm/contrib into main
wrenhunter Sep 21, 2021
51dba18
Add John’s contrib instructions
wallrony Sep 21, 2021
d95b58b
Merge branch 'strongdm:main' into main
Sep 21, 2021
313fec2
Add Jira Webhook PoC
camposer Sep 22, 2021
6dc6cc2
Change John's contrib folder to export-s3 and remove strongDM docs re…
wallrony Sep 22, 2021
0dfb805
Merge branch 'main' of https://github.com/wronyq/contrib into main
wallrony Sep 22, 2021
436cbc6
Merge pull request #7 from strongdm/feat/add-jira-weebhook-poc
magnua Sep 22, 2021
76d6080
Remove export log from external readme
wallrony Sep 22, 2021
e6bb6fa
Changed folder name to lifecycle-s3
wallrony Sep 22, 2021
1b174de
Merge pull request #6 from wronyq/main
camposer Sep 22, 2021
53256a1
Adding new audit users script
wrenhunter Sep 24, 2021
815c9ce
Update README.md
wrenhunter Sep 24, 2021
5668205
Update README.md
wrenhunter Sep 24, 2021
0313086
Update README.md
wrenhunter Sep 24, 2021
d011990
Update README.md
wrenhunter Sep 29, 2021
315b648
Update README.md
camposer Oct 15, 2021
01bf6f0
Updating to adding sg, update instance, ami, and more .gitignore files
turner-strongdm Oct 21, 2021
84e8280
Merge pull request #9 from strongdm/ssh-tf
wrenhunter Oct 25, 2021
d144a51
Update README.md
wrenhunter Dec 2, 2021
f598691
Added Shane webinar files
wrenhunter Jan 4, 2022
869af51
Changed folder name to include date
wrenhunter Jan 4, 2022
f3961a3
Add PagerDuty webinar files
wrenhunter Jan 5, 2022
eeaab17
Updated PD/webinar readme
wrenhunter Jan 5, 2022
59ce37d
Uploading 21-12-15 terraform webinar
turner-strongdm Jan 5, 2022
b81a5c0
Editing 21-12-15 terraform webinar
turner-strongdm Jan 5, 2022
f7b4d94
Bad dates
wrenhunter Jan 5, 2022
7855bf4
Merge branch 'main' of https://github.com/strongdm/contrib into main
wrenhunter Jan 5, 2022
6854479
Editing 21-12-15 terraform webinar by removing other TF artifacts
turner-strongdm Jan 5, 2022
3c7926f
Merge branch 'main' of github.com:strongdm/contrib
turner-strongdm Jan 5, 2022
454f3fe
Editing 21-12-15 terraform webinar by removing other TF artifacts
turner-strongdm Jan 5, 2022
4512734
sdm_health_exporter.py - v0.0.1
cigoldstein Feb 18, 2022
d105508
sdm_health_check.py - PR changes
cigoldstein Feb 23, 2022
4839040
Merge pull request #10 from cigoldstein/sdm_health_exporter
camposer Feb 24, 2022
94ae074
Added a permission for running role_resources.py
steevebisson Mar 13, 2022
5e38c5c
Merge pull request #11 from steevebisson/adding-permission-role-resou…
camposer Mar 14, 2022
85eac23
Create Jira Webhook Docker image and update docs
felipesantoos Mar 16, 2022
aa8b694
Adding AWS ASG scripts
wrenhunter Mar 18, 2022
ed0488c
Merge pull request #12 from strongdm/feat/jira-docker-image
camposer Mar 21, 2022
95552ce
Adding comp_users script
wrenhunter Mar 24, 2022
8857e5c
Add sdm-ext cli files
felipesantoos Mar 30, 2022
ade4c65
Update README.Md
felipesantoos Mar 30, 2022
ca55a42
Update README.Md
felipesantoos Mar 30, 2022
2b4ba79
Fix tests, remove .env file and update doc s
felipesantoos Mar 31, 2022
1e23507
Remove monkey-patching
felipesantoos Apr 7, 2022
cae9c13
Update mock strategy
felipesantoos Apr 8, 2022
c6fcd52
Merge pull request #13 from strongdm/feat/sdm-ext-cli
camposer Apr 11, 2022
ee06b36
Audit: temp change
wrenhunter Apr 28, 2022
775acc6
Audit: script updates for role-grant deprecation
wrenhunter Apr 28, 2022
a62d6d9
Merge pull request #15 from strongdm/audit-role-grant
turner-strongdm Apr 28, 2022
7a3f67e
Add jira webhook demo video
gaabrieljesuss May 11, 2022
84729f2
Doing a fix for the ansible playbook
turner-strongdm May 11, 2022
bd0f0a3
Add script to audit account logins for past 90 days
Aug 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
terraform/resources/.DS_Store
terraform/.DS_Store
.DS_Store

terraform/resources/ssh/*.tfvars
terraform/resources/ssh/*.tfstate
terraform/resources/ssh/*.tfstate.backup
terraform/resources/ssh/*.tfstate.lock.info
terraform/resources/ssh/.terraform/
terraform/resources/ssh/.vagrant/
terraform/resources/ssh/.sentinel

*.tfstate
*.tfstate.backup
*.tfstate.lock.info

*.log

.terraform/
.vagrant/

*.pem

*.bak

*gitignore*.tf

.DS_Store

.vscode/

operations/automation-script/apply.json
operations/automation-script/configversion.json
operations/automation-script/run.template.json
operations/automation-script/run.json
operations/automation-script/variable.template.json
operations/automation-script/variable.json
operations/automation-script/workspace.template.json
operations/automation-script/workspace.json
operations/sentinel-policies-scripts/create-policy.template.json
operations/sentinel-policies-scripts/create-policy.json
operations/variable-scripts/variable.template.json
operations/variable-scripts/variable.json


.sentinel


.sass-cache/
.jekyll-metadata
*.DS_Store
package.json
.vscode/settings.json
*tfstate*
audit.csv
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to the project
# Contributing to strongDM Contrib

Thanks for considering contributing to our project!
Thanks for considering contributing to our project! We welcome contributions from customers, enthusiasts, or anyone interested in strongDM!

You can contribute in any of the following ways:
* Submitting bugs or feature requests
Expand All @@ -25,7 +25,7 @@ In case you want to contribute with code (fixes, new functionalities) or documen
6. Push changes to your fork
7. Open a PR in our repository and follow the PR template so that we can efficiently review the changes.

Please consider the following rules when creating your PR (adapted from the [Auth0 Contributing Guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)):
Please consider the following rules when creating your PR:
* Only fix/add the functionality in question OR address wide-spread whitespace/style issues, not both.
* Add unit or integration tests for fixed or changed functionality (if a test suite already exists).
* Address a single concern in the least number of changed lines as possible.
Expand Down
22 changes: 0 additions & 22 deletions README-sample.md

This file was deleted.

28 changes: 10 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
# Garden Template
The Garden Template contains sample files you could use for creating new [Code Garden](https://github.com/strongdm/garden) Repositories. It includes templates for:
* [README](README-sample.md)
* [License](LICENSE)
* [Contributing](CONTRIBUTING.md)
* [Support](SUPPORT.md)
* Report [bug](.github/ISSUE_TEMPLATE/bug_report.md) or [feature requests](.github/ISSUE_TEMPLATE/feature_request.md)
* [Pull Request](.github/PULL_REQUEST_TEMPLATE/pull_request_template.md)
* [Documentation](docs)
# strongDM Contrib

In order to use this repository, you could:
* Use it as a Template - Green button at the top of the repo
* Clone it and manually adjust it - Useful if you want to start a fresh project history
This repository provides sample code created by strongDM staff, customers, and others. This code may include shell scripts to use with the strongDM CLI, code snippets written for strongDM SDK's, Terraform templates, etc. Generally, this repo is organized by the task you are trying to accomplish (i.e. `authentication` for items related to SSO). So feel free to look around, we hope you find something helpful!

After cloning the repo, remember to:
1. Remove this README file
2. Rename the file README-sample.md to README.md and adjust the content
3. Adjust the Contributing and Support guidelines
4. Adjust the templates for bugs and feature requests under the .github folder
## Table of Contents
* [Contributing](#contributing)
* [Support](#support)

A template repo that can be used as a reference: [Auth0 Open Source Template](https://github.com/auth0/open-source-template)
## Contributing
We welcome contributions from customers, enthusiasts, or anyone interested in strongDM! Please refer to the [contributing](CONTRIBUTING.md) page.

## Support
Code and scripts here are provided AS-IS and may or may not be updated in the future at our discretion. You should review and test any code thoroughly before deploying to production. For details on getting help, please see the [support](SUPPORT.md) guidelines.
9 changes: 3 additions & 6 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Garden Support
# strongDM Contrib Support

Here's a list of options you could try:
Code and scripts here are provided AS-IS and may or may not be updated in the future at our discretion. You should review and test any code thoroughly before deploying to production.

* [Documentation](docs)
* [Discussions](../../discussions)

On Discussions you could receive support from community members willing to point you in the right direction.
If you do run into bugs or issues with these scripts, please start by searching [Issues](../../issues) or [Discussions](../../discussions). You can start a new discussion to get help from the community, or file a new ticket under Issues as needed. We also encourage you to respond to discussions or issues, and submit pull requests for new code or fixes.
55 changes: 55 additions & 0 deletions ansible/aws_playbooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Self register AWS Ansible Playbooks

## AWS SDM Gateway

Within the playbook there is a vars section you'll need to update within the AWS task and down in the scripts task. Some of the information you'll need to pull from AWS. You can find all EC2 vars examples [here](https://docs.ansible.com/ansible/latest/collections/amazon/aws/ec2_module.html)

- [Self Registering SDM AWS Gateway Playbook](aws_self_register_playbooks/aws-self-register-gateway.yml)

Inside the script you'll need to add your SDM Admin Token.

- [Ansible SDM Gateway Self Register Script](aws_self_register_playbooks/scripts/sdm-gatewayadd.sh)

## AWS SSH Server

Within the playbook there is a vars section you'll need to update within the AWS task and down in the scripts task. Some of the information you'll need to pull from AWS. You can find all EC2 vars examples [here](https://docs.ansible.com/ansible/latest/collections/amazon/aws/ec2_module.html)

- [Self Registering SDM SSH Resource Playbook](aws_self_register_playbooks/aws-self-register-ssh.yml)

Inside the script you'll need to add your SDM Admin Token.

- [Ansible SDM SSH Self Register Script](aws_self_register_playbooks/scripts/sdm-sshadd.sh)

# Single Ansible Playbooks

## SDM Gateway Install

This playbook will run on any host within the inventory file. I've built a full playbook without the need of a script. To target a specific group changes the `hosts:` parameter. It will auto register any AWS machine with a public address.

- [Self Registering SDM Gateway Playbook](playbooks/sdm_gateway_install.yml)

_Example: `ansible-playbook sdm_gateway_install.yml -i sdm-gateways --extra-vars 'SDM_ADMIN_TOKEN={{string for sdm token}}'`_

## SDM Relay Install

This playbook will run on any host within the inventory file. To target a specific group changes the `hosts:` parameter.

- [Self Registering SDM Relay Playbook](playbooks/sdm_relay_install.yml)

_Example: `ansible-playbook sdm_relay_install.yml -i sdm-relays --extra-vars 'SDM_ADMIN_TOKEN={{string for sdm token}}'`_

## SDM SSH Public Cert Install

This playbook will run on any host within the inventory file. To target a specific group changes the `hosts:` parameter. You'll need to pass `SDM_PUB_CA` using `--extra-vars` to append in the public CA.

_Example: `ansible-playbook sdm_pub_cert_ssh_install.yml -i ssh-servers --extra-vars 'SDM_ADMIN_TOKEN={{string for sdm token}} SDM_PUB_CA={{string for sdm ca}}'`_

- [Self Registering SDM Public SSH Cert Playbook](playbooks/sdm_pub_cert_ssh_install.yml)

## SDM SSH Install

This playbook will run on any host within the inventory file. To target a specific group changes the `hosts:` parameter.

- [Self Registering SDM SSH Playbook](playbooks/sdm_ssh_install.yml)

_Example: `ansible-playbook sdm_ssh_install.yml -i ssh-servers --extra-vars 'SDM_ADMIN_TOKEN={{string for sdm token}}'`_
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# Basic provisioning example
- name: Ansible AWS Variables
vars:
aws_region:
aws_key_pair:
aws_instance_type:
aws_image_id:
aws_subnet_id:
aws_sec_group_name:
instance_name:
user_name:
hosts: localhost
tasks:
- name: launching AWS instance using Ansible
ec2:
#Set AWS Region
region: "{{ aws_region }}"
#Set key pair in AWS
key_name: "{{ aws_key_pair }}"
#Set instance size
instance_type: "{{ aws_instance_type }}"
#Update AWS Image ID (Region specific)
image: "{{ aws_image_id }}"
wait: yes
count: 1
#Enter VPC Subnet ID
vpc_subnet_id: "{{ aws_subnet_id }}"
assign_public_ip: yes
#Enter AWS Security Group Name
group: "{{ aws_sec_group_name }}"
#Add Tags as needed
instance_tags:
Name: "{{ instance_name }}"
Creator: Ansible
register: ec2_sdm
- name: Add new instance to SDM's host group
add_host:
hostname: "{{ item.public_ip }}"
groupname: ec2sdm
with_items: "{{ ec2_sdm.instances }}"
- name: Let's wait for SSH to come up. Usually that takes ~10 seconds
local_action: wait_for
host={{ item.public_ip }}
port=22
state=started
with_items: '{{ ec2_sdm.instances }}'
#Self Registered Example
- hosts: ec2sdm
name: configuration play
user: ubuntu
become: yes
gather_facts: true
tasks:
#Update Path to script
- script: scripts/sdm-gatewayadd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
# Basic provisioning example
- name: Ansible test
vars:
aws_region:
aws_key_pair:
aws_instance_type:
aws_image_id:
aws_subnet_id:
aws_sec_group_name:
instance_name:
instance_count:
hosts: localhost
tasks:
- name: launching AWS instance using Ansible
ec2:
#Set AWS Region
region: '{{ aws_region }}'
#Set key pair in AWS
key_name: '{{ aws_key_pair }}'
#Set instance size
instance_type: '{{ aws_instance_type }}'
#Update AWS Image ID (Region specific)
image: '{{ aws_image_id }}'
wait: yes
count: '{{ instance_count }}'
#Enter VPC Subnet ID
vpc_subnet_id: '{{ aws_subnet_id }}'
assign_public_ip: yes
#Enter AWS Security Group Name
group: '{{ aws_sec_group_name }}'
#Add Tags as needed
instance_tags:
Name: '{{ instance_name }}'
Creator: Ansible
register: ec2_sdm
- name: Add new instance to SDM's host group
add_host:
hostname: '{{ item.public_ip }}'
groupname: launched-ec2-sdm
with_items: '{{ ec2_sdm.instances }}'
- name: Let's wait for SSH to come up. Usually that takes ~10 seconds
local_action: wait_for
host={{ item.public_ip }}
port=22
state=started
with_items: '{{ ec2_sdm.instances }}'
#Self Registered Example
- hosts: launched-ec2-sdm
vars:
username:
name: configuration play
user: '{{ username }}'
become: yes
gather_facts: true
tasks:
#Update Path to script
- script: scripts/sdm-sshadd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
apt update && apt upgrade -y
apt install zip curl wget -y
curl -J -O -L https://app.strongdm.com/releases/cli/linux
unzip *.zip
export SDM_ADMIN_TOKEN={{ SDM_ADMIN_TOKEN }}
export INSTANCE_HOSTNAME=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
export SDM_RELAY_TOKEN=`./sdm relay create-gateway $INSTANCE_HOSTNAME:5000 0.0.0.0:5000`
unset SDM_ADMIN_TOKEN
./sdm install --relay --token=$SDM_RELAY_TOKEN
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
export SDM_ADMIN_TOKEN= {{ SDM_ADMIN_TOKEN }}
apt update
apt install -y unzip
curl -o sdm.zip -L https://app.strongdm.com/releases/cli/linux
unzip sdm.zip
./sdm admin ssh add \
-p `curl http://169.254.169.254/latest/meta-data/instance-id` \
$USERNAME@`curl http://169.254.169.254/latest/meta-data/public-hostname` \
| tee -a "/home/$USERNAME/.ssh/authorized_keys"
./sdm admin roles grant `curl http://169.254.169.254/latest/meta-data/instance-id` {{ SDM_Role }}
rm sdm.zip
Loading