panda-motd 0.0.6 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@
6
6
  components:
7
7
  #####
8
8
  # ASCII Text Art
9
- # Generates ASCII pictures of strings. Currently only shows the hostname.
9
+ # Generates ASCII pictures of strings.
10
10
  #
11
11
  # Settings
12
12
  # font: The figlet font to render the text with. All supported fonts
@@ -16,12 +16,14 @@ components:
16
16
  # can also use 'default' for your default terminal color. Additionally,
17
17
  # you can prefix any of the base colors with 'light_' to get the lighter
18
18
  # version.
19
+ # command: The command to run which generates the text to display.
19
20
  #####
20
21
 
21
22
  # ascii_text_art:
22
23
  # enabled: true
23
24
  # font: slant
24
25
  # color: red
26
+ # command: hostname
25
27
 
26
28
  #####
27
29
  # Service Status
@@ -60,6 +62,10 @@ components:
60
62
  # Displays the validity and expiration dates of SSL certificates.
61
63
  #
62
64
  # Settings
65
+ # sort_method: The method used to sort the list of certificates. If no
66
+ # method is specified, the list will be sorted alphabetically. Valid
67
+ # values are 'alphabetical' and 'expiration'. The latter will place
68
+ # the certificates which are most near expiration at the top.
63
69
  # certs: Pairs following the format "PrettyName: absolute_cert_file_path".
64
70
  # The absolute_cert_file_path is the absolute file path of the SSL
65
71
  # certificate. The pretty name is the name that is used in the MOTD to
@@ -68,8 +74,9 @@ components:
68
74
 
69
75
  # ssl_certificates:
70
76
  # enabled: true
77
+ # sort_method: alphabetical
71
78
  # certs:
72
- # taylorjthurlow.com: /etc/letsencrypt/live/taylorjthurlow.com/cert.pem
79
+ # thurlow.io: /etc/letsencrypt/live/thurlow.io/cert.pem
73
80
 
74
81
  #####
75
82
  # Filesystems
@@ -88,6 +95,21 @@ components:
88
95
  # /dev/sda1: Ubuntu
89
96
  # /dev/sdc1: Data
90
97
 
98
+ #####
99
+ # Fail2Ban
100
+ # Displays fail2ban jail statistics.
101
+ #
102
+ # Settings
103
+ # jails: A list of fail2ban jails to obtain statistics from. The name of the
104
+ # jail is the same name used in the `fail2ban-client status jailname`. You
105
+ # will get the total banned and currently banned numbers for each jail.
106
+ #####
107
+
108
+ # fail_2_ban:
109
+ # enabled: true
110
+ # jails:
111
+ # - sshd
112
+ # - anotherjail
91
113
 
92
114
  #####
93
115
  # Last Login
@@ -1,16 +1,29 @@
1
- require 'sysinfo'
1
+ # frozen_string_literal: true
2
+
3
+ require "sysinfo"
2
4
 
3
5
  class MOTD
4
6
  attr_reader :config, :components
5
7
 
6
- def initialize(config_path = nil)
7
- @config = config_path ? Config.new(config_path) : Config.new
8
+ # Creates an MOTD by parsing the provided config file, and processing each
9
+ # component.
10
+ #
11
+ # @param config_path [String] The path to the configuration file. If not
12
+ # provided, the default config path will be used.
13
+ # @param process [Boolean] whether or not to actually process and evaluate
14
+ # the printable results of each component
15
+ def initialize(config_path = nil, process = true)
16
+ @config = Config.new(config_path)
8
17
  @components = @config.components_enabled.map { |ce| ce.new(self) }
9
- @components.each(&:process)
18
+ @components.each(&:process) if process
10
19
  end
11
20
 
21
+ # Takes each component on the MOTD and joins them together in a printable
22
+ # format. It inserts two newlines in between each component, ensuring that
23
+ # there is one empty line between each. If a component has any errors, the
24
+ # error will be printed in a clean way.
12
25
  def to_s
13
- return @components.map do |c|
26
+ @components.map do |c|
14
27
  if c.errors.any?
15
28
  c.errors.map(&:to_s).join("\n")
16
29
  else
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class PandaMOTD
2
4
  #:nodoc:
3
- VERSION ||= '0.0.6'.freeze
5
+ VERSION ||= "0.0.12"
4
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda-motd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Thurlow
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artii
@@ -81,105 +81,175 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.8'
83
83
  - !ruby/object:Gem::Dependency
84
- name: byebug
84
+ name: factory_bot
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: guard
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '2.14'
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '2.14'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: guard-rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '4.7'
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: '4.7'
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry-byebug
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rake
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
125
167
  - !ruby/object:Gem::Dependency
126
168
  name: rspec
127
169
  requirement: !ruby/object:Gem::Requirement
128
170
  requirements:
129
- - - "~>"
171
+ - - ">="
130
172
  - !ruby/object:Gem::Version
131
- version: '3.7'
173
+ version: '0'
132
174
  type: :development
133
175
  prerelease: false
134
176
  version_requirements: !ruby/object:Gem::Requirement
135
177
  requirements:
136
- - - "~>"
178
+ - - ">="
137
179
  - !ruby/object:Gem::Version
138
- version: '3.7'
180
+ version: '0'
139
181
  - !ruby/object:Gem::Dependency
140
182
  name: rubocop
141
183
  requirement: !ruby/object:Gem::Requirement
142
184
  requirements:
143
- - - "~>"
185
+ - - ">="
144
186
  - !ruby/object:Gem::Version
145
- version: '0.51'
187
+ version: '0'
146
188
  type: :development
147
189
  prerelease: false
148
190
  version_requirements: !ruby/object:Gem::Requirement
149
191
  requirements:
150
- - - "~>"
192
+ - - ">="
151
193
  - !ruby/object:Gem::Version
152
- version: '0.51'
194
+ version: '0'
153
195
  - !ruby/object:Gem::Dependency
154
196
  name: rubocop-rspec
155
197
  requirement: !ruby/object:Gem::Requirement
156
198
  requirements:
157
- - - "~>"
199
+ - - ">="
158
200
  - !ruby/object:Gem::Version
159
- version: '1.25'
201
+ version: '0'
160
202
  type: :development
161
203
  prerelease: false
162
204
  version_requirements: !ruby/object:Gem::Requirement
163
205
  requirements:
164
- - - "~>"
206
+ - - ">="
165
207
  - !ruby/object:Gem::Version
166
- version: '1.25'
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rufo
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
167
223
  - !ruby/object:Gem::Dependency
168
224
  name: simplecov
169
225
  requirement: !ruby/object:Gem::Requirement
170
226
  requirements:
171
- - - "~>"
227
+ - - ">="
172
228
  - !ruby/object:Gem::Version
173
- version: '0.12'
229
+ version: '0'
174
230
  type: :development
175
231
  prerelease: false
176
232
  version_requirements: !ruby/object:Gem::Requirement
177
233
  requirements:
178
- - - "~>"
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: solargraph
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
179
249
  - !ruby/object:Gem::Version
180
- version: '0.12'
250
+ version: '0'
181
251
  description: Enhance your MOTD with useful at-a-glance information.
182
- email: taylorthurlow8@gmail.com
252
+ email: taylorthurlow@me.com
183
253
  executables:
184
254
  - panda-motd
185
255
  extensions: []
@@ -187,8 +257,10 @@ extra_rdoc_files: []
187
257
  files:
188
258
  - bin/panda-motd
189
259
  - lib/panda_motd.rb
260
+ - lib/panda_motd/component.rb
190
261
  - lib/panda_motd/component_error.rb
191
262
  - lib/panda_motd/components/ascii_text_art.rb
263
+ - lib/panda_motd/components/fail_2_ban.rb
192
264
  - lib/panda_motd/components/filesystems.rb
193
265
  - lib/panda_motd/components/last_login.rb
194
266
  - lib/panda_motd/components/service_status.rb
@@ -202,7 +274,7 @@ homepage: https://github.com/taylorthurlow/panda-motd
202
274
  licenses:
203
275
  - MIT
204
276
  metadata: {}
205
- post_install_message:
277
+ post_install_message:
206
278
  rdoc_options: []
207
279
  require_paths:
208
280
  - lib
@@ -210,16 +282,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
210
282
  requirements:
211
283
  - - ">="
212
284
  - !ruby/object:Gem::Version
213
- version: '2.2'
285
+ version: '2.4'
214
286
  required_rubygems_version: !ruby/object:Gem::Requirement
215
287
  requirements:
216
288
  - - ">="
217
289
  - !ruby/object:Gem::Version
218
290
  version: '0'
219
291
  requirements: []
220
- rubyforge_project:
221
- rubygems_version: 2.7.6
222
- signing_key:
292
+ rubyforge_project:
293
+ rubygems_version: 2.6.14.4
294
+ signing_key:
223
295
  specification_version: 4
224
296
  summary: Make your MOTD prettier, and more useful.
225
297
  test_files: []