http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html https://www.youtube.com/watch?v=_wiGpBQGCjU
Pull bucket names and check for public access
| #!/usr/local/bin/python3 | |
| ###################################################################################################################### | |
| # Purpose: Generate rules report of all the security groups # | |
| # Input Params: None [Make sure to set AWS CLI session by populating env. vars. with keys.] # | |
| # Usage: ./ec2_sg_rules.py > account-date.csv [python ./ec2_sg_rules.py > gill-dev-sg-2018-04-11.csv] # | |
| # Author: Abdul Gill # | |
| # Doc. Ref: http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.describe_security_groups# | |
| ###################################################################################################################### | |
| from __future__ import print_function |
| #!/usr/bin/env python | |
| import boto3 | |
| ### ### | |
| # Need aws credentails already been configured # | |
| ### ### | |
| ### Code based on https://gist.github.com/miketheman/2630437 | |
| client = boto3.client('ec2') |
http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html https://www.youtube.com/watch?v=_wiGpBQGCjU
Pull bucket names and check for public access
| #!/usr/bin/env python3 | |
| import boto3 | |
| import argparse | |
| class StaleSGDetector(object): | |
| """ | |
| Class to hold the logic for detecting AWS security groups that are stale. | |
| """ | |
| def __init__(self): | |
| super(StaleSGDetector, self).__init__() |
| import boto3 | |
| import logging | |
| #setup simple logging for INFO | |
| logger = logging.getLogger() | |
| logger.setLevel(logging.INFO) | |
| #define the connection | |
| ec2 = boto3.resource('ec2') |
| #!/bin/bash | |
| # Sometimes you need to move your existing git repository | |
| # to a new remote repository (/new remote origin). | |
| # Here are a simple and quick steps that does exactly this. | |
| # | |
| # Let's assume we call "old repo" the repository you wish | |
| # to move, and "new repo" the one you wish to move to. | |
| # | |
| ### Step 0. List Remotes | |
| git remote -v |
| import org.apache.catalina.LifecycleListener; | |
| import org.apache.catalina.core.AprLifecycleListener; | |
| import org.springframework.beans.factory.annotation.Value; | |
| import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; | |
| import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| /** | |
| * NOTE: You also need to install APR on your system, on Arch Linux the package is called `tomcat-native`. |
| s3cmd ls --recursive s3://BUCKET_NAME | ruby -rdate -ne 'date, time, size, uri = $_.split; puts uri if size == "0"' | xargs s3cmd del |
| # Start the old vagrant | |
| $ vagrant init centos-6.3 | |
| $ vagrant up | |
| # You should see a message like: | |
| # [default] The guest additions on this VM do not match the install version of | |
| # VirtualBox! This may cause things such as forwarded ports, shared | |
| # folders, and more to not work properly. If any of those things fail on | |
| # this machine, please update the guest additions and repackage the | |
| # box. |
| --- | |
| # ^^^ YAML documents must begin with the document separator "---" | |
| # | |
| #### Example docblock, I like to put a descriptive comment at the top of my | |
| #### playbooks. | |
| # | |
| # Overview: Playbook to bootstrap a new host for configuration management. | |
| # Applies to: production | |
| # Description: | |
| # Ensures that a host is configured for management with Ansible. |