kanmon 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +51 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +55 -0
- data/LICENSE +21 -0
- data/README.md +29 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/kanmon +7 -0
- data/kanmon.gemspec +29 -0
- data/lib/kanmon/commands/base.rb +30 -0
- data/lib/kanmon/commands/open.rb +30 -0
- data/lib/kanmon/commands/version.rb +11 -0
- data/lib/kanmon/commands.rb +10 -0
- data/lib/kanmon/version.rb +3 -0
- data/lib/kanmon.rb +4 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a456c501f0a74223496549c37e6b9f4631d9f9e8e4d77d6c21bfbe7b13550958
|
4
|
+
data.tar.gz: 5ab3f237e4e0bfd406803c5423c92ea46ae6764cbece9ed7806cd60763b2b187
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2ce5e30cec4511001057de71a4070bc0610348f4d853f0ec0a88711811dfc70655106c38ef0f635e4db5d89a3d2e8f2fcd49d625228d75314a29bd4b7c73342b
|
7
|
+
data.tar.gz: ea9918c0df250a83109046063104f4b14634da3c43d0e8a5d330fb2c8affe53831062be83a0027234956f0acf8bedf4cb35e9d121e040b6c820ba2707f97f4ce
|
data/.gitignore
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
.rspec_status
|
24
|
+
|
25
|
+
## Specific to RubyMotion (use of CocoaPods):
|
26
|
+
#
|
27
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
28
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
29
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
30
|
+
#
|
31
|
+
# vendor/Pods/
|
32
|
+
|
33
|
+
## Documentation cache and generated files:
|
34
|
+
/.yardoc/
|
35
|
+
/_yardoc/
|
36
|
+
/doc/
|
37
|
+
/rdoc/
|
38
|
+
|
39
|
+
## Environment normalization:
|
40
|
+
/.bundle/
|
41
|
+
/vendor/bundle
|
42
|
+
/lib/bundler/man/
|
43
|
+
|
44
|
+
# for a library or gem, you might want to ignore these files since the code is
|
45
|
+
# intended to run in multiple environments; otherwise, check them in:
|
46
|
+
# Gemfile.lock
|
47
|
+
# .ruby-version
|
48
|
+
# .ruby-gemset
|
49
|
+
|
50
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
|
+
.rvmrc
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kanmon (0.1.0)
|
5
|
+
hanami-cli (>= 0.1.1)
|
6
|
+
yao (>= 0.3.8)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
concurrent-ruby (1.0.5)
|
12
|
+
diff-lcs (1.3)
|
13
|
+
faraday (0.12.2)
|
14
|
+
multipart-post (>= 1.2, < 3)
|
15
|
+
faraday_middleware (0.12.2)
|
16
|
+
faraday (>= 0.7.4, < 1.0)
|
17
|
+
hanami-cli (0.1.1)
|
18
|
+
concurrent-ruby (~> 1.0)
|
19
|
+
hanami-utils (~> 1.1)
|
20
|
+
hanami-utils (1.1.2)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
transproc (~> 1.0)
|
23
|
+
json (2.1.0)
|
24
|
+
multipart-post (2.0.0)
|
25
|
+
rake (10.5.0)
|
26
|
+
rspec (3.7.0)
|
27
|
+
rspec-core (~> 3.7.0)
|
28
|
+
rspec-expectations (~> 3.7.0)
|
29
|
+
rspec-mocks (~> 3.7.0)
|
30
|
+
rspec-core (3.7.1)
|
31
|
+
rspec-support (~> 3.7.0)
|
32
|
+
rspec-expectations (3.7.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.7.0)
|
35
|
+
rspec-mocks (3.7.0)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.7.0)
|
38
|
+
rspec-support (3.7.1)
|
39
|
+
transproc (1.0.2)
|
40
|
+
yao (0.3.8)
|
41
|
+
faraday (~> 0.12.0)
|
42
|
+
faraday_middleware
|
43
|
+
json
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
bundler (~> 1.16)
|
50
|
+
kanmon!
|
51
|
+
rake (~> 10.0)
|
52
|
+
rspec (~> 3.0)
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
1.16.1
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 buty4649
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# kanmon
|
2
|
+
OpenStackのSecurityGroupにルールを追加するツール
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
|
6
|
+
kanmon.yml に登録先のSecurity GroupのUUIDを記述します。
|
7
|
+
|
8
|
+
```yaml
|
9
|
+
$ cat kanmon.yml
|
10
|
+
security_group: 11122233-4444-5555-6666-777788889999
|
11
|
+
```
|
12
|
+
|
13
|
+
環境変数を設定します。
|
14
|
+
|
15
|
+
```
|
16
|
+
$ export OS_USERNAME=username
|
17
|
+
$ export OS_PASSWORD=password
|
18
|
+
$ export OS_TENANT_NAME=tenant
|
19
|
+
$ export OS_AUTH_URL=http://example.com/auth/v3/
|
20
|
+
$ export OS_IDENTITY_API_VERSION=3
|
21
|
+
$ export OS_USER_DOMAIN_NAME=default
|
22
|
+
$ export OS_PROJECT_DOMAIN_NAME=default
|
23
|
+
```
|
24
|
+
|
25
|
+
自分のIPをSecurity Groupに追加します。
|
26
|
+
|
27
|
+
```
|
28
|
+
$ kanmon open
|
29
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kanmon"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/kanmon
ADDED
data/kanmon.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "kanmon/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kanmon"
|
8
|
+
spec.version = Kanmon::VERSION
|
9
|
+
spec.authors = ["Yuki Koya"]
|
10
|
+
spec.email = ["buty4649@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{CLI tool of add public IP to Securoity Group on OpenStack.}
|
13
|
+
spec.description = %q{CLI tool of add public IP to Securoity Group on OpenStack.}
|
14
|
+
spec.homepage = "https://github.com/buty4649/kanmon/"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "yao", ">= 0.3.8"
|
24
|
+
spec.add_dependency "hanami-cli", ">= 0.1.1"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
|
4
|
+
module Kanmon
|
5
|
+
module Commands
|
6
|
+
class Base < Hanami::CLI::Command
|
7
|
+
|
8
|
+
def initialize(*)
|
9
|
+
Yao.configure do
|
10
|
+
auth_url ENV['OS_AUTH_URL']
|
11
|
+
tenant_name ENV['OS_TENANT_NAME']
|
12
|
+
username ENV['OS_USERNAME']
|
13
|
+
password ENV['OS_PASSWORD']
|
14
|
+
client_cert ENV['OS_CERT']
|
15
|
+
client_key ENV['OS_KEY']
|
16
|
+
region_name ENV['OS_REGION_NAME']
|
17
|
+
identity_api_version ENV['OS_IDENTITY_API_VERSION']
|
18
|
+
user_domain_name ENV['OS_USER_DOMAIN_NAME']
|
19
|
+
project_domain_name ENV['OS_PROJECT_DOMAIN_NAME']
|
20
|
+
debug ENV['YAO_DEBUG']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def myip
|
25
|
+
res = Net::HTTP.get URI.parse('https://checkip.amazonaws.com/')
|
26
|
+
res.chomp
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "yao"
|
2
|
+
require "yaml"
|
3
|
+
require "kanmon/commands/base"
|
4
|
+
|
5
|
+
module Kanmon
|
6
|
+
module Commands
|
7
|
+
class Open < Base
|
8
|
+
option :file, default: "kanmon.yml", desc: "config file path"
|
9
|
+
|
10
|
+
def call(**options)
|
11
|
+
id = YAML.load_file(options.fetch(:file))["security_group"]
|
12
|
+
ip = myip
|
13
|
+
rule = {
|
14
|
+
direction: "ingress",
|
15
|
+
port_range_min: 22,
|
16
|
+
port_range_max: 22,
|
17
|
+
ethertype: "IPv4",
|
18
|
+
protocol: "tcp",
|
19
|
+
remote_ip_prefix: "#{ip}/32",
|
20
|
+
security_group_id: id,
|
21
|
+
}
|
22
|
+
|
23
|
+
Yao::SecurityGroupRule.create(rule)
|
24
|
+
puts "Success!!"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
register "open", Open
|
29
|
+
end
|
30
|
+
end
|
data/lib/kanmon.rb
ADDED
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kanmon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuki Koya
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yao
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.3.8
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.3.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hanami-cli
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: CLI tool of add public IP to Securoity Group on OpenStack.
|
84
|
+
email:
|
85
|
+
- buty4649@gmail.com
|
86
|
+
executables:
|
87
|
+
- kanmon
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- exe/kanmon
|
102
|
+
- kanmon.gemspec
|
103
|
+
- lib/kanmon.rb
|
104
|
+
- lib/kanmon/commands.rb
|
105
|
+
- lib/kanmon/commands/base.rb
|
106
|
+
- lib/kanmon/commands/open.rb
|
107
|
+
- lib/kanmon/commands/version.rb
|
108
|
+
- lib/kanmon/version.rb
|
109
|
+
homepage: https://github.com/buty4649/kanmon/
|
110
|
+
licenses: []
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.7.6
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: CLI tool of add public IP to Securoity Group on OpenStack.
|
132
|
+
test_files: []
|