DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 30th June 2017
Valus Valus is offline
Port Guard
 
Join Date: Feb 2015
Location: EU
Posts: 22
Default Spampd, clamsmtpd do not start after reboot

Hi all,
I have problem starting automaticaly spampd, clamsmtpd after reboot. I have to always start them manualy after each reboot(upgrade).
Code:
# /etc/rc.d/spampd start
# /usr/local/sbin/clamsmtpd -f /etc/clamsmtpd-in.conf
# /usr/local/sbin/clamsmtpd -f /etc/clamsmtpd-out.conf
Version of my OpenBSD:
Code:
bash-4.4$ dmesg | head -10
OpenBSD 6.1 (GENERIC) #10: Tue Jun 27 08:46:05 CEST 2017
    robert@syspatch-61-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
real mem = 520081408 (495MB)
avail mem = 499773440 (476MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0x1ffffec0 (10 entries)
bios0: vendor Seabios version "0.5.1" date 01/01/2007
bios0: Red Hat KVM
This should start spampd, clamsmtpd automatically after reboot:
Code:
bash-4.4$ more /etc/rc.conf.local
ntpd_flags=""
pkg_scripts=php56_fpm dovecot clamd
httpd_flags=""
spamd_flags="-v"
smtpd_flags=""
pf=YES
spampd_flags="--port=10035 --relayhost=127.0.0.1:10036 --tagall -aw"

bash-4.4$ more /etc/rc.local
/usr/local/sbin/clamsmtpd -f /etc/clamsmtpd-in.conf
/usr/local/sbin/clamsmtpd -f /etc/clamsmtpd-out.conf
Other relevant configs:
Code:
bash-4.4$ more /etc/clamsmtpd-in.conf
OutAddress: 10026
Listen: 0.0.0.0:10025
ClamAddress: 127.0.0.1:3310

bash-4.4$ more /etc/clamsmtpd-out.conf
OutAddress: 10028
Listen: 0.0.0.0:10027
ClamAddress: 127.0.0.1:3310

more /etc/mail/smtpd.conf
pki lietat.eu certificate "/etc/ssl/my.com.crt"
pki lietat.eu key "/etc/ssl/private/my.dom.key"
listen on lo0
listen on lo0 port 10026 tag CLAM_IN # incoming mail
listen on lo0 port 10028 tag CLAM_OUT # outgoing mail
listen on lo0 port 10036 tag SPAM_IN # incoming mail
listen on egress tls pki my.dom auth-optional
listen on egress port submission tls-require pki my.dom auth
table aliases db:/etc/mail/aliases.db
table vusers file:/etc/mail/vusers
table vdomains file:/etc/mail/vdomains
#table recipients file:/etc/mail/recipients
# Uncomment the following to accept external mail for domain "example.org"
#
# accept from any for domain "example.org" alias <aliases> deliver to mbox
accept for local alias <aliases> deliver to mbox
# tagged mail returned from spampd deliver to lmtp
accept tagged SPAM_IN for domain <vdomains> virtual <vusers> deliver to lmtp "/var/dovecot/lmtp"
# tagged mail returned from clamsmtpd either send to spampd or relay
accept tagged CLAM_IN for any relay via smtp://127.0.0.1:10035 # send to spampd
accept tagged CLAM_OUT for any relay
# start here - untagged mail is sent to clamsmtpd
accept from any for domain <vdomains> relay via smtp://127.0.0.1:10025 # incoming mail
accept from local for any relay via smtp://127.0.0.1:10027 # outgoing mail
Could anybody find what is wrong, please?
Thanks.
Reply With Quote
  #2   (View Single Post)  
Old 30th June 2017
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 304
Default

For spampd, you don't actually have it enabled to start.

man rcctl

You can use rcctl to enable/disable and check the flags for a deamon. That said, I have had problems with spampd starting automatically. It won't pick up the flags and runs with default values. If I start it with rcctl myself, it works. I haven't looked into it again since reboots aren't that frequent.

I don't run clamsmtpd so I am not sure if it has an rc script or not to leverage.
Reply With Quote
  #3   (View Single Post)  
Old 1st July 2017
Valus Valus is offline
Port Guard
 
Join Date: Feb 2015
Location: EU
Posts: 22
Default

Quote:
Originally Posted by TronDD View Post
For spampd, you don't actually have it enabled to start.

man rcctl

You can use rcctl to enable/disable and check the flags for a deamon. That said, I have had problems with spampd starting automatically. It won't pick up the flags and runs with default values. If I start it with rcctl myself, it works. I haven't looked into it again since reboots aren't that frequent.

I don't run clamsmtpd so I am not sure if it has an rc script or not to leverage.
Thanks for the hint. I enabled spampd with rcctl
Code:
bash-4.4# rcctl get spampd
spampd_class=daemon
spampd_flags=NO
spampd_rtable=0
spampd_timeout=30
spampd_user=root
bash-4.4# rcctl set spampd status on
bash-4.4# rcctl set spampd flags --port=10035 --relayhost=127.0.0.1:10036 --tagall -aw
bash-4.4# rcctl get spampd
spampd_class=daemon
spampd_flags=--port=10035 --relayhost=127.0.0.1:10036 --tagall -aw
spampd_rtable=0
spampd_timeout=30
spampd_user=root
bash-4.4# more /etc/rc.conf.local
httpd_flags=""
ntpd_flags=""
pf=YES
pkg_scripts=php56_fpm dovecot clamd spampd
smtpd_flags=""
spamd_flags="-v"
spampd_flags=--port=10035 --relayhost=127.0.0.1:10036 --tagall -aw
but after reboot it failed again to start
Code:
bash-4.4# rcctl ls failed
spampd
bash-4.4# /etc/rc.d/spampd check
spampd(failed)
bash-4.4# /etc/rc.d/spampd start
spampd(ok)
so I have to start it manually again and checked /var/log/maillog, there was some problem with spampd.pid. I thought it was caused by not stopping spampd before reboot.
Code:
Jun 29 07:49:38 serv2sp spampd[83681]: 2017/06/29-07:49:36 Server closing!
Jun 29 07:49:38 serv2sp spampd[83681]: Couldn't unlink "/var/run/spampd.pid" [Permission denied]
Jun 29 07:50:22 serv2sp dovecot: master: Warning: Killed with signal 15 (by pid=0 uid=0 code=kill)
Jun 29 07:51:19 serv2sp smtpd[31401]: info: OpenSMTPD 6.0.0 starting
Jun 29 07:51:20 serv2sp dovecot: master: Dovecot v2.2.28 (bed8434) starting up for imap, pop3, lmtp, sieve
Jun 29 08:08:05 serv2sp spampd[424]: Process Backgrounded
Jun 29 08:08:05 serv2sp spampd[424]: 2017/06/29-08:08:05 SpamPD (type Net::Server::PreForkSimple) starting! pid(424)
Jun 29 08:08:05 serv2sp spampd[424]: Binding to TCP port 10035 on host 127.0.0.1 with IPv4
Jun 29 08:08:05 serv2sp spampd[424]: Setting gid to "746 746"
Jun 29 08:08:05 serv2sp spampd[424]: Setting uid to "746"
Jun 29 08:08:09 serv2sp spampd[424]: Received a SIG HUP
Jun 29 08:08:09 serv2sp spampd[424]: 2017/06/29-08:08:09 Server closing!
Jun 29 08:08:09 serv2sp spampd[424]: 2017/06/29-08:08:09 Re-exec server during HUP
Jun 29 08:08:13 serv2sp spampd[424]: Pid_file created by this same process. Doing nothing.
Jun 29 08:08:13 serv2sp spampd[424]: Pid_file created by this same process. Doing nothing.
Jun 29 08:08:13 serv2sp spampd[424]: 2017/06/29-08:08:13 SpamPD (type Net::Server::PreForkSimple) starting! pid(424)
Jun 29 08:08:13 serv2sp spampd[424]: Binding open file descriptors
Jun 29 08:08:13 serv2sp spampd[424]: Binding to TCP port 10025 on host 127.0.0.1 with IPv4
Jun 29 08:08:13 serv2sp spampd[424]: Added new port configuration
Jun 29 08:08:13 serv2sp spampd[424]: 2017/06/29-08:08:13 Can't connect to TCP port 10025 on 127.0.0.1 [Address already in use]   at line 68 in file /usr/local/libdata/perl5/site_perl/Net/Server/Proto/TCP.pm
Jun 29 08:08:13 serv2sp spampd[424]: 2017/06/29-08:08:13 Server closing!
Jun 29 08:08:13 serv2sp spampd[424]: Couldn't unlink "/var/run/spampd.pid" [Permission denied]
Jun 29 08:13:43 serv2sp spampd[48908]: Pid_file "/var/run/spampd.pid" already exists.  Overwriting!
Jun 29 08:13:43 serv2sp spampd[71987]: Process Backgrounded
Jun 29 08:13:43 serv2sp spampd[71987]: 2017/06/29-08:13:43 SpamPD (type Net::Server::PreForkSimple) starting! pid(71987)
Jun 29 08:13:43 serv2sp spampd[71987]: Binding to TCP port 10035 on host 127.0.0.1 with IPv4
Jun 29 08:13:43 serv2sp spampd[71987]: Setting gid to "746 746"
Jun 29 08:13:43 serv2sp spampd[71987]: Setting uid to "746"
I just did another reboot, but after reboot at 08:25 it was the same.
Code:
bash-4.4# rcctl ls failed
spampd
It takes a long time to start clamd and after that at 08:47 here are some info in maillog about spampd.
Code:
Jun 29 08:25:05 serv2sp spampd[71987]: 2017/06/29-08:25:05 Server closing!
Jun 29 08:25:05 serv2sp spampd[71987]: Couldn't unlink "/var/run/spampd.pid" [Permission denied]
Jun 29 08:25:37 serv2sp dovecot: master: Warning: Killed with signal 15 (by pid=0 uid=0 code=kill)
Jun 29 08:26:33 serv2sp smtpd[44988]: info: OpenSMTPD 6.0.0 starting
Jun 29 08:26:36 serv2sp dovecot: master: Dovecot v2.2.28 (bed8434) starting up for imap, pop3, lmtp, sieve
Jun 29 08:47:56 serv2sp spampd[8588]: Process Backgrounded
Jun 29 08:47:56 serv2sp spampd[8588]: 2017/06/29-08:47:56 SpamPD (type Net::Server::PreForkSimple) starting! pid(8588)
Jun 29 08:47:56 serv2sp spampd[8588]: Binding to TCP port 10035 on host 127.0.0.1 with IPv4
Jun 29 08:47:56 serv2sp spampd[8588]: Setting gid to "746 746"
Jun 29 08:47:56 serv2sp spampd[8588]: Setting uid to "746"
Jun 29 08:47:58 serv2sp spampd[8588]: Received a SIG HUP
Jun 29 08:47:58 serv2sp spampd[8588]: 2017/06/29-08:47:58 Server closing!
Jun 29 08:47:58 serv2sp spampd[8588]: 2017/06/29-08:47:58 Re-exec server during HUP
Jun 29 08:48:01 serv2sp spampd[8588]: Pid_file created by this same process. Doing nothing.
Jun 29 08:48:01 serv2sp spampd[8588]: Pid_file created by this same process. Doing nothing.
Jun 29 08:48:01 serv2sp spampd[8588]: 2017/06/29-08:48:01 SpamPD (type Net::Server::PreForkSimple) starting! pid(8588)
Jun 29 08:48:01 serv2sp spampd[8588]: Binding open file descriptors
Jun 29 08:48:01 serv2sp spampd[8588]: Binding to TCP port 10025 on host 127.0.0.1 with IPv4
Jun 29 08:48:01 serv2sp spampd[8588]: Added new port configuration
Jun 29 08:48:01 serv2sp spampd[8588]: 2017/06/29-08:48:01 Can't connect to TCP port 10025 on 127.0.0.1 [Address already in use]   at line 68 in file /usr/local/libdata/perl5/site_perl/Net/Server/Proto/TCP.pm
Jun 29 08:48:01 serv2sp spampd[8588]: 2017/06/29-08:48:01 Server closing!
Jun 29 08:48:01 serv2sp spampd[8588]: Couldn't unlink "/var/run/spampd.pid" [Permission denied]
I started spampd manually at 09:06
Code:
bash-4.4# /etc/rc.d/spampd check
spampd(failed)
bash-4.4# /etc/rc.d/spampd start
spampd(ok)
bash-4.4# /etc/rc.d/spampd check
spampd(ok)

Jun 29 09:06:00 serv2sp spampd[25298]: Pid_file "/var/run/spampd.pid" already exists.  Overwriting!
Jun 29 09:06:00 serv2sp spampd[79886]: Process Backgrounded
Jun 29 09:06:00 serv2sp spampd[79886]: 2017/06/29-09:06:00 SpamPD (type Net::Server::PreForkSimple) starting! pid(79886)
Jun 29 09:06:00 serv2sp spampd[79886]: Binding to TCP port 10035 on host 127.0.0.1 with IPv4
Jun 29 09:06:00 serv2sp spampd[79886]: Setting gid to "746 746"
Jun 29 09:06:00 serv2sp spampd[79886]: Setting uid to "746"
I changed order to first start spampd and then clamd
Code:
bash-4.4# more /etc/rc.conf.local
httpd_flags=""
ntpd_flags=""
pf=YES
pkg_scripts=php56_fpm dovecot spampd clamd
smtpd_flags=""
spamd_flags="-v"
spampd_flags=--port=10035 --relayhost=127.0.0.1:10036 --tagall -aw
and I did again reboot at 09:13 and spampd started. Failed is only cron it probably waits to start clamd
Code:
bash-4.4# rcctl ls failed
cron
bash-4.4$ tail -f /var/log/maillog
Jun 29 09:13:37 serv2sp spampd[79886]: 2017/06/29-09:13:37 Server closing!
Jun 29 09:13:38 serv2sp spampd[79886]: Couldn't unlink "/var/run/spampd.pid" [Permission denied]
Jun 29 09:13:39 serv2sp dovecot: master: Warning: Killed with signal 15 (by pid=0 uid=0 code=kill)
Jun 29 09:14:32 serv2sp smtpd[1704]: info: OpenSMTPD 6.0.0 starting
Jun 29 09:14:34 serv2sp dovecot: master: Dovecot v2.2.28 (bed8434) starting up for imap, pop3, lmtp, sieve
Jun 29 09:14:39 serv2sp spampd[78329]: Process Backgrounded
Jun 29 09:14:39 serv2sp spampd[78329]: 2017/06/29-09:14:39 SpamPD (type Net::Server::PreForkSimple) starting! pid(78329)
Jun 29 09:14:39 serv2sp spampd[78329]: Binding to TCP port 10035 on host 127.0.0.1 with IPv4
Jun 29 09:14:39 serv2sp spampd[78329]: Setting gid to "746 746"
Jun 29 09:14:39 serv2sp spampd[78329]: Setting uid to "746"

bash-4.4# ps aux | grep 78329
root      6533  0.0  0.2   304  1136 p2  S+p    9:20AM    0:00.00 grep 78329
_spampd  78329  0.0  0.4 75004  1880 C0  S+     9:14AM    0:00.12 /usr/bin/perl -T /usr/local/sbin/spampd
Later on spampd failed again and clamsmtpd are running
Code:
bash-4.4# ps aux | grep clamsmtpd
root     34584  0.0  0.2   328   796 ??  Ss     9:31AM    0:00.00 /usr/local/sbin/clamsmtpd -f /etc/clamsm
root     89058  0.0  0.2   332   812 ??  Ss     9:31AM    0:00.00 /usr/local/sbin/clamsmtpd -f /etc/clamsm
bash-4.4# rcctl ls failed
spampd
Jun 29 09:31:49 serv2sp spampd[78329]: Received a SIG HUP
Jun 29 09:31:50 serv2sp spampd[78329]: 2017/06/29-09:31:50 Server closing!
Jun 29 09:31:50 serv2sp spampd[78329]: 2017/06/29-09:31:50 Re-exec server during HUP
Jun 29 09:31:55 serv2sp spampd[78329]: Pid_file created by this same process. Doing nothing.
Jun 29 09:31:55 serv2sp spampd[78329]: Pid_file created by this same process. Doing nothing.
Jun 29 09:31:55 serv2sp spampd[78329]: 2017/06/29-09:31:55 SpamPD (type Net::Server::PreForkSimple) starting! pid(78329)
Jun 29 09:31:55 serv2sp spampd[78329]: Binding open file descriptors
Jun 29 09:31:55 serv2sp spampd[78329]: Binding to TCP port 10025 on host 127.0.0.1 with IPv4
Jun 29 09:31:55 serv2sp spampd[78329]: Added new port configuration
Jun 29 09:31:55 serv2sp spampd[78329]: 2017/06/29-09:31:55 Can't connect to TCP port 10025 on 127.0.0.1 [Address already in use]   at line 68 in file /usr/local/libdata/perl5/site_perl/Net/Server/Proto/TCP.pm
Jun 29 09:31:55 serv2sp spampd[78329]: 2017/06/29-09:31:55 Server closing!
Jun 29 09:31:55 serv2sp spampd[78329]: Couldn't unlink "/var/run/spampd.pid" [Permission denied]
I have to still start spampd manually
Code:
bash-4.4# /etc/rc.d/spampd check
spampd(failed)
bash-4.4# /etc/rc.d/spampd start
spampd(ok)
bash-4.4# /etc/rc.d/spampd check
spampd(ok)
bash-4.4# rcctl ls failed

Jun 29 09:31:55 serv2sp spampd[78329]: Couldn't unlink "/var/run/spampd.pid" [Permission denied]
Jun 29 09:35:57 serv2sp spampd[32720]: Pid_file "/var/run/spampd.pid" already exists.  Overwriting!
Jun 29 09:35:57 serv2sp spampd[40560]: Process Backgrounded
Jun 29 09:35:57 serv2sp spampd[40560]: 2017/06/29-09:35:57 SpamPD (type Net::Server::PreForkSimple) starting! pid(40560)
Jun 29 09:35:57 serv2sp spampd[40560]: Binding to TCP port 10035 on host 127.0.0.1 with IPv4
Jun 29 09:35:57 serv2sp spampd[40560]: Setting gid to "746 746"
Jun 29 09:35:57 serv2sp spampd[40560]: Setting uid to "746"
Reply With Quote
  #4   (View Single Post)  
Old 1st July 2017
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 304
Default

It's doing the same thing that it does to me. I didn't notice in my logs, but you can see what's happening in yours.

Spampd starts up but recieves a SIGHUP from somewhere causing it to sort of restart itself, only now it is using the defaults and none of your arguments.

I don't know where the SIGHUP comes from...
Reply With Quote
  #5   (View Single Post)  
Old 1st July 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

I am using spampd and also have the signal issue. It was discussed (without a final resolution) in 2014 on the ports@ mailing list.

http://marc.info/?t=138936280900001&r=1&w=2
Reply With Quote
  #6   (View Single Post)  
Old 2nd July 2017
Valus Valus is offline
Port Guard
 
Join Date: Feb 2015
Location: EU
Posts: 22
Default

I will probably create script which will check after reboot within cca 30 minutes if spampd is running, if not it will start it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
php_fpm and clamd fails to start after reboot Valus OpenBSD Packages and Ports 2 26th March 2015 09:55 AM
hello, how BSD reboot but keep memory misssir FreeBSD General 8 11th October 2011 02:43 PM
reboot freebsd periodically semarmendemx FreeBSD General 3 27th October 2010 04:23 AM
Apply TTYS changes with out reboot jjjustjjjay OpenBSD General 1 6th May 2010 09:24 PM
problem to first reboot after installation openbsd OpenBSD Installation and Upgrading 3 16th May 2009 06:30 PM


All times are GMT. The time now is 06:36 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick