Giter Site home page Giter Site logo

cisagov / guacscanner Goto Github PK

View Code? Open in Web Editor NEW
2.0 7.0 3.0 769 KB

Scan for EC2 instances added (removed) from a VPC and create (destroy) the corresponding Guacamole connections.

License: Creative Commons Zero v1.0 Universal

Shell 10.53% Python 89.47%
hacktoberfest

guacscanner's Introduction

guacscanner

GitHub Build Status CodeQL Coverage Status Known Vulnerabilities

This project is a Python utility that continually scans the EC2 instances in an AWS VPC and adds/removes Guacamole connections in the underlying PostgreSQL database accordingly.

This utility is Dockerized in cisagov/guacscanner-docker, and the resulting Docker container is intended to run as a part of cisagov/guacamole-composition, although it could - probably uselessly - run in a Docker composition alongside only the official PostgreSQL Docker image.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

License

This project is in the worldwide public domain.

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

guacscanner's People

Contributors

dav3r avatar dependabot[bot] avatar felddy avatar hillaryj avatar jasonodoom avatar jmorrowomni avatar jsf9k avatar mcdonnnj avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

guacscanner's Issues

Remove setup duplication in tests

๐Ÿ’ก Summary

@mcdonnnj pointed out that there is some duplication among the tests, specifically with the addition of a VPC, subnets, etc. to the mock EC2 service. We should create a test fixture and avoid this duplication.

Motivation and context

DRY code is better code, even if it's test code.

Improve creation of Guacamole user(s)

๐Ÿ’ก Summary

Figure out a way to make the creation of the Guacamole user cleaner and more flexible. We don't want to hard code the Guacamole user name, and we want to allow users to specify a list of Guacamole users that should be created if they don't exist and given access to use the connections created by guacscanner.

Motivation and context

We should allow the flexibility to use this utility in a myriad of ways, not just in ways that match our use case.

Implementation notes

It might make sense to allow for an AMI name regex to be associated with each Guacamole user. If an instance's AMI's name matches the regex then the user will be allowed to use the connection.

Simplify construction of DB queries

๐Ÿ’ก Summary

Determine if we can use f-strings instead of .format() for the PostgreSQL query variables. Also define the sql.Identifier() variables outside of the query constructions so that they can be reused where that is possible.

Motivation and context

Simplify, simplify.

Improve exception handling

๐Ÿ’ก Summary

Improve exception handling for all the database accesses and wherever else it is appropriate.

Motivation and context

guacscanner currently just bombs out if an exception is thrown, and it shouldn't throw any exceptions for our use case, but it would probably make more sense to print an error message and keep looping, keepin' the train a-chooglin'.

Add type hints to the project

๐Ÿ’ก Summary

The code for this project should include type hints.

Motivation and context

Type hints are very useful for static analysis of Python code and we try to include them in our Python projects.

Break up the contents of the `guacscanner` package

๐Ÿ’ก Summary

The functionality of the guacscanner package is almost entirely in the guacscanner module. We should break up the functionality into separate modules to at minimum separate the command-line interface from the core functionality of the package.

Motivation and context

Breaking up the functionality will make this package more directly usable by other software as well as improve maintainability by separating functionally distinct elements.

Implementation notes

I suggested separating command-line functionality, but there may be other elements that would benefit from being "broken up".

Acceptance criteria

  • MVP is CLI functionality is broken out into its own module.

Loosen up pinned versions in setup.py

๐Ÿ’ก Summary

Instead of pinning the pip package versions to tightly in setup.py, we should instead pin them loosely there and let pipenv or similar in the deploying environment do the heavy lifting.

Motivation and context

@mcdonnnj mentioned this improvement here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.