taylorthurlow/panda-motd

UFW not showing in output.

Closed this issue · 9 comments

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

Hi, thanks for submitting an issue. I'm not well-versed on the differences you might find between Ubuntu and Debian but I can't imagine that they're that huge. Perhaps there's a difference in the command output. Do you mind posting the output of systemctl?

Ubuntu is based off of Debian. 95% of the time if something is in Debian it is Ubuntu, and Canonical is know for pushing updates backup up the tree for others which is nice.

Anyways, it looks like UFW isn't managed by systemctl for it's state, I think it manages itself.

$ sudo systemctl status ufw
● ufw.service - Uncomplicated firewall
   Loaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:ufw(8)

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
443/tcp                    ALLOW       Anywhere                  
...

I see what you mean. It's definitely not clear to me what purpose the actual service has, in this case. That said, I should have been a little more explicit: Can you give me the output of literally just sudo systemctl? This is the command the gem parses for service statuses, so if there's an issue finding the service it'll be there.

Unfortunate, though, that it looks like it'll be useless in the list anyways.

https://help.ubuntu.com/community/UFW

$ sudo systemctl 
  UNIT                                                                                     LOAD      ACTIVE SUB       DESCRIPTION                                                                  
  proc-sys-fs-binfmt_misc.automount                                                        loaded    active running   Arbitrary Executable File Formats File System Automount Point                
  sys-devices-pci0000:00-0000:00:02.0-backlight-acpi_video0.device                         loaded    active plugged   /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0                   
  sys-devices-pci0000:00-0000:00:19.0-net-eno1.device                                      loaded    active plugged   82579V Gigabit Network Connection                                            
  sys-devices-pci0000:00-0000:00:1f.2-ata5-host4-target4:0:0-4:0:0:0-block-sda-sda1.device loaded    active plugged   HGST_HUS726020ALA610 /boot                                                   
  sys-devices-pci0000:00-0000:00:1f.2-ata5-host4-target4:0:0-4:0:0:0-block-sda-sda2.device loaded    active plugged   HGST_HUS726020ALA610 /                                                       
  sys-devices-pci0000:00-0000:00:1f.2-ata5-host4-target4:0:0-4:0:0:0-block-sda-sda3.device loaded    active plugged   HGST_HUS726020ALA610 swap-sda3                                               
  sys-devices-pci0000:00-0000:00:1f.2-ata5-host4-target4:0:0-4:0:0:0-block-sda.device      loaded    active plugged   HGST_HUS726020ALA610                                                         
  sys-devices-platform-serial8250-tty-ttyS0.device                                         loaded    active plugged   /sys/devices/platform/serial8250/tty/ttyS0                                   
  sys-devices-platform-serial8250-tty-ttyS1.device                                         loaded    active plugged   /sys/devices/platform/serial8250/tty/ttyS1                                   
  sys-devices-platform-serial8250-tty-ttyS2.device                                         loaded    active plugged   /sys/devices/platform/serial8250/tty/ttyS2                                   
  sys-devices-platform-serial8250-tty-ttyS3.device                                         loaded    active plugged   /sys/devices/platform/serial8250/tty/ttyS3                                   
  sys-module-configfs.device                                                               loaded    active plugged   /sys/module/configfs                                                         
  sys-subsystem-net-devices-eno1.device                                                    loaded    active plugged   82579V Gigabit Network Connection                                            
  -.mount                                                                                  loaded    active mounted   Root Mount                                                                   
  boot.mount                                                                               loaded    active mounted   /boot                                                                        
  dev-hugepages.mount                                                                      loaded    active mounted   Huge Pages File System                                                       
  dev-mqueue.mount                                                                         loaded    active mounted   POSIX Message Queue File System                                              
  proc-sys-fs-binfmt_misc.mount                                                            loaded    active mounted   Arbitrary Executable File Formats File System                                
  run-user-1000.mount                                                                      loaded    active mounted   /run/user/1000                                                               
  sys-kernel-config.mount                                                                  loaded    active mounted   Configuration File System                                                    
  sys-kernel-debug-tracing.mount                                                           loaded    active mounted   /sys/kernel/debug/tracing                                                    
  sys-kernel-debug.mount                                                                   loaded    active mounted   Debug File System                                                            
  systemd-ask-password-console.path                                                        loaded    active waiting   Dispatch Password Requests to Console Directory Watch                        
  systemd-ask-password-wall.path                                                           loaded    active waiting   Forward Password Requests to Wall Directory Watch                            
  init.scope                                                                               loaded    active running   System and Service Manager                                                   
  session-122862.scope                                                                     loaded    active running   Session 122862 of user kayo                                                  
  bind9.service                                                                            loaded    active running   BIND Domain Name Server                                                      
  clamav-freshclam.service                                                                 loaded    active running   ClamAV virus database updater                                                
  console-setup.service                                                                    loaded    active exited    Set console font and keymap                                                  
  cron.service                                                                             loaded    active running   Regular background program processing daemon                                 
  dbus.service                                                                             loaded    active running   D-Bus System Message Bus                                                     
  fail2ban.service                                                                         loaded    active running   Fail2Ban Service                                                             
  fcgiwrap.service                                                                         loaded    active running   Simple CGI Server                                                            
● filebeat.service                                                                         not-found active running   filebeat.service                                                             
  getty@tty1.service                                                                       loaded    active running   Getty on tty1                                                                
  hddtemp.service                                                                          loaded    active exited    LSB: disk temperature monitoring daemon                                      
  irqbalance.service                                                                       loaded    active running   irqbalance daemon                                                            
  keyboard-setup.service                                                                   loaded    active exited    Set the console keyboard layout                                              
  kmod-static-nodes.service                                                                loaded    active exited    Create list of required static device nodes for the current kernel           
  lvm2-lvmetad.service                                                                     loaded    active running   LVM2 metadata daemon                                                         
  lvm2-monitor.service                                                                     loaded    active exited    Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
● monkey-mongo.service                                                                     not-found failed failed    monkey-mongo.service                                                         
  networking.service                                                                       loaded    active exited    Raise network interfaces                                                     
  nginx.service                                                                            loaded    active running   A high performance web server and a reverse proxy server                     
  php7.0-fpm.service                                                                       loaded    active running   The PHP 7.0 FastCGI Process Manager                                          
  postgresql.service                                                                       loaded    active exited    PostgreSQL RDBMS                                                             
  postgresql@10-main.service                                                               loaded    active running   PostgreSQL Cluster 10-main                                                   
  rsyslog.service                                                                          loaded    active running   System Logging Service                                                       
  smartd.service                                                                           loaded    active running   Self Monitoring and Reporting Technology (SMART) Daemon                      
  snmpd.service                                                                            loaded    active running   Simple Network Management Protocol (SNMP) Daemon.                            
  ssh.service                                                                              loaded    active running   OpenBSD Secure Shell server                                                  
  systemd-backlight@backlight:acpi_video0.service                                          loaded    active exited    Load/Save Screen Backlight Brightness of backlight:acpi_video0               
  systemd-fsck@dev-sda1.service                                                            loaded    active exited    File System Check on /dev/sda1                                               
  systemd-journal-flush.service                                                            loaded    active exited    Flush Journal to Persistent Storage                                          
  systemd-journald.service                                                                 loaded    active running   Journal Service                                                              
  systemd-logind.service                                                                   loaded    active running   Login Service                                                                
  systemd-modules-load.service                                                             loaded    active exited    Load Kernel Modules                                                          
  systemd-networkd.service                                                                 loaded    active running   Network Service                                                              
  systemd-random-seed.service                                                              loaded    active exited    Load/Save Random Seed                                                        
  systemd-remount-fs.service                                                               loaded    active exited    Remount Root and Kernel File Systems                                         
  systemd-sysctl.service                                                                   loaded    active exited    Apply Kernel Variables                                                       
  systemd-timesyncd.service                                                                loaded    active running   Network Time Synchronization                                                 
  systemd-tmpfiles-setup-dev.service                                                       loaded    active exited    Create Static Device Nodes in /dev                                           
  systemd-tmpfiles-setup.service                                                           loaded    active exited    Create Volatile Files and Directories                                        
  systemd-udev-trigger.service                                                             loaded    active exited    udev Coldplug all Devices                                                    
  systemd-udevd.service                                                                    loaded    active running   udev Kernel Device Manager                                                   
  systemd-update-utmp.service                                                              loaded    active exited    Update UTMP about System Boot/Shutdown                                       
  systemd-user-sessions.service                                                            loaded    active exited    Permit User Sessions                                                         
  telegraf.service                                                                         loaded    active running   The plugin-driven server agent for reporting metrics into InfluxDB           
  user@1000.service                                                                        loaded    active running   User Manager for UID 1000                                                    
  -.slice                                                                                  loaded    active active    Root Slice                                                                   
  system-getty.slice                                                                       loaded    active active    system-getty.slice                                                           
  system-postgresql.slice                                                                  loaded    active active    system-postgresql.slice                                                      
  system-systemd\x2dbacklight.slice                                                        loaded    active active    system-systemd\x2dbacklight.slice                                            
  system-systemd\x2dfsck.slice                                                             loaded    active active    system-systemd\x2dfsck.slice                                                 
  system.slice                                                                             loaded    active active    System Slice                                                                 
  user-1000.slice                                                                          loaded    active active    User Slice of kayo                                                           
  user.slice                                                                               loaded    active active    User and Session Slice                                                       
  dbus.socket                                                                              loaded    active running   D-Bus System Message Bus Socket                                              
  dm-event.socket                                                                          loaded    active listening Device-mapper event daemon FIFOs                                             
  fcgiwrap.socket                                                                          loaded    active running   fcgiwrap Socket                                                              
  lvm2-lvmetad.socket                                                                      loaded    active running   LVM2 metadata daemon socket                                                  
  lvm2-lvmpolld.socket                                                                     loaded    active listening LVM2 poll daemon socket                                                      
  syslog.socket                                                                            loaded    active running   Syslog Socket                                                                
  systemd-fsckd.socket                                                                     loaded    active listening fsck to fsckd communication Socket                                           
  systemd-initctl.socket                                                                   loaded    active listening /dev/initctl Compatibility Named Pipe                                        
  systemd-journald-audit.socket                                                            loaded    active running   Journal Audit Socket                                                         
  systemd-journald-dev-log.socket                                                          loaded    active running   Journal Socket (/dev/log)                                                    
  systemd-journald.socket                                                                  loaded    active running   Journal Socket                                                               
  systemd-networkd.socket                                                                  loaded    active running   Network Service Netlink Socket                                               
  systemd-udevd-control.socket                                                             loaded    active running   udev Control Socket                                                          
  systemd-udevd-kernel.socket                                                              loaded    active running   udev Kernel Socket                                                           
  dev-sda3.swap                                                                            loaded    active active    /dev/sda3                                                                    
  basic.target                                                                             loaded    active active    Basic System                                                                 
  cryptsetup.target                                                                        loaded    active active    Encrypted Volumes                                                            
  getty.target                                                                             loaded    active active    Login Prompts                                                                
  graphical.target                                                                         loaded    active active    Graphical Interface                                                          
  local-fs-pre.target                                                                      loaded    active active    Local File Systems (Pre)                                                     
  local-fs.target                                                                          loaded    active active    Local File Systems                                                           
  multi-user.target                                                                        loaded    active active    Multi-User System                                                            
  network-online.target                                                                    loaded    active active    Network is Online                                                            
  network.target                                                                           loaded    active active    Network                                                                      
  nss-lookup.target                                                                        loaded    active active    Host and Network Name Lookups                                                
  paths.target                                                                             loaded    active active    Paths                                                                        
  remote-fs-pre.target                                                                     loaded    active active    Remote File Systems (Pre)                                                    
  remote-fs.target                                                                         loaded    active active    Remote File Systems                                                          
  slices.target                                                                            loaded    active active    Slices                                                                       
  sockets.target                                                                           loaded    active active    Sockets                                                                      
  swap.target                                                                              loaded    active active    Swap                                                                         
  sysinit.target                                                                           loaded    active active    System Initialization                                                        
  time-sync.target                                                                         loaded    active active    System Time Synchronized                                                     
  timers.target                                                                            loaded    active active    Timers                                                                       
  apt-daily-upgrade.timer                                                                  loaded    active waiting   Daily apt upgrade and clean activities                                       
  apt-daily.timer                                                                          loaded    active waiting   Daily apt download activities                                                
  phpsessionclean.timer                                                                    loaded    active waiting   Clean PHP session files every 30 mins                                        
  systemd-tmpfiles-clean.timer                                                             loaded    active waiting   Daily Cleanup of Temporary Directories                                       

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

116 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Yeah, based on that output it definitely won't show up. Interestingly, on my Ubuntu install, I do have an entry for ufw in that list.

I can look into writing a component specifically for ufw if it would interest you.

I got it to show up as exited, I just reloaded the service files 🤔
sudo systemctl daemon-reload

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

Odd. Good to know though. systemctl has always been an odd duck, that's for sure.

Unrelatedly, is the setup process for Debian any different from the Ubuntu instructions? If not I'll probably just generalize the wiki page for both.

I followed the Ubuntu 16.04 Guide and that worked on Debian 9

Cool, thanks.