GithubHelp home page GithubHelp logo

panda-motd's People

Contributors

br1ght0ne avatar dependabot[bot] avatar mistyhands avatar pmcanseco avatar taylorthurlow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

panda-motd's Issues

Automagically Sort SSL Certificates

Describe the solution you'd like
When rendering/displaying the SSL Certificates, automagically sort them alphabetically by default, and also have the option to sort by expiration date, ex, having the certificates that are going to expire listed first.

Describe alternatives you've considered
Manually sorting certificates :(

Non-ASCII characters in systemctl output breaking services component

The non-ASCII characters are here:

screen shot 2018-05-14 at 1 05 59 am-annotated

It would be wise to filter any non-ascii characters, regardless of what init system is being used.

Error log:

/var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/components/service_status.rb:47:in `split': invalid byte sequence in US-ASCII (ArgumentError)
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/components/service_status.rb:47:in `parse_services'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/components/service_status.rb:16:in `process'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/motd.rb:9:in `each'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd/motd.rb:9:in `initialize'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd.rb:9:in `new'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/lib/panda_motd.rb:9:in `new_motd'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.6/bin/panda-motd:5:in `<top (required)>'
        from /usr/local/bin/panda-motd:22:in `load'
        from /usr/local/bin/panda-motd:22:in `<main>'

Error on first run (ascii_text_art.rb:15:in ``': No such file or directory - (Errno::ENOENT))

Bug description

Get error on first run of panda-motd, not familiar with ruby, so i cant describe the bug better than this.
output of cat /var/log/panda-motd.error.log:

/var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/ascii_text_art.rb:15:in ``': No such file or directory -  (Errno::ENOENT)
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/ascii_text_art.rb:15:in `process'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/motd.rb:9:in `each'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/motd.rb:9:in `initialize'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd.rb:9:in `new'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd.rb:9:in `new_motd'
        from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/bin/panda-motd:5:in `<top (required)>'
        from /usr/local/bin/panda-motd:23:in `load'
        from /usr/local/bin/panda-motd:23:in `<main>'

Reproduction steps

Steps to reproduce the behavior:

  1. Run panda-motd

Expected behavior

I expected panda-motd to print a successful result.

OS Information

  • OS: Ubuntu 16.04 LTS
  • rb v: 2.3.0

Configuration File

https://gist.github.com/eevahr/ae2e87642f55c0a1704cc6a093aa1953

Service Status Component: ASCII ArgumentError

Bug description

There is a string encoding bug when printing services and their status.
panda-motd had errors. Check '/var/log/panda-motd.error.log'.

/var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/service_status.rb:41:in `delete': invalid byte sequence in US-ASCII (ArgumentError)
    from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/service_status.rb:41:in `parse_services'
    from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/components/service_status.rb:16:in `process'
    from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/motd.rb:9:in `each'
    from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd/motd.rb:9:in `initialize'
    from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd.rb:9:in `new'
    from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/lib/panda_motd.rb:9:in `new_motd'
    from /var/lib/gems/2.3.0/gems/panda-motd-0.0.7/bin/panda-motd:5:in `<top (required)>'
    from /usr/local/bin/panda-motd:23:in `load'
    from /usr/local/bin/panda-motd:23:in `<main>'

Adding export LANG=en_US.UTF-8 to /etc/update-motd.d/00-panda-motd resolves the issue for now

Reproduction steps

  1. Follow the steps in the wiki to setup panda-motd
  2. SSH into the server after activating

Expected behavior

The configured MOTD would print

OS Information

  • OS: Ubuntu 16.04 LTS

Configuration File

https://gist.github.com/sroche0/7f131d8874aed54ea631059784b66b95

Better error handling

Currently components add errors to an @errors instance variable. This makes it so methods in components which fail in one way or another still need to return a value in order to prevent actual exceptions.

To handle this, real errors should be raised (something like ComponentError), and the #process method should be able to catch them and log them. This will make error control flow easier, while still allowing execution to continue to other components.

`components_enabled': undefined method `map' for nil:NilClass (NoMethodError)

Bug description

Fails to run.

Reproduction steps

Steps to reproduce the behavior:

  1. Installed using sudo gem install panda-motd
  2. ran: sudo panda-motd
  3. Got the error below.
rush@rush-Latitude-E6540:~/ruby_projects/panda-motd$ sudo gem install panda-motd
[sudo] password for rush: 
Fetching: colorize-0.8.1.gem (100%)
Successfully installed colorize-0.8.1
Fetching: require_all-2.0.0.gem (100%)
Successfully installed require_all-2.0.0
Fetching: ruby-units-2.3.0.gem (100%)
Successfully installed ruby-units-2.3.0
Fetching: drydock-0.6.9.gem (100%)
Successfully installed drydock-0.6.9
Fetching: storable-0.8.9.gem (100%)
Successfully installed storable-0.8.9
Fetching: sysinfo-0.8.1.gem (100%)
Successfully installed sysinfo-0.8.1
Fetching: panda-motd-0.0.4.gem (100%)
Successfully installed panda-motd-0.0.4
Parsing documentation for colorize-0.8.1
Installing ri documentation for colorize-0.8.1
Parsing documentation for require_all-2.0.0
Installing ri documentation for require_all-2.0.0
Parsing documentation for ruby-units-2.3.0
Installing ri documentation for ruby-units-2.3.0
Parsing documentation for drydock-0.6.9
Installing ri documentation for drydock-0.6.9
Parsing documentation for storable-0.8.9
Installing ri documentation for storable-0.8.9
Parsing documentation for sysinfo-0.8.1
Installing ri documentation for sysinfo-0.8.1
Parsing documentation for panda-motd-0.0.4
Installing ri documentation for panda-motd-0.0.4
Done installing documentation for colorize, require_all, ruby-units, drydock, storable, sysinfo, panda-motd after 0 seconds
7 gems installed

rush@rush-Latitude-E6540:~/ruby_projects/panda-motd$ sudo panda-motd
Traceback (most recent call last):
	6: from /usr/local/bin/panda-motd:23:in `<main>'
	5: from /usr/local/bin/panda-motd:23:in `load'
	4: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/bin/panda-motd:5:in `<top (required)>'
	3: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd.rb:6:in `new_motd'
	2: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd.rb:6:in `new'
	1: from /var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd/motd.rb:8:in `initialize'
/var/lib/gems/2.5.0/gems/panda-motd-0.0.4/lib/panda_motd/config.rb:13:in `components_enabled': undefined method `map' for nil:NilClass (NoMethodError)

Expected behavior

Expected the application to create the config file and run.

Screenshots

screenshot from 2018-05-13 23-28-25

OS Information

  • OS: 18.04 Ubuntu Budgie LTS

service_status error: Unable to parse systemctl output

Bug description

Service status check is throwing an error.

Reproduction steps

Steps to reproduce the behavior:

  1. Execute: panda-motd ~/.config/panda-motd.yaml

Expected behavior

Normal output of service information via systemd.

Screenshots

$ panda-motd ~/.config/panda-motd.yaml
service_status error: Unable to parse systemctl output

Uptime 38 days, 10 hours, 15 minutes

SSL Certificates:
	<snip>

Filesystems  Size  Used  Free  Use%
  root       2.0T  186G  1.7T    9%
  [===============================]
  boot       510M   97M  382M   19%
  [===============================]

Last Login:
  kayo:
    from <snip> at 12/30/2018 01:05PM (still logged in)

OS Information

  • OS: Debian 9
  • systemd: 232-25+deb9u6
  • panda-motd: 0.0.10, 0.0.6
$ gem list | grep panda-motd
panda-motd (0.0.10, 0.0.6)

Configuration File

Docker support

I would be very interested in docker support of some kind. Even if it is just some run statuses.

ssl_certificates error: Unable to find certificate expiration date

Bug description

When I run the script, I get ssl_certificates error: Unable to find certificate expiration date in the ssl section

Reproduction steps

Steps to reproduce the behavior:

  1. configure an ssl certificate in the configuration file:
    ssl_certificates:
      enable: true
      certs:
        ...: /etc/letsencrypt/live/.../cert.pem
    
  2. Run panda-motd

Expected behavior

I expect valid until <date>

Log file

/var/log/panda-motd.error.log exists but it's empty?

OS Information

  • OS: Arch 5.10.14-arch1-1

Configuration File

https://gist.github.com/MarcelRobitaille/19541379a55f19e21a8d8774a55662bf

Add error checking

Need to look over each component and take a good look at where errors, especially in configuration, need to be handled. Should come up with a simple way to add these errors and print them in lieu of the actual component when errors occur.

wrong uptime displayed

Bug description

The uptime displayed by panda-motd isn't the good one.

Reproduction steps

Uncomment the "uptime" paragraph in ~/.config/panda-motd

Expected behavior

Have the right uptime displayed

Screenshots

If applicable, add screenshots to help explain your problem.
See the red ractangles
issue

OS Information

  • OS: Debian 9.7 64 bits

Configuration File

uptime:
enabled: true
prefix: up

Not handling all possible output in last login component

I just installed a Ubuntu 18.04 LTS and tried setting up panda-motd - but it crashed complaining about the last_login component not being able to parse a date. Upon inspection, the results of the command:

last --time-format=iso taylor

are

taylor   pts/2        tmux(14328).%2   2018-11-05T16:04:53-0800   gone - no logout
taylor   pts/2        tmux(14328).%1   2018-11-05T16:02:57-0800 - 2018-11-05T16:03:24-0800  (00:00)
taylor   pts/1        tmux(14328).%0   2018-11-05T16:00:25-0800   gone - no logout
taylor   pts/3        tmux(13667).%1   2018-11-05T16:00:09-0800 - 2018-11-05T16:00:22-0800  (00:00)
taylor   pts/1        tmux(13667).%0   2018-11-05T15:59:09-0800 - 2018-11-05T16:00:19-0800  (00:01)
taylor   pts/1        tmux(13582).%0   2018-11-05T15:59:01-0800 - 2018-11-05T15:59:08-0800  (00:00

The - in the gone - no logout section is what breaks the regex search. On top of that, we were basically assuming that that section of the log would only be "still logged in" or a valid date. I'm going to play with the regex a bit to get it to match the entire section, and handle whatever messages show up in that column.

Add other init systems

It would be nice to have support for less popular init systems, like runit, OpenRC or upstart.

undefined method `[]' for nil:NilClass (NoMethodError)

Bug description

Hello,
I'm facing a little issue with the installation.
I have installed Ruby2.3 on my fresh Debian 9 and did the "sudo gem install panda-motd" command. Then I wrote panda-motd ~/.config/panda-motd.yaml and I have an error.

Expected behavior

Generation of a YAML file containing options to customize panda-motd.

Screenshots

If applicable, add screenshots to help explain your problem.

Log file

/var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd/config.rb:50:in load_config': undefined method []' for nil:NilClass (NoMethodError)
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd/config.rb:13:in initialize' from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd/motd.rb:7:in new'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd/motd.rb:7:in initialize' from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd.rb:9:in new'
from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/lib/panda_motd.rb:9:in new_motd' from /var/lib/gems/2.3.0/gems/panda-motd-0.0.11/bin/panda-motd:5:in <top (required)>'
from /usr/local/bin/panda-motd:22:in load' from /usr/local/bin/panda-motd:22:in

'

OS Information

  • OS: Debian 9.7 - 64 bits -- bash 4.4.12

UFW not showing in output.

Bug description

UFW does not show in output when in config

Reproduction steps

   service_status:
     enabled: true
     services:
       nginx: NGINX
       fail2ban: Fail2Ban
       snmpd: snmpd
       ufw: ufw
       php7.0-fpm: PHP7-FPM
$ panda-motd ~/.config/panda-motd.yaml
Services:
  fail2ban:   running
  nginx:      running
  php7.0-fpm: running
  snmpd:      running
...

Expected behavior

$ panda-motd ~/.config/panda-motd.yaml
Services:
  fail2ban:   running
  nginx:      running
  php7.0-fpm: running
  snmpd:      running
  ufw:    running

OS Information

  • OS: Debian 9

Configuration File

https://gist.github.com/RyoshiKayo/34dafb49e8af391df6fd4b748c8c19e9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.