strongdm 1.0.2 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -6
- data/doc/LICENSE.html +6 -11
- data/doc/Object.html +6 -361
- data/doc/README_md.html +37 -19
- data/doc/SDM.html +6 -3
- data/doc/SDM/AKS.html +45 -6
- data/doc/SDM/AKSBasicAuth.html +45 -6
- data/doc/SDM/AKSServiceAccount.html +45 -6
- data/doc/SDM/AccountAttachment.html +8 -5
- data/doc/SDM/AccountAttachmentCreateOptions.html +6 -3
- data/doc/SDM/AccountAttachmentCreateResponse.html +8 -5
- data/doc/SDM/AccountAttachmentDeleteResponse.html +8 -5
- data/doc/SDM/AccountAttachmentGetResponse.html +8 -5
- data/doc/SDM/AccountAttachments.html +27 -26
- data/doc/SDM/AccountCreateResponse.html +8 -5
- data/doc/SDM/AccountDeleteResponse.html +8 -5
- data/doc/SDM/AccountGetResponse.html +8 -5
- data/doc/SDM/AccountGrant.html +8 -5
- data/doc/SDM/AccountGrantCreateResponse.html +8 -5
- data/doc/SDM/AccountGrantDeleteResponse.html +8 -5
- data/doc/SDM/AccountGrantGetResponse.html +8 -5
- data/doc/SDM/AccountGrants.html +29 -26
- data/doc/SDM/AccountUpdateResponse.html +8 -5
- data/doc/SDM/Accounts.html +35 -32
- data/doc/SDM/AlreadyExistsError.html +6 -3
- data/doc/SDM/AmazonEKS.html +45 -6
- data/doc/SDM/AmazonES.html +27 -6
- data/doc/SDM/Athena.html +27 -6
- data/doc/SDM/AuroraMysql.html +27 -6
- data/doc/SDM/AuroraPostgres.html +27 -6
- data/doc/SDM/AuthenticationError.html +6 -3
- data/doc/SDM/BadRequestError.html +6 -3
- data/doc/SDM/BigQuery.html +27 -6
- data/doc/SDM/Cassandra.html +27 -6
- data/doc/SDM/Citus.html +409 -0
- data/doc/SDM/Client.html +7 -4
- data/doc/SDM/Clustrix.html +27 -6
- data/doc/SDM/Cockroach.html +27 -6
- data/doc/SDM/CreateResponseMetadata.html +6 -3
- 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 +6 -3
- data/doc/SDM/DeleteResponseMetadata.html +6 -3
- data/doc/SDM/Druid.html +27 -6
- data/doc/SDM/DynamoDB.html +27 -6
- data/doc/SDM/Elastic.html +27 -6
- data/doc/SDM/ElasticacheRedis.html +27 -6
- data/doc/SDM/Gateway.html +27 -6
- data/doc/SDM/GetResponseMetadata.html +6 -3
- data/doc/SDM/GoogleGKE.html +45 -6
- data/doc/SDM/Greenplum.html +27 -6
- data/doc/SDM/HTTPAuth.html +27 -6
- data/doc/SDM/HTTPBasicAuth.html +27 -6
- data/doc/SDM/HTTPNoAuth.html +27 -6
- data/doc/SDM/InternalError.html +6 -3
- data/doc/SDM/Kubernetes.html +45 -6
- data/doc/SDM/KubernetesBasicAuth.html +45 -6
- data/doc/SDM/KubernetesServiceAccount.html +45 -6
- data/doc/SDM/Maria.html +27 -6
- data/doc/SDM/Memcached.html +27 -6
- data/doc/SDM/Memsql.html +27 -6
- data/doc/SDM/MongoHost.html +27 -6
- data/doc/SDM/MongoLegacyHost.html +27 -6
- data/doc/SDM/MongoLegacyReplicaset.html +27 -6
- data/doc/SDM/MongoReplicaSet.html +27 -6
- data/doc/SDM/Mysql.html +27 -6
- data/doc/SDM/NodeCreateResponse.html +8 -5
- data/doc/SDM/NodeDeleteResponse.html +8 -5
- data/doc/SDM/NodeGetResponse.html +8 -5
- data/doc/SDM/NodeUpdateResponse.html +8 -5
- data/doc/SDM/Nodes.html +35 -32
- data/doc/SDM/NotFoundError.html +6 -3
- data/doc/SDM/Oracle.html +27 -6
- data/doc/SDM/PermissionError.html +6 -3
- data/doc/SDM/Plumbing.html +4351 -3569
- data/doc/SDM/Postgres.html +27 -6
- data/doc/SDM/Presto.html +27 -6
- data/doc/SDM/RDP.html +27 -6
- data/doc/SDM/RPCError.html +6 -3
- data/doc/SDM/RateLimitError.html +6 -3
- data/doc/SDM/RateLimitMetadata.html +6 -3
- data/doc/SDM/Redis.html +27 -6
- data/doc/SDM/Redshift.html +27 -6
- data/doc/SDM/Relay.html +28 -7
- data/doc/SDM/ResourceCreateResponse.html +8 -5
- data/doc/SDM/ResourceDeleteResponse.html +8 -5
- data/doc/SDM/ResourceGetResponse.html +8 -5
- data/doc/SDM/ResourceUpdateResponse.html +8 -5
- data/doc/SDM/Resources.html +34 -31
- data/doc/SDM/Role.html +27 -6
- data/doc/SDM/RoleAttachment.html +8 -5
- data/doc/SDM/RoleAttachmentCreateResponse.html +8 -5
- data/doc/SDM/RoleAttachmentDeleteResponse.html +8 -5
- data/doc/SDM/RoleAttachmentGetResponse.html +8 -5
- data/doc/SDM/RoleAttachments.html +28 -25
- data/doc/SDM/RoleCreateResponse.html +8 -5
- data/doc/SDM/RoleDeleteResponse.html +8 -5
- data/doc/SDM/RoleGetResponse.html +8 -5
- data/doc/SDM/RoleGrant.html +8 -5
- data/doc/SDM/RoleGrantCreateResponse.html +8 -5
- data/doc/SDM/RoleGrantDeleteResponse.html +8 -5
- data/doc/SDM/RoleGrantGetResponse.html +8 -5
- data/doc/SDM/RoleGrants.html +28 -25
- data/doc/SDM/RoleUpdateResponse.html +8 -5
- data/doc/SDM/Roles.html +34 -31
- data/doc/SDM/SQLServer.html +27 -6
- data/doc/SDM/SSH.html +45 -6
- data/doc/SDM/SSHCert.html +373 -0
- data/doc/SDM/Service.html +27 -6
- data/doc/SDM/Snowflake.html +27 -6
- data/doc/SDM/Sybase.html +27 -6
- data/doc/SDM/SybaseIQ.html +27 -6
- data/doc/SDM/Teradata.html +27 -6
- data/doc/SDM/UpdateResponseMetadata.html +6 -3
- data/doc/SDM/User.html +27 -6
- data/doc/V1.html +36 -8
- data/doc/V1/AccountAttachments.html +6 -3
- data/doc/V1/AccountAttachments/Service.html +6 -3
- data/doc/V1/AccountGrants.html +6 -3
- data/doc/V1/AccountGrants/Service.html +7 -4
- data/doc/V1/Accounts.html +6 -3
- data/doc/V1/Accounts/Service.html +6 -3
- data/doc/V1/Nodes.html +6 -3
- data/doc/V1/Nodes/Service.html +6 -3
- data/doc/V1/Resources.html +6 -3
- data/doc/V1/Resources/Service.html +6 -3
- data/doc/V1/RoleAttachments.html +6 -3
- data/doc/V1/RoleAttachments/Service.html +6 -3
- data/doc/V1/RoleGrants.html +6 -3
- data/doc/V1/RoleGrants/Service.html +6 -3
- data/doc/V1/Roles.html +6 -3
- data/doc/V1/Roles/Service.html +6 -3
- data/doc/V1/Tags.html +113 -0
- data/doc/created.rid +38 -41
- data/doc/css/rdoc.css +22 -1
- data/doc/examples/Gemfile.html +6 -11
- data/doc/examples/Gemfile_lock.html +6 -3
- data/doc/examples/README_md.html +6 -3
- data/doc/examples/okta-sync/Gemfile.html +6 -3
- data/doc/examples/okta-sync/Gemfile_lock.html +6 -3
- data/doc/index.html +16 -13
- data/doc/js/darkfish.js +22 -99
- data/doc/js/navigation.js +4 -40
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +32 -31
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +6 -6
- data/doc/js/searcher.js.gz +0 -0
- data/doc/lib/version.html +8 -13
- data/doc/strongdm_gemspec.html +6 -11
- data/doc/table_of_contents.html +1035 -932
- data/examples/Gemfile +2 -2
- data/examples/listUsers.rb +8 -8
- data/lib/errors/errors.rb +53 -55
- data/lib/grpc/account_attachments_pb.rb +9 -14
- data/lib/grpc/account_attachments_services_pb.rb +8 -7
- data/lib/grpc/account_grants_pb.rb +10 -10
- data/lib/grpc/account_grants_services_pb.rb +9 -8
- data/lib/grpc/accounts_pb.rb +12 -9
- data/lib/grpc/accounts_services_pb.rb +8 -7
- data/lib/grpc/drivers_pb.rb +117 -7
- data/lib/grpc/nodes_pb.rb +12 -9
- data/lib/grpc/nodes_services_pb.rb +8 -7
- data/lib/grpc/options_pb.rb +16 -5
- data/lib/grpc/plumbing.rb +4426 -4085
- data/lib/grpc/protoc-gen-swagger/options/annotations_pb.rb +4 -4
- data/lib/grpc/resources_pb.rb +9 -9
- data/lib/grpc/resources_services_pb.rb +8 -7
- data/lib/grpc/role_attachments_pb.rb +9 -9
- data/lib/grpc/role_attachments_services_pb.rb +8 -7
- data/lib/grpc/role_grants_pb.rb +9 -9
- data/lib/grpc/role_grants_services_pb.rb +8 -7
- data/lib/grpc/roles_pb.rb +11 -9
- data/lib/grpc/roles_services_pb.rb +8 -7
- data/lib/grpc/spec_pb.rb +7 -8
- data/lib/grpc/tags_pb.rb +36 -0
- data/lib/models/porcelain.rb +5348 -4415
- data/lib/strongdm.rb +95 -94
- data/lib/svc.rb +1222 -1202
- data/lib/version +16 -2
- data/lib/version.rb +1 -1
- data/strongdm.gemspec +10 -10
- metadata +9 -9
- data/examples/Gemfile.lock +0 -14
- data/examples/README.md +0 -5
- 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 -215
- data/examples/panicButton.rb +0 -180
data/lib/version
CHANGED
@@ -1,3 +1,17 @@
|
|
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
|
+
#
|
1
15
|
module SDM
|
2
|
-
VERSION = "1.0.
|
3
|
-
end
|
16
|
+
VERSION = "1.0.10"
|
17
|
+
end
|
data/lib/version.rb
CHANGED
data/strongdm.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
require File.expand_path("../lib/version.rb", __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name
|
6
|
-
s.version
|
7
|
-
s.platform
|
8
|
-
s.authors
|
9
|
-
s.email
|
10
|
-
s.homepage
|
11
|
-
s.summary
|
5
|
+
s.name = "strongdm"
|
6
|
+
s.version = SDM::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ['strongDM Team']
|
9
|
+
s.email = ['sdk-feedback@strongdm.com']
|
10
|
+
s.homepage = "http://rubygems.org/gems/strongdm"
|
11
|
+
s.summary = "strongDM SDK for the Ruby programming language."
|
12
12
|
s.description = "strongDM Ruby Library for automating interactions with strongDM."
|
13
|
-
s.licenses
|
13
|
+
s.licenses = ["Apache-2.0"]
|
14
14
|
s.required_ruby_version = ">= 2.3.0"
|
15
15
|
s.required_rubygems_version = ">= 1.3.6"
|
16
16
|
|
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_runtime_dependency "grpc-tools", "~> 1.27.0", ">= 1.27.0"
|
19
19
|
s.add_runtime_dependency "openssl", "~> 2.1.2", ">= 2.1.2"
|
20
20
|
|
21
|
-
s.files
|
22
|
-
s.require_path =
|
21
|
+
s.files = `git ls-files | grep -v "strongdm-#{SDM::VERSION}.gem"`.split("\n")
|
22
|
+
s.require_path = 'lib'
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strongdm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- strongDM Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|
@@ -114,10 +114,14 @@ files:
|
|
114
114
|
- doc/SDM/BadRequestError.html
|
115
115
|
- doc/SDM/BigQuery.html
|
116
116
|
- doc/SDM/Cassandra.html
|
117
|
+
- doc/SDM/Citus.html
|
117
118
|
- doc/SDM/Client.html
|
118
119
|
- doc/SDM/Clustrix.html
|
119
120
|
- doc/SDM/Cockroach.html
|
120
121
|
- doc/SDM/CreateResponseMetadata.html
|
122
|
+
- doc/SDM/DB2.html
|
123
|
+
- doc/SDM/DB2LUW.html
|
124
|
+
- doc/SDM/DB2i.html
|
121
125
|
- doc/SDM/DeadlineExceededError.html
|
122
126
|
- doc/SDM/DeleteResponseMetadata.html
|
123
127
|
- doc/SDM/Druid.html
|
@@ -184,6 +188,7 @@ files:
|
|
184
188
|
- doc/SDM/Roles.html
|
185
189
|
- doc/SDM/SQLServer.html
|
186
190
|
- doc/SDM/SSH.html
|
191
|
+
- doc/SDM/SSHCert.html
|
187
192
|
- doc/SDM/Service.html
|
188
193
|
- doc/SDM/Snowflake.html
|
189
194
|
- doc/SDM/Sybase.html
|
@@ -208,6 +213,7 @@ files:
|
|
208
213
|
- doc/V1/RoleGrants/Service.html
|
209
214
|
- doc/V1/Roles.html
|
210
215
|
- doc/V1/Roles/Service.html
|
216
|
+
- doc/V1/Tags.html
|
211
217
|
- doc/created.rid
|
212
218
|
- doc/css/fonts.css
|
213
219
|
- doc/css/rdoc.css
|
@@ -261,14 +267,7 @@ files:
|
|
261
267
|
- doc/strongdm_gemspec.html
|
262
268
|
- doc/table_of_contents.html
|
263
269
|
- examples/Gemfile
|
264
|
-
- examples/Gemfile.lock
|
265
|
-
- examples/README.md
|
266
270
|
- examples/listUsers.rb
|
267
|
-
- examples/okta-sync/Gemfile
|
268
|
-
- examples/okta-sync/Gemfile.lock
|
269
|
-
- examples/okta-sync/matchers.yml
|
270
|
-
- examples/okta-sync/oktaSync.rb
|
271
|
-
- examples/panicButton.rb
|
272
271
|
- lib/errors/errors.rb
|
273
272
|
- lib/grpc/account_attachments_pb.rb
|
274
273
|
- lib/grpc/account_attachments_services_pb.rb
|
@@ -291,6 +290,7 @@ files:
|
|
291
290
|
- lib/grpc/roles_pb.rb
|
292
291
|
- lib/grpc/roles_services_pb.rb
|
293
292
|
- lib/grpc/spec_pb.rb
|
293
|
+
- lib/grpc/tags_pb.rb
|
294
294
|
- lib/models/porcelain.rb
|
295
295
|
- lib/strongdm.rb
|
296
296
|
- lib/svc.rb
|
data/examples/Gemfile.lock
DELETED
data/examples/README.md
DELETED
data/examples/okta-sync/Gemfile
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.7.0)
|
5
|
-
public_suffix (>= 2.0.2, < 5.0)
|
6
|
-
faraday (1.0.0)
|
7
|
-
multipart-post (>= 1.2, < 3)
|
8
|
-
google-protobuf (3.11.4)
|
9
|
-
googleapis-common-protos-types (1.0.4)
|
10
|
-
google-protobuf (~> 3.0)
|
11
|
-
grpc (1.27.0)
|
12
|
-
google-protobuf (~> 3.11)
|
13
|
-
googleapis-common-protos-types (~> 1.0)
|
14
|
-
grpc-tools (1.27.0)
|
15
|
-
ipaddr (1.2.2)
|
16
|
-
multipart-post (2.1.1)
|
17
|
-
oktakit (0.2.0)
|
18
|
-
sawyer (~> 0.8.1)
|
19
|
-
openssl (2.1.2)
|
20
|
-
ipaddr
|
21
|
-
public_suffix (4.0.3)
|
22
|
-
sawyer (0.8.2)
|
23
|
-
addressable (>= 2.3.5)
|
24
|
-
faraday (> 0.8, < 2.0)
|
25
|
-
strongdm (1.0.0)
|
26
|
-
grpc (~> 1.27.0, >= 1.27.0)
|
27
|
-
grpc-tools (~> 1.27.0, >= 1.27.0)
|
28
|
-
openssl (~> 2.1.2, >= 2.1.2)
|
29
|
-
|
30
|
-
PLATFORMS
|
31
|
-
ruby
|
32
|
-
|
33
|
-
DEPENDENCIES
|
34
|
-
oktakit
|
35
|
-
strongdm
|
36
|
-
|
37
|
-
BUNDLED WITH
|
38
|
-
1.17.2
|
@@ -1,215 +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
|
-
# Copyright 2020 StrongDM Inc
|
16
|
-
#
|
17
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
18
|
-
# you may not use this file except in compliance with the License.
|
19
|
-
# You may obtain a copy of the License at
|
20
|
-
#
|
21
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
22
|
-
#
|
23
|
-
# Unless required by applicable law or agreed to in writing, software
|
24
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
25
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
26
|
-
# See the License for the specific language governing permissions and
|
27
|
-
# limitations under the License.
|
28
|
-
#
|
29
|
-
# Copyright 2020 StrongDM Inc
|
30
|
-
#
|
31
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
32
|
-
# you may not use this file except in compliance with the License.
|
33
|
-
# You may obtain a copy of the License at
|
34
|
-
#
|
35
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
36
|
-
#
|
37
|
-
# Unless required by applicable law or agreed to in writing, software
|
38
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
39
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
40
|
-
# See the License for the specific language governing permissions and
|
41
|
-
# limitations under the License.
|
42
|
-
#
|
43
|
-
# Copyright 2020 StrongDM Inc
|
44
|
-
#
|
45
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
46
|
-
# you may not use this file except in compliance with the License.
|
47
|
-
# You may obtain a copy of the License at
|
48
|
-
#
|
49
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
50
|
-
#
|
51
|
-
# Unless required by applicable law or agreed to in writing, software
|
52
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
53
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
54
|
-
# See the License for the specific language governing permissions and
|
55
|
-
# limitations under the License.
|
56
|
-
#
|
57
|
-
require "yaml"
|
58
|
-
require "strongdm"
|
59
|
-
require "oktakit"
|
60
|
-
require "optparse"
|
61
|
-
require "json"
|
62
|
-
|
63
|
-
SDM_API_ACCESS_KEY = ENV.fetch("SDM_API_ACCESS_KEY", "")
|
64
|
-
SDM_API_SECRET_KEY = ENV.fetch("SDM_API_SECRET_KEY", "")
|
65
|
-
OKTA_CLIENT_TOKEN = ENV.fetch("OKTA_CLIENT_TOKEN", "")
|
66
|
-
OKTA_CLIENT_ORGURL = ENV.fetch("OKTA_CLIENT_ORGURL", "")
|
67
|
-
|
68
|
-
def okta_sync
|
69
|
-
if SDM_API_ACCESS_KEY == "" || SDM_API_SECRET_KEY == "" || OKTA_CLIENT_TOKEN == "" || OKTA_CLIENT_ORGURL == ""
|
70
|
-
puts "SDM_API_ACCESS_KEY, SDM_API_SECRET_KEY, OKTA_CLIENT_TOKEN, and OKTA_CLIENT_ORGURL must be set"
|
71
|
-
exit
|
72
|
-
end
|
73
|
-
|
74
|
-
report = {
|
75
|
-
:start => Time.now,
|
76
|
-
|
77
|
-
:oktaUsersCount => 0,
|
78
|
-
:oktaUsers => [],
|
79
|
-
|
80
|
-
:sdmUsersCount => 0,
|
81
|
-
:sdmUsers => [],
|
82
|
-
|
83
|
-
:bothUsersCount => 0,
|
84
|
-
|
85
|
-
:sdmResourcesCount => 0,
|
86
|
-
:sdmResources => {},
|
87
|
-
|
88
|
-
:permissionsGranted => 0,
|
89
|
-
:permissionsRevoked => 0,
|
90
|
-
:grants => [],
|
91
|
-
:revocations => [],
|
92
|
-
|
93
|
-
:matchers => {},
|
94
|
-
}
|
95
|
-
|
96
|
-
plan = false
|
97
|
-
verbose = false
|
98
|
-
OptionParser.new do |opts|
|
99
|
-
opts.banner = "Usage oktaSync.rb [options]"
|
100
|
-
opts.on("-p", "--plan", "calculate changes but do not apply them") do |p|
|
101
|
-
plan = p
|
102
|
-
end
|
103
|
-
opts.on("-v", "--verbose", "print detailed report") do |v|
|
104
|
-
verbose = v
|
105
|
-
end
|
106
|
-
end.parse!
|
107
|
-
|
108
|
-
client = SDM::Client.new(SDM_API_ACCESS_KEY, SDM_API_SECRET_KEY)
|
109
|
-
okta_client = Oktakit.new(token: OKTA_CLIENT_TOKEN, api_endpoint: OKTA_CLIENT_ORGURL + "/api/v1")
|
110
|
-
matchers = YAML.load(File.read("matchers.yml"))
|
111
|
-
report[:matchers] = matchers
|
112
|
-
|
113
|
-
all_users = okta_client.list_users({
|
114
|
-
'query': {
|
115
|
-
'search': "profile.department eq \"Engineering\" and (status eq \"ACTIVE\")",
|
116
|
-
},
|
117
|
-
})
|
118
|
-
|
119
|
-
okta_users = Array.new()
|
120
|
-
all_users[0].each { |u|
|
121
|
-
groups = okta_client.get_member_groups(u.id)
|
122
|
-
group_names = Array.new()
|
123
|
-
groups[0].each { |ug|
|
124
|
-
group_names.push(ug.profile.name)
|
125
|
-
}
|
126
|
-
okta_users.push({ :login => u.profile.login, :first_name => u.profile.firstName, :last_name => u.profile.LastName, :groups => group_names })
|
127
|
-
}
|
128
|
-
report[:oktaUsers] = okta_users
|
129
|
-
report[:oktaUsersCount] = okta_users.size
|
130
|
-
|
131
|
-
accounts = client.accounts.list("type:user").map { |a| [a.email, a] }.to_h
|
132
|
-
report[:sdmUsers] = accounts
|
133
|
-
report[:sdmUsersCount] = accounts.size
|
134
|
-
grants = client.account_grants.list("").map { |ag| ag }
|
135
|
-
|
136
|
-
current = {}
|
137
|
-
grants.each { |g|
|
138
|
-
current[g.account_id] = [] if not current[g.account_id]
|
139
|
-
current[g.account_id].push(g)
|
140
|
-
}
|
141
|
-
|
142
|
-
desired = {}
|
143
|
-
overlapping = 0
|
144
|
-
matchers["groups"].each { |group|
|
145
|
-
group["resources"].each { |resourceQuery|
|
146
|
-
client.resources.list(resourceQuery).each { |res|
|
147
|
-
report[:sdmResources][res.id] = res
|
148
|
-
okta_users.each { |u|
|
149
|
-
if u[:groups].include? group["name"]
|
150
|
-
account = accounts[u[:login]]
|
151
|
-
if account != nil
|
152
|
-
overlapping += 1
|
153
|
-
desired[account.id] = [] if not desired[account.id]
|
154
|
-
desired[account.id].push(res.id)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
}
|
158
|
-
}
|
159
|
-
}
|
160
|
-
}
|
161
|
-
report[:bothUsersCount] = overlapping
|
162
|
-
report[:sdmResourcesCount] = report[:sdmResources].size
|
163
|
-
|
164
|
-
accounts_in_roles = client.account_attachments.list("").map { |aa| [aa.account_id, true] }.to_h
|
165
|
-
|
166
|
-
revocations = 0
|
167
|
-
current.each { |aid, curRes|
|
168
|
-
next if accounts_in_roles[aid]
|
169
|
-
desRes = desired[aid]
|
170
|
-
desRes = [] if not desired[aid]
|
171
|
-
curRes.each { |r|
|
172
|
-
if not(desRes.include? r.resource_id)
|
173
|
-
if plan
|
174
|
-
puts "Plan: revoke %s from user %s\n" % [r.resource_id, aid]
|
175
|
-
else
|
176
|
-
client.account_grants.delete(r.id)
|
177
|
-
end
|
178
|
-
report[:revocations].push(r)
|
179
|
-
revocations += 1
|
180
|
-
end
|
181
|
-
}
|
182
|
-
}
|
183
|
-
report[:permissionsRevoked] = revocations
|
184
|
-
|
185
|
-
grants = 0
|
186
|
-
desired.each { |aid, desRes|
|
187
|
-
curRes = current[aid]
|
188
|
-
curRes = [] if not current[aid]
|
189
|
-
desRes.each { |r|
|
190
|
-
if not(curRes.map { |c| c.resource_id }.include? r)
|
191
|
-
ag = SDM::AccountGrant.new()
|
192
|
-
ag.account_id = aid
|
193
|
-
ag.resource_id = r
|
194
|
-
if plan
|
195
|
-
puts "Plan: grant %s to user %s\n" % [r, aid]
|
196
|
-
else
|
197
|
-
ag = client.account_grants.create(ag).account_grant
|
198
|
-
end
|
199
|
-
report[:grants].push(ag)
|
200
|
-
grants += 1
|
201
|
-
end
|
202
|
-
}
|
203
|
-
}
|
204
|
-
report[:permissionsGranted] = grants
|
205
|
-
|
206
|
-
report[:complete] = Time.now
|
207
|
-
|
208
|
-
if verbose
|
209
|
-
puts JSON.pretty_generate(report)
|
210
|
-
else
|
211
|
-
puts "%d Okta users, %d strongDM users, %d overlapping users, %d grants, %d revocations" % [okta_users.size, accounts.size, overlapping, grants, revocations]
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
okta_sync
|
data/examples/panicButton.rb
DELETED
@@ -1,180 +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
|
-
# Copyright 2020 StrongDM Inc
|
16
|
-
#
|
17
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
18
|
-
# you may not use this file except in compliance with the License.
|
19
|
-
# You may obtain a copy of the License at
|
20
|
-
#
|
21
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
22
|
-
#
|
23
|
-
# Unless required by applicable law or agreed to in writing, software
|
24
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
25
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
26
|
-
# See the License for the specific language governing permissions and
|
27
|
-
# limitations under the License.
|
28
|
-
#
|
29
|
-
# Copyright 2020 StrongDM Inc
|
30
|
-
#
|
31
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
32
|
-
# you may not use this file except in compliance with the License.
|
33
|
-
# You may obtain a copy of the License at
|
34
|
-
#
|
35
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
36
|
-
#
|
37
|
-
# Unless required by applicable law or agreed to in writing, software
|
38
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
39
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
40
|
-
# See the License for the specific language governing permissions and
|
41
|
-
# limitations under the License.
|
42
|
-
#
|
43
|
-
# Copyright 2020 StrongDM Inc
|
44
|
-
#
|
45
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
46
|
-
# you may not use this file except in compliance with the License.
|
47
|
-
# You may obtain a copy of the License at
|
48
|
-
#
|
49
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
50
|
-
#
|
51
|
-
# Unless required by applicable law or agreed to in writing, software
|
52
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
53
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
54
|
-
# See the License for the specific language governing permissions and
|
55
|
-
# limitations under the License.
|
56
|
-
#
|
57
|
-
require "strongdm"
|
58
|
-
require "OpenSSL"
|
59
|
-
require "JSON"
|
60
|
-
|
61
|
-
# panicButton.rb suspends all users except for one admin,
|
62
|
-
# in the fake use case of a critical break in or something
|
63
|
-
# usage:
|
64
|
-
# ruby panicButton.rb adminuser@email.com
|
65
|
-
# to revert back to pre-panic state:
|
66
|
-
# ruby panicButton.rb revert
|
67
|
-
def main
|
68
|
-
access_key = ENV["SDM_API_ACCESS_KEY"]
|
69
|
-
secret_key = ENV["SDM_API_SECRET_KEY"]
|
70
|
-
if access_key == nil or secret_key == nil
|
71
|
-
puts "SDM_API_ACCESS_KEY and SDM_API_SECRET_KEY must be provided"
|
72
|
-
return
|
73
|
-
end
|
74
|
-
client = SDM::Client.new(access_key, secret_key)
|
75
|
-
|
76
|
-
if ARGV.size == 1 and ARGV[0] == "revert"
|
77
|
-
state_file = File.open("state.json")
|
78
|
-
state = JSON.load(state_file)
|
79
|
-
|
80
|
-
reinstated_count = 0
|
81
|
-
|
82
|
-
users = client.accounts.list("")
|
83
|
-
users.each { |user|
|
84
|
-
if user.suspended
|
85
|
-
reinstated_count += 1
|
86
|
-
user.suspended = false
|
87
|
-
client.accounts.update(user)
|
88
|
-
end
|
89
|
-
}
|
90
|
-
state["attachments"].each { |attachment|
|
91
|
-
begin
|
92
|
-
a = SDM::AccountAttachment.new()
|
93
|
-
a.account_id = attachment["account_id"]
|
94
|
-
a.role_id = attachment["role_id"]
|
95
|
-
client.account_attachments.create(a)
|
96
|
-
rescue SDM::AlreadyExistsError
|
97
|
-
rescue => ex
|
98
|
-
puts "skipping creation of attachment due to error: " + ex.to_s
|
99
|
-
end
|
100
|
-
}
|
101
|
-
state["grants"].each { |attachment|
|
102
|
-
begin
|
103
|
-
g = SDM::AccountGrant.new()
|
104
|
-
g.account_id = attachment["account_id"]
|
105
|
-
g.resource_id = attachment["resource_id"]
|
106
|
-
client.account_grants.create(g)
|
107
|
-
rescue SDM::AlreadyExistsError
|
108
|
-
rescue => ex
|
109
|
-
puts "skipping creation of grant due to error: " + ex.to_s
|
110
|
-
end
|
111
|
-
}
|
112
|
-
|
113
|
-
puts "reinstated " + reinstated_count.to_s + " users"
|
114
|
-
puts "recreated " + state["attachments"].size.to_s + " account attachments"
|
115
|
-
puts "recreated " + state["grants"].size.to_s + " account grants"
|
116
|
-
|
117
|
-
return
|
118
|
-
end
|
119
|
-
|
120
|
-
admin_email = ""
|
121
|
-
if ARGV.size == 1
|
122
|
-
admin_email = ARGV[0]
|
123
|
-
else
|
124
|
-
puts "please provide an admin email to preserve"
|
125
|
-
return 1
|
126
|
-
end
|
127
|
-
|
128
|
-
admin_user_id = ""
|
129
|
-
users = client.accounts.list("email:?", admin_email)
|
130
|
-
users.each { |user|
|
131
|
-
admin_user_id = user.id
|
132
|
-
}
|
133
|
-
|
134
|
-
account_attachments = client.account_attachments.list("")
|
135
|
-
account_grants = client.account_grants.list("")
|
136
|
-
|
137
|
-
state = {
|
138
|
-
'attachments': account_attachments.map { |x|
|
139
|
-
if x.account_id != admin_user_id
|
140
|
-
out = {
|
141
|
-
'account_id': x.account_id,
|
142
|
-
'role_id': x.role_id,
|
143
|
-
}
|
144
|
-
end
|
145
|
-
}.reject { |x| x == nil },
|
146
|
-
'grants': account_grants.map { |x|
|
147
|
-
if x.account_id != admin_user_id and x.valid_until == nil
|
148
|
-
out = {
|
149
|
-
'account_id': x.account_id,
|
150
|
-
'resource_id': x.resource_id,
|
151
|
-
}
|
152
|
-
end
|
153
|
-
}.reject { |x| x == nil },
|
154
|
-
}
|
155
|
-
|
156
|
-
puts "storing " + state[:attachments].size.to_s + " account attachments in state"
|
157
|
-
puts "storing " + state[:grants].size.to_s + " account grants in state"
|
158
|
-
|
159
|
-
state_file = File.open("state.json", "w")
|
160
|
-
state_file.write(state.to_json)
|
161
|
-
|
162
|
-
suspended_count = 0
|
163
|
-
users = client.accounts.list("")
|
164
|
-
users.each { |user|
|
165
|
-
if user.instance_of? SDM::User and user.email == admin_email
|
166
|
-
next
|
167
|
-
end
|
168
|
-
user.suspended = true
|
169
|
-
begin
|
170
|
-
client.accounts.update(user)
|
171
|
-
suspended_count += 1
|
172
|
-
rescue StandardError => ex
|
173
|
-
puts "skipping user " + user.id + " on account of error: " + ex.to_s
|
174
|
-
end
|
175
|
-
}
|
176
|
-
|
177
|
-
puts "suspended " + suspended_count.to_s + " users"
|
178
|
-
end
|
179
|
-
|
180
|
-
main()
|