strongdm 1.0.1 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -7
- data/doc/LICENSE.html +1 -11
- data/doc/Object.html +1 -356
- data/doc/README_md.html +31 -20
- data/doc/SDM.html +1 -1
- data/doc/SDM/AKS.html +40 -4
- data/doc/SDM/AKSBasicAuth.html +40 -4
- data/doc/SDM/AKSServiceAccount.html +40 -4
- data/doc/SDM/AccountAttachment.html +3 -3
- data/doc/SDM/AccountAttachmentCreateResponse.html +3 -3
- data/doc/SDM/AccountAttachmentDeleteResponse.html +3 -3
- data/doc/SDM/AccountAttachmentGetResponse.html +3 -3
- data/doc/SDM/AccountAttachments.html +22 -24
- data/doc/SDM/AccountCreateResponse.html +3 -3
- data/doc/SDM/AccountDeleteResponse.html +3 -3
- data/doc/SDM/AccountGetResponse.html +3 -3
- data/doc/SDM/AccountGrant.html +3 -3
- data/doc/SDM/AccountGrantCreateResponse.html +3 -3
- data/doc/SDM/AccountGrantDeleteResponse.html +3 -3
- data/doc/SDM/AccountGrantGetResponse.html +3 -3
- data/doc/SDM/AccountGrants.html +24 -24
- data/doc/SDM/AccountUpdateResponse.html +3 -3
- data/doc/SDM/Accounts.html +30 -30
- data/doc/SDM/AlreadyExistsError.html +1 -1
- data/doc/SDM/AmazonEKS.html +58 -4
- data/doc/SDM/AmazonES.html +22 -4
- data/doc/SDM/Athena.html +22 -4
- data/doc/SDM/AuroraMysql.html +22 -4
- data/doc/SDM/AuroraPostgres.html +22 -4
- data/doc/SDM/AuthenticationError.html +1 -1
- data/doc/SDM/BadRequestError.html +1 -1
- data/doc/SDM/BigQuery.html +22 -4
- data/doc/SDM/Cassandra.html +22 -4
- data/doc/SDM/Citus.html +409 -0
- data/doc/SDM/Client.html +2 -2
- data/doc/SDM/Clustrix.html +22 -4
- data/doc/SDM/Cockroach.html +22 -4
- data/doc/SDM/CreateResponseMetadata.html +1 -1
- data/doc/SDM/DB2.html +391 -0
- data/doc/SDM/DB2LUW.html +391 -0
- data/doc/SDM/DB2i.html +391 -0
- data/doc/SDM/DeadlineExceededError.html +1 -1
- data/doc/SDM/DeleteResponseMetadata.html +1 -1
- data/doc/SDM/Druid.html +22 -4
- data/doc/SDM/DynamoDB.html +22 -4
- data/doc/SDM/Elastic.html +22 -4
- data/doc/SDM/ElasticacheRedis.html +22 -4
- data/doc/SDM/Gateway.html +22 -4
- data/doc/SDM/GetResponseMetadata.html +1 -1
- data/doc/SDM/GoogleGKE.html +40 -4
- data/doc/SDM/Greenplum.html +22 -4
- data/doc/SDM/HTTPAuth.html +22 -4
- data/doc/SDM/HTTPBasicAuth.html +22 -4
- data/doc/SDM/HTTPNoAuth.html +22 -4
- data/doc/SDM/InternalError.html +1 -1
- data/doc/SDM/Kubernetes.html +40 -4
- data/doc/SDM/KubernetesBasicAuth.html +40 -4
- data/doc/SDM/KubernetesServiceAccount.html +40 -4
- data/doc/SDM/Maria.html +22 -4
- data/doc/SDM/Memcached.html +22 -4
- data/doc/SDM/Memsql.html +22 -4
- data/doc/SDM/MongoHost.html +22 -4
- data/doc/SDM/MongoLegacyHost.html +22 -4
- data/doc/SDM/MongoLegacyReplicaset.html +22 -4
- data/doc/SDM/MongoReplicaSet.html +22 -4
- data/doc/SDM/Mysql.html +22 -4
- data/doc/SDM/NodeCreateResponse.html +3 -3
- data/doc/SDM/NodeDeleteResponse.html +3 -3
- data/doc/SDM/NodeGetResponse.html +3 -3
- data/doc/SDM/NodeUpdateResponse.html +3 -3
- data/doc/SDM/Nodes.html +30 -30
- data/doc/SDM/NotFoundError.html +1 -1
- data/doc/SDM/Oracle.html +22 -4
- data/doc/SDM/PermissionError.html +1 -1
- data/doc/SDM/Plumbing.html +4355 -3574
- data/doc/SDM/Postgres.html +22 -4
- data/doc/SDM/Presto.html +22 -4
- data/doc/SDM/RDP.html +22 -4
- data/doc/SDM/RPCError.html +1 -1
- data/doc/SDM/RateLimitError.html +1 -1
- data/doc/SDM/RateLimitMetadata.html +1 -1
- data/doc/SDM/Redis.html +22 -4
- data/doc/SDM/Redshift.html +22 -4
- data/doc/SDM/Relay.html +23 -5
- data/doc/SDM/ResourceCreateResponse.html +3 -3
- data/doc/SDM/ResourceDeleteResponse.html +3 -3
- data/doc/SDM/ResourceGetResponse.html +3 -3
- data/doc/SDM/ResourceUpdateResponse.html +3 -3
- data/doc/SDM/Resources.html +29 -29
- data/doc/SDM/Role.html +22 -4
- data/doc/SDM/RoleAttachment.html +3 -3
- data/doc/SDM/RoleAttachmentCreateResponse.html +3 -3
- data/doc/SDM/RoleAttachmentDeleteResponse.html +3 -3
- data/doc/SDM/RoleAttachmentGetResponse.html +3 -3
- data/doc/SDM/RoleAttachments.html +23 -23
- data/doc/SDM/RoleCreateResponse.html +3 -3
- data/doc/SDM/RoleDeleteResponse.html +3 -3
- data/doc/SDM/RoleGetResponse.html +3 -3
- data/doc/SDM/RoleGrant.html +3 -3
- data/doc/SDM/RoleGrantCreateResponse.html +3 -3
- data/doc/SDM/RoleGrantDeleteResponse.html +3 -3
- data/doc/SDM/RoleGrantGetResponse.html +3 -3
- data/doc/SDM/RoleGrants.html +23 -23
- data/doc/SDM/RoleUpdateResponse.html +3 -3
- data/doc/SDM/Roles.html +29 -29
- data/doc/SDM/SQLServer.html +22 -4
- data/doc/SDM/SSH.html +40 -4
- data/doc/SDM/SSHCert.html +373 -0
- data/doc/SDM/Service.html +22 -4
- data/doc/SDM/Snowflake.html +22 -4
- data/doc/SDM/Sybase.html +22 -4
- data/doc/SDM/SybaseIQ.html +22 -4
- data/doc/SDM/Teradata.html +22 -4
- data/doc/SDM/UpdateResponseMetadata.html +1 -1
- data/doc/SDM/User.html +22 -4
- data/doc/V1.html +31 -6
- data/doc/V1/AccountAttachments.html +1 -1
- data/doc/V1/AccountAttachments/Service.html +1 -1
- data/doc/V1/AccountGrants.html +1 -1
- data/doc/V1/AccountGrants/Service.html +2 -2
- data/doc/V1/Accounts.html +1 -1
- data/doc/V1/Accounts/Service.html +1 -1
- data/doc/V1/Nodes.html +1 -1
- data/doc/V1/Nodes/Service.html +1 -1
- data/doc/V1/Resources.html +1 -1
- data/doc/V1/Resources/Service.html +1 -1
- data/doc/V1/RoleAttachments.html +1 -1
- data/doc/V1/RoleAttachments/Service.html +1 -1
- data/doc/V1/RoleGrants.html +1 -1
- data/doc/V1/RoleGrants/Service.html +1 -1
- data/doc/V1/Roles.html +1 -1
- data/doc/V1/Roles/Service.html +1 -1
- data/doc/V1/Tags.html +113 -0
- data/doc/created.rid +35 -41
- data/doc/css/rdoc.css +13 -5
- data/doc/examples/Gemfile.html +1 -11
- data/doc/index.html +11 -13
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/lib/version.html +3 -13
- data/doc/table_of_contents.html +1028 -933
- data/lib/grpc/account_attachments_pb.rb +0 -5
- data/lib/grpc/account_grants_services_pb.rb +1 -1
- data/lib/grpc/accounts_pb.rb +3 -0
- data/lib/grpc/drivers_pb.rb +111 -0
- data/lib/grpc/nodes_pb.rb +3 -0
- data/lib/grpc/options_pb.rb +11 -0
- data/lib/grpc/plumbing.rb +2024 -1682
- data/lib/grpc/roles_pb.rb +2 -0
- data/lib/grpc/spec_pb.rb +0 -1
- data/lib/grpc/tags_pb.rb +36 -0
- data/lib/models/porcelain.rb +670 -38
- data/lib/strongdm.rb +1 -1
- data/lib/svc.rb +159 -161
- data/lib/version +16 -2
- data/lib/version.rb +1 -1
- metadata +23 -24
- data/examples/Gemfile +0 -3
- data/examples/Gemfile.lock +0 -14
- data/examples/README.md +0 -5
- data/examples/listUsers.rb +0 -21
- data/examples/okta-sync/Gemfile +0 -4
- data/examples/okta-sync/Gemfile.lock +0 -38
- data/examples/okta-sync/matchers.yml +0 -11
- data/examples/okta-sync/oktaSync.rb +0 -173
- data/examples/panicButton.rb +0 -138
data/examples/panicButton.rb
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
# Copyright 2020 StrongDM Inc
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
#
|
15
|
-
require "strongdm"
|
16
|
-
require "OpenSSL"
|
17
|
-
require "JSON"
|
18
|
-
|
19
|
-
# panicButton.rb suspends all users except for one admin,
|
20
|
-
# in the fake use case of a critical break in or something
|
21
|
-
# usage:
|
22
|
-
# ruby panicButton.rb adminuser@email.com
|
23
|
-
# to revert back to pre-panic state:
|
24
|
-
# ruby panicButton.rb revert
|
25
|
-
def main
|
26
|
-
access_key = ENV["SDM_API_ACCESS_KEY"]
|
27
|
-
secret_key = ENV["SDM_API_SECRET_KEY"]
|
28
|
-
if access_key == nil or secret_key == nil
|
29
|
-
puts "SDM_API_ACCESS_KEY and SDM_API_SECRET_KEY must be provided"
|
30
|
-
return
|
31
|
-
end
|
32
|
-
client = SDM::Client.new(access_key, secret_key)
|
33
|
-
|
34
|
-
if ARGV.size == 1 and ARGV[0] == "revert"
|
35
|
-
state_file = File.open("state.json")
|
36
|
-
state = JSON.load(state_file)
|
37
|
-
|
38
|
-
reinstated_count = 0
|
39
|
-
|
40
|
-
users = client.accounts.list("")
|
41
|
-
users.each { |user|
|
42
|
-
if user.suspended
|
43
|
-
reinstated_count += 1
|
44
|
-
user.suspended = false
|
45
|
-
client.accounts.update(user)
|
46
|
-
end
|
47
|
-
}
|
48
|
-
state["attachments"].each { |attachment|
|
49
|
-
begin
|
50
|
-
a = SDM::AccountAttachment.new()
|
51
|
-
a.account_id = attachment["account_id"]
|
52
|
-
a.role_id = attachment["role_id"]
|
53
|
-
client.account_attachments.create(a)
|
54
|
-
rescue SDM::AlreadyExistsError
|
55
|
-
rescue => ex
|
56
|
-
puts "skipping creation of attachment due to error: " + ex.to_s
|
57
|
-
end
|
58
|
-
}
|
59
|
-
state["grants"].each { |attachment|
|
60
|
-
begin
|
61
|
-
g = SDM::AccountGrant.new()
|
62
|
-
g.account_id = attachment["account_id"]
|
63
|
-
g.resource_id = attachment["resource_id"]
|
64
|
-
client.account_grants.create(g)
|
65
|
-
rescue SDM::AlreadyExistsError
|
66
|
-
rescue => ex
|
67
|
-
puts "skipping creation of grant due to error: " + ex.to_s
|
68
|
-
end
|
69
|
-
}
|
70
|
-
|
71
|
-
puts "reinstated " + reinstated_count.to_s + " users"
|
72
|
-
puts "recreated " + state["attachments"].size.to_s + " account attachments"
|
73
|
-
puts "recreated " + state["grants"].size.to_s + " account grants"
|
74
|
-
|
75
|
-
return
|
76
|
-
end
|
77
|
-
|
78
|
-
admin_email = ""
|
79
|
-
if ARGV.size == 1
|
80
|
-
admin_email = ARGV[0]
|
81
|
-
else
|
82
|
-
puts "please provide an admin email to preserve"
|
83
|
-
return 1
|
84
|
-
end
|
85
|
-
|
86
|
-
admin_user_id = ""
|
87
|
-
users = client.accounts.list("email:?", admin_email)
|
88
|
-
users.each { |user|
|
89
|
-
admin_user_id = user.id
|
90
|
-
}
|
91
|
-
|
92
|
-
account_attachments = client.account_attachments.list("")
|
93
|
-
account_grants = client.account_grants.list("")
|
94
|
-
|
95
|
-
state = {
|
96
|
-
'attachments': account_attachments.map { |x|
|
97
|
-
if x.account_id != admin_user_id
|
98
|
-
out = {
|
99
|
-
'account_id': x.account_id,
|
100
|
-
'role_id': x.role_id,
|
101
|
-
}
|
102
|
-
end
|
103
|
-
}.reject { |x| x == nil },
|
104
|
-
'grants': account_grants.map { |x|
|
105
|
-
if x.account_id != admin_user_id and x.valid_until == nil
|
106
|
-
out = {
|
107
|
-
'account_id': x.account_id,
|
108
|
-
'resource_id': x.resource_id,
|
109
|
-
}
|
110
|
-
end
|
111
|
-
}.reject { |x| x == nil },
|
112
|
-
}
|
113
|
-
|
114
|
-
puts "storing " + state[:attachments].size.to_s + " account attachments in state"
|
115
|
-
puts "storing " + state[:grants].size.to_s + " account grants in state"
|
116
|
-
|
117
|
-
state_file = File.open("state.json", "w")
|
118
|
-
state_file.write(state.to_json)
|
119
|
-
|
120
|
-
suspended_count = 0
|
121
|
-
users = client.accounts.list("")
|
122
|
-
users.each { |user|
|
123
|
-
if user.instance_of? SDM::User and user.email == admin_email
|
124
|
-
next
|
125
|
-
end
|
126
|
-
user.suspended = true
|
127
|
-
begin
|
128
|
-
client.accounts.update(user)
|
129
|
-
suspended_count += 1
|
130
|
-
rescue StandardError => ex
|
131
|
-
puts "skipping user " + user.id + " on account of error: " + ex.to_s
|
132
|
-
end
|
133
|
-
}
|
134
|
-
|
135
|
-
puts "suspended " + suspended_count.to_s + " users"
|
136
|
-
end
|
137
|
-
|
138
|
-
main()
|