Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 636870 - app-admin/sshguard-2.1.0 rc-status crashed
Summary: app-admin/sshguard-2.1.0 rc-status crashed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-08 14:54 UTC by needle
Modified: 2018-03-12 14:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/sshguard.conf (sshguard.conf,260 bytes, text/plain)
2017-11-08 15:01 UTC, needle
Details
/etc/conf.d/sshguard (conf.d.sshguard,91 bytes, text/plain)
2017-11-08 15:02 UTC, needle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description needle 2017-11-08 14:54:58 UTC
if starting sshguard the service reports ok for start:
___

client ~ # /etc/init.d/sshguard start
 * Starting sshguard ...                                     [ ok]
___

if running rc-status it reports it has crashed:

___

# rc-status | grep crashed
 sshguard                                                          [  crashed  ]
___

If investigating further the service/daemon is running and working sanely:
___

# ls /run/ | grep sshguard
sshguard.pid

 # ps aux | grep sshguard
root      8424  0.0  0.0  22456  3380 ?        Ss   15:34   0:00 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/auth.log
root      8425  0.0  0.0  22456  1708 ?        S    15:34   0:00 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/auth.log
root      8427  0.0  0.0  14908  1656 ?        Sl   15:34   0:00 /usr/libexec/sshg-blocker -a 10 -b 10:/var/lib/sshguard/blacklist -i /var/run/sshguard.pid -p 43200 -s 604800 -N 64 -n 32 -w /etc/sshguard/whitelist
root      8429  0.0  0.0  22456  1760 ?        S    15:34   0:00 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/auth.log
root      8473  0.0  0.0  11288   916 pts/11   S+   15:36   0:00 grep --colour=auto sshguard
___

It is blocking IP Adresses that are not whitelisted:
___

Nov  8 15:39:33 alpha sshd[8525]: error: PAM: Authentication failure for needle from 192.0.2.10
Nov  8 15:39:33 alpha sshguard[8427]: Attack from "192.0.2.10" on service 100 with danger 10.
Nov  8 15:39:33 alpha sshguard[8427]: Blocking "192.0.2.10/32" forever (1 attacks in 0 secs, after 1 abuses over 0 secs.)

___

iptables output after successful blocking:
___

# sudo iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
sshguard   all  --  0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain sshguard (1 references)
target     prot opt source               destination
DROP       all  --  192.0.2.10           0.0.0.0/0

___

Here the added blacklist IP address:
___

# more /var/lib/sshguard/blacklist 
1510151973|100|4|192.0.2.10
___

Open-rc with its tools rc-status reports the service has "crashed":
___

# /etc/init.d/sshguard status
 * status: crashed
__

It looks to me like a "display error" or a bug with the config files which are shipped with sshguard. Could someone with open-rc experience take a look at this?  Thank you.
Comment 1 needle 2017-11-08 14:57:09 UTC
emerge --info
Portage 2.3.8 (python 2.7.14-final-0, default/linux/amd64/13.0, gcc-5.4.0, glibc-2.25-r8, 4.4.87-gentoo-r1 x86_64)
=================================================================
System uname: Linux-4.4.87-gentoo-r1-x86_64-Intel-R-_Core-TM-_i5-4278U_CPU_@_2.60GHz-with-gentoo-2.4.1
KiB Mem:     8135396 total,    486776 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of repository gentoo: Wed, 08 Nov 2017 01:30:01 +0000
Head commit of repository gentoo: 988a4482ed5f7d16172e8775423c9d9d5e958032
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.28.1 p1.0) 2.28.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.3::gentoo
dev-lang/python:          2.7.14::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.8.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.32.1::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.28.1::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r8::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

needless
    location: /usr/local/portage
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg candy collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer multilib-strict news nodoc parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="7zip X aac acpi alsa amd64 apm asm bash-completion berkdb bonobo bzip2 cairo cddb cjk cli cpudetection cracklib crypt cue cups curl custom-flags cxx dga directfb diskio dri drm egl eglfs encode expat faad fbcon fish-completion flac fontforge fortran fuse gallium gdbm gif glamor gpm gtk gtk2 gtkstyle hscolour iconv imagemagick ipv6 jpeg jpeg2k lame laptop libcaca libclamav libgda libmms libnotify libsamplerate libsndfile lm_sensors logrotate lua lzo mad mbox modpack modules mp3 mpeg mplayer multilib musepack museplug ncurses noamazon nptl nsplugin nspluginwrapper ogg oggvorbis opengl openmp openssl pam pango pcre pdf png python3 qemu qt5 readline savedconfig schroedinger screen seccomp sensord session sox sql sqlite sqlite3 ssl svg tcpd tga threads tiff truetype udev unicode vaapi vim-syntax vorbis wavpack wifi xattr xcomposite xft xml xorg zip zlib zsh-completion" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="synaptics evdev" KERNEL="linux" L10N="de en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 needle 2017-11-08 15:01:19 UTC
Created attachment 503102 [details]
/etc/sshguard.conf

sshguard.conf file
Comment 3 needle 2017-11-08 15:02:08 UTC
Created attachment 503104 [details]
/etc/conf.d/sshguard

/etc/conf.d/sshguard file
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2017-11-09 11:38:27 UTC
It's writing the wrong PID to /var/run/sshguard.pid, it seems:

wim ~ # cat /var/run/sshguard.pid
239925
wim ~ # pgrep -lfa sshg
239922 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/messages
239923 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/messages
239924 /usr/libexec/sshg-parser
239925 /usr/libexec/sshg-blocker -a 30 -i /var/run/sshguard.pid -p 120 -s 1800
239926 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/messages
239928 /bin/sh /usr/libexec/sshg-fw-iptables

/usr/libexec/sshg-blocker writes the PID file, and I guess s-s-d checks the PID of /usr/sbin/sshguard instead.
Comment 5 needle 2018-03-12 14:13:43 UTC
Sorry for the late responce...
I can not reproduce this bug using sshguard-2.1.0-r1 on AMD64
The daemon is running fine without showing "crashed" status.

Putting bug into resolved state.


needle@alpha ~ % /etc/init.d/sshguard status         
 * status: started

needle@alpha ~ % eix -I sshguard
[I] app-admin/sshguard
     Available versions:  1.7.1 (~)2.0.0 (~)2.0.99 (~)2.1.0-r1{tbz2} {ipfilter KERNEL="FreeBSD linux"}
     Installed versions:  2.1.0-r1{tbz2}(03:49:16 02/12/17)
     Homepage:            http://sshguard.sourceforge.net/
     Description:         protects hosts from brute force attacks against ssh

needle@alpha ~ % cat /var/run/sshguard.pid
8238

needle@alpha ~ % pgrep -lfa sshg
8235 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/auth.log
8236 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/auth.log
8237 /usr/libexec/sshg-parser
8238 /usr/libexec/sshg-blocker -a 10 -b 10:/var/lib/sshguard/blacklist -i /var/run/sshguard.pid -p 43200 -s 604800 -N 64 -n 32 -w /etc/sshguard/whitelist
8240 /bin/sh /usr/sbin/sshguard -i /var/run/sshguard.pid -l /var/log/auth.log
8243 /bin/sh /usr/libexec/sshg-fw-iptables