Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gcloud_hosts

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcloud_hosts

  • 0.1.5
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

gcloud_hosts

Update your hosts file based on gcloud compute instances.

This is handy when used in conjunction with something like sshuttle, allowing you to have a "poor man's vpn".

Installation

$ gem install gcloud_hosts

Requirements

Requires gcloud tool installed and authenticated against at least 1 GCP project.

Usage

$ gcloud_hosts -h
Usage: $ gcloud_hosts [options]
    -g, --gcloud GCLOUD              Path to gcloud executable. Defaults to PATH location
    -p, --project PROJECT            gcloud project to use. Defaults to default gcloud configuration.
    -n, --network NETWORK            gcloud network to filter on. Defaults nil.
    -d, --domain DOMAIN              Domain to append to all hosts. Default: "c.[PROJECT].internal"
        --public PUBLIC              Pattern to match for public/bastion hosts. Use public IP for these. Defaults to nil
        --[no-]exclude-public        Exclude public hosts from list when updating hosts file. Allows them to be managed manually. Defaults to false
    -f, --file FILE                  Hosts file to update. Defaults to /etc/hosts
    -b, --backup BACKUP              Path to backup original hosts file to. Defaults to FILE with '.bak' extension appended.
        --[no-]dry-run               Dry run, do not modify hosts file. Defaults to false
        --[no-]delete                Delete the project from hosts file. Defaults to false
        --[no-]clear                 Clear all gcloud host entries from hosts file. Defaults to false
        --help                       Show this message
        --version                    Show version

Example

Update your hosts file using gcloud_hosts:

$ sudo gcloud_hosts -p my-cool-project --public bastion

Start sshuttle session:

$ sshuttle --remote=bastion01 --daemon --pidfile=/tmp/sshuttle.pid 192.168.1.0/24

Now your hosts file will contain entries for all compute instances in the project, and you can ssh directly to them from your local machine.

Hosts matching the pattern passed in with the --public flag will have their public IP address added to your host file instead of the their private internal IP address.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/atongen/gcloud_hosts.

FAQs

Package last updated on 28 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc