sgdoc 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +7 -0
- data/README.ja.md +19 -6
- data/README.md +2 -2
- data/lib/sgdoc/client.rb +1 -1
- data/lib/sgdoc/ec2/ip_permission.rb +2 -2
- data/lib/sgdoc/ec2/security_group.rb +1 -1
- data/lib/sgdoc/templates/security_groups.md.erb +2 -2
- data/lib/sgdoc/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfe3f1db6cd5e5afe70362d29b25df3685ca6a87
|
4
|
+
data.tar.gz: 1a8c5c041de3ab4da7a378c3604425f93610b0f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3a5a02940643289850d5fc2cffd02cc0941382f0755ed1f1c02db7726804c8ea129c27f67ad19efe36dddd69127b674ae611111aa1c5aa9bd39c6e47d25fa56
|
7
|
+
data.tar.gz: 1762e52af27785541335ec2f3f580157dd0d89e19401f801da25f7196ec0a1f583561479aa0aea0075d244c4671c6d02384aa4fd0c7bd909b3acd09746847871
|
data/Dockerfile
ADDED
data/README.ja.md
CHANGED
@@ -11,19 +11,32 @@ SGを参照しているサービスはEC2,RDS,ELBを対象とする(その他は
|
|
11
11
|
|
12
12
|
## やりたいこと
|
13
13
|
|
14
|
-
-
|
15
|
-
- [ ] Erubisに渡してerbテンプレートで展開する
|
14
|
+
- Erubisに渡してerbテンプレートで展開する
|
16
15
|
- ドキュメントにはSecurityGroupの内容
|
17
16
|
- 関連付けの情報(EC2, ELB, EC2)
|
18
|
-
-
|
19
|
-
|
17
|
+
- SecurityGroupのIn,Outのポリシーにコメントを入れれるようにしたい(別ファイルでポートのコメント管理。定型文はYamlで管理(0.0.0.0/0など))
|
20
18
|
|
21
19
|
### Credentialは次の順番で有効になる
|
22
|
-
- (
|
23
|
-
- `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`
|
20
|
+
- (未) `:access_key_id` , `:secret_access_key` , and `:session_token` options
|
21
|
+
- `ENV['AWS_REGION']`, `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`
|
24
22
|
- HOME/.aws/credentials shared credentials file
|
25
23
|
- EC2 instance profile credentials See Plugins::RequestSigner for more details.
|
26
24
|
|
25
|
+
|
26
|
+
### 実行方法
|
27
|
+
|
28
|
+
```
|
29
|
+
shared credentials file(HOME/.aws/credentials) に設定がある場合
|
30
|
+
$ sgdoc > sgdoc.md
|
31
|
+
|
32
|
+
環境変数を設定して実行
|
33
|
+
$ AWS_REGION=ap-northeast-1 AWS_ACCESS_KEY_ID=[ACCESS_KEY] AWS_SECRET_ACCESS_KEY=[SECRET_ACCESS_KEY] sgdoc > sgdoc.md
|
34
|
+
|
35
|
+
Dockerで実行する
|
36
|
+
$ docker build . -f Dockerfile -t yusabana/sgdoc
|
37
|
+
$ docker run --rm -e AWS_REGION=ap-northeast-1 -e AWS_ACCESS_KEY_ID=[ACCESS_KEY] -e AWS_SECRET_ACCESS_KEY=[SECRET_ACCESS_KEY] yusabana/sgdoc sgdoc
|
38
|
+
```
|
39
|
+
|
27
40
|
## Requirements
|
28
41
|
|
29
42
|
Ruby 2.1 or higher
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Sgdoc
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/yusabana/sgdoc.svg?branch=master)](https://travis-ci.org/yusabana/sgdoc)
|
4
4
|
|
5
|
-
|
5
|
+
For Japanese [README.ja.md](README.ja.md)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
data/lib/sgdoc/client.rb
CHANGED
@@ -10,7 +10,7 @@ module Sgdoc
|
|
10
10
|
|
11
11
|
def security_groups_by_vpc_id
|
12
12
|
describe_security_groups = @ec2_client.describe_security_groups.security_groups
|
13
|
-
security_groups
|
13
|
+
security_groups = describe_security_groups.map { |sg| Sgdoc::EC2::SecurityGroup.new(sg) }
|
14
14
|
|
15
15
|
# vpcIDのキーをvpcのオブジェクトにしても良い
|
16
16
|
security_groups.group_by { |sg| sg.vpc_id }
|
@@ -4,7 +4,7 @@ module Sgdoc
|
|
4
4
|
ALL_STRING = 'all'
|
5
5
|
|
6
6
|
def initialize(ip_permission:, ip_range: nil, user_id_group_pair: nil)
|
7
|
-
raise StandardError 'Unknown pattern of IpPermission, at least must need ip_range or user_id_group_pair' if ip_range.nil? && user_id_group_pair.nil?
|
7
|
+
raise StandardError, 'Unknown pattern of IpPermission, at least must need ip_range or user_id_group_pair' if ip_range.nil? && user_id_group_pair.nil?
|
8
8
|
|
9
9
|
@ip_range = ip_range
|
10
10
|
@user_id_group_pair = user_id_group_pair
|
@@ -38,7 +38,7 @@ module Sgdoc
|
|
38
38
|
|
39
39
|
def doc_description
|
40
40
|
# TODO desriptionを出力する使用を考える(IPベースの設定ファイルでいいかも)
|
41
|
-
'
|
41
|
+
' '
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
### Inbound
|
12
12
|
|
13
|
-
| Protocol | Port | Source |
|
13
|
+
| Protocol | Port | Source | %Description |
|
14
14
|
| ---- | ---- | ---- | ---- |
|
15
15
|
<% if sg.inbound_permissions.each do |iperm| %>
|
16
16
|
| <%= iperm.protocol %> | <%= iperm.port %> | <%= iperm.target %> | <%= iperm.doc_description %> |
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
### Outbound
|
22
22
|
|
23
|
-
| Protocol | Port | Destination |
|
23
|
+
| Protocol | Port | Destination | %Description |
|
24
24
|
| ---- | ---- | ---- | ---- |
|
25
25
|
<% if sg.outbound_permissions.each do |operm| %>
|
26
26
|
| <%= operm.protocol %> | <%= operm.port %> | <%= operm.target %> | <%= operm.doc_description %> |
|
data/lib/sgdoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sgdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Takaesu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- ".gitignore"
|
120
120
|
- ".rspec"
|
121
121
|
- ".travis.yml"
|
122
|
+
- Dockerfile
|
122
123
|
- Gemfile
|
123
124
|
- LICENSE.txt
|
124
125
|
- README.ja.md
|