cloudcover 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 499796e15bc4ad9b01806a6a9d464017d7a77c2c
4
- data.tar.gz: f463ec941b0d38eeb8ce344deff42ad0a6a1df53
3
+ metadata.gz: 2c46caee78e42162043834818f5be3311401cbef
4
+ data.tar.gz: b39c7865e7175f6dbbe37d6acce347bf42e195b9
5
5
  SHA512:
6
- metadata.gz: e710fa7339ffcdce38bc0f5897aebdc0f4bc3355ef35f85b1bca02bfead481725dbc27cda1122be85477434b00f4a713e4960403b76b6ffcd3f65d439a694e8b
7
- data.tar.gz: b99bc2e98b9305380b65451096d712accdfcab16f5aa574cffd66d27e29c15085a831fb225f51bf346847d2b920220639a7a354957b923ea0eca53dbb542926d
6
+ metadata.gz: f9fb2ca5845c9fb0a639dfc25b4e81e0038236672844fe396c5e34fc03a9bcc9e246ea03edeb10682516c2a7104df3525a6f31c04f30db6ffb8568b8f36d3601
7
+ data.tar.gz: da6f3e8f938865580c57e17ef097fab2b4bb4918a48239c7a1f74d9e3950ebf89f42ba7aeb573370912076921274816c466bdf6f6f0eca7cd9117fcce9e08db9
@@ -15,7 +15,7 @@ module Cloudcover
15
15
  get_credentials
16
16
  auth_response(false, "#{formatted_date(Time.now)} - #{context_message} - Access denied, failed login for #{username}") unless login
17
17
  if group_id
18
- auth_response(false,"#{formatted_date(Time.now)} - #{context_message} - Access denied, #{username} is not a member of group ID '#{group_id}'") unless is_valid_group_member
18
+ auth_response(false,"#{formatted_date(Time.now)} - #{context_message} - Access denied, #{username} is not a member of group ID `#{group_id}`") unless is_valid_group_member
19
19
  end
20
20
  auth_response(true, "#{formatted_date(Time.now)} - #{context_message} - Access granted for #{username}")
21
21
  end
@@ -31,6 +31,7 @@ module Cloudcover
31
31
  if @opts[:radius]
32
32
  abort 'Reject'
33
33
  else
34
+ send_to_slack(msg) if Cloudcover::Config.slack[:report_auth_failures]
34
35
  abort msg
35
36
  end
36
37
  end
@@ -100,6 +101,19 @@ module Cloudcover
100
101
  context || DEFAULT_CONTEXT
101
102
  end
102
103
 
104
+ def send_to_slack(msg)
105
+ Output.say_debug "Posting to slack..."
106
+ slackvars = [:username, :icon_url, :channel]
107
+ payload = { text: msg }
108
+ slackvars.each do |var|
109
+ payload.merge!({var=> Cloudcover::Config.slack[var]}) if Cloudcover::Config.slack[var]
110
+ end
111
+
112
+ HTTParty.post(Cloudcover::Config.slack[:webhook],
113
+ :body => "payload=#{payload.to_json}"
114
+ )
115
+ end
116
+
103
117
 
104
118
  InvalidCredsFile = Class.new(StandardError)
105
119
  end
@@ -1,3 +1,3 @@
1
1
  module Cloudcover
2
- VERSION = '0.0.5'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudcover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Krieger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-20 00:00:00.000000000 Z
11
+ date: 2016-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty