Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
LuciferInLove committed Oct 16, 2021
0 parents commit 031ca60
Show file tree
Hide file tree
Showing 12 changed files with 785 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{*.go,go.mod,go.sum}]
indent_size = 4

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go.mod -diff
go.sum -diff
.editorconfig -diff
.gitattributes -diff
.gitignore -diff
28 changes: 28 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
22 changes: 22 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
builds:
- binary: dynamic-sshmenu-azure
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64

archives:
- name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}"
format: tar.gz
format_overrides:
- goos: windows
format: zip
replacements:
amd64: x86_64
darwin: macOS
files:
- none*
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.1] - 2021-10-17

- Initial release

[unreleased]: https://github.com/LuciferInLove/dynamic-sshmenu-azure/compare/v0.0.1...HEAD
[0.0.1]: https://github.com/LuciferInLove/dynamic-sshmenu-azure/releases/tag/v0.0.1
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 LuciferInLove

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/LuciferInLove/dynamic-sshmenu-azure)](https://goreportcard.com/report/github.com/LuciferInLove/dynamic-sshmenu-azure)
[![License](https://img.shields.io/badge/license-MIT-red.svg)](./LICENSE.md)
![Build status](https://github.com/LuciferInLove/dynamic-sshmenu-azure/workflows/Build/badge.svg)

# dynamic-sshmenu-azure

Dynamically creates a menu containing a list of Microsoft Azure™ Virtual Machines selected using tags.

![dynamic-sshmenu-azure](https://user-images.githubusercontent.com/34190954/137604261-5074223c-4948-4333-b787-a1d00e72d2c9.gif)

## Overview

**dynamic-sshmenu-azure** generates sshmenu-style lists to connect to Azure™ virtual machines. It searches virtual machines by tags that you can define as arguments. **dynamic-sshmenu-azure** executes `ssh __ip_address__` after choosing a menu item.

## Preparations for using

First of all, you should setup authentication to interact with Azure™:
* [authentication methods](https://docs.microsoft.com/en-us/azure/developer/go/azure-sdk-authorization)

If you are using bastion server, you can set it as proxy in ssh config as follows:

```
Host 172.31.*.*
ProxyCommand ssh -W %h:%p 203.0.113.25
ForwardAgent=yes
```

`172.31.*.*` - your virtual machines private addresses range, `203.0.113.25` - bastion server public ip.

[Use ssh agent forwarding](https://developer.github.com/v3/guides/using-ssh-agent-forwarding/) to prevent keeping your private ssh keys on bastion servers.

## Usage

You can see the **dynamic-sshmenu-azure** help by running it with `-h` argument.

### Command Line Options

--tags value, -t value instance tags in "key1:value1;key2:value2" format. If undefined, full list will be shown
--resource-group value, -g value azure resource group name. If undefined, resource groups list will be shown. Environment variables: [$AZURE_DEFAULTS_GROUP, $AZURE_BASE_GROUP_NAME]
--location value, -l value azure resource groups location (region). If undefined, full resource groups list will be shown. Environment variables: [$AZURE_DEFAULTS_LOCATION]
--public-ip, -p use public ip instead of private. If vm doesn't have public ip, it will be skipped from the list (default: false)
--help, -h show help (default: false)
--version, -v print the version (default: false)

## Windows limitations

The application doesn't work in [mingw](http://www.mingw.org/) or similar terminals. You can use default cmd.exe, [windows terminal](https://github.com/microsoft/terminal) or run linux version of **dynamic-sshmenu-azure** in [wsl](https://docs.microsoft.com/en/windows/wsl/install-win10). Windows doesn't provide ssh connections ability by default. You must have `ssh.exe` installed in any of [PATH](https://docs.microsoft.com/en-us/windows/win32/shell/user-environment-variables) directories. For example, you can install [GitBash](https://gitforwindows.org/).
Loading

0 comments on commit 031ca60

Please sign in to comment.