MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Bugs and Requests => Topic started by: Spacedust on 2015-04-18, 22:12:47

Title: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: Spacedust on 2015-04-18, 22:12:47
I've even runned /script/cleanup and nothing. Are you sure they were uploaded ?
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: MRatWork on 2015-04-18, 22:23:04
File is /var/qmail/bin/sendmail-wrapper and exists in all my servers.
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: Spacedust on 2015-04-18, 22:40:23
File is /var/qmail/bin/sendmail-wrapper and exists in all my servers.

I mean /var/qmail/bin/sendmail-limiter*
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: MRatWork on 2015-04-19, 08:23:41
Taken from /usr/local/lxlabs/kloxo/file/qmail/bin
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: Spacedust on 2015-04-19, 16:06:11
Which file starts smw_limiter ?
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: MRatWork on 2015-04-19, 16:09:51
See /usr/local/lxlabs/kloxo/file/qmail/var/qmail/bin/sendmail-wrapper for using sendmail-limiter.
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: Spacedust on 2015-04-20, 14:20:14
It's not working at all :(

Again 2500 spam e-mails in queue. Investigating and restoring my version.

It's not proper file !

Quote
cat /var/qmail/bin/sendmail-wrapper
#!/bin/sh

## MR -- listing of the document root of website to banned
file="/var/qmail/control/badsendmailfrom"

banned="no"
pwded=$(pwd)

if [ -f $file ] ; then
        for i in $(cat $file|tr '\' ' ') ; do
                ## choose /home/admin also ban for subdirs
                if [[ "${pwded}" =~ "${i}" ]] ; then
                        banned="yes"
                fi
        done
fi

## MR -- save to log for sendmail info
/bin/logger -p mail.info "sendmail: CALLER=\"$(ps -ocommand= -p $PPID|tr '\n' ' '|tr -s ' '|sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')\" PWD=\"${pwded}\" BAN=\"${banned}\""

if [ "${banned}" == "no" ] ; then
        /var/qmail/bin/sendmail-qmail "$@"
fi

Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: MRatWork on 2015-04-20, 15:03:26
SO give me your version and also their sql.
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: Spacedust on 2015-04-20, 15:55:27
Sure. I'm probably the only one who was having this up and running well. Chrisf is gone forever (his hosting company is gone too).

Sendmail is symlinked to our special send_mail version:

Quote
ls -l /usr/sbin | grep sendmail
lrwxrwxrwx  1 root root       35 Apr 20 15:34 sendmail -> /usr/sbin/sendmailwrapper/send_mail
-rwxr-xr-x  1 root root     209K Feb 20  2014 sendmail.postfix
drwxr-xr-x  2 root root     4.0K Apr 17 23:07 sendmailwrapper

sendmailwrapper is a directory with our special files:

Quote
ls -l /usr/sbin/sendmailwrapper/
total 20K
-rwxr-xr-x 1 root root    0 Apr 20 15:51 send_mail
-rwxr-xr-x 1 root root  719 Apr 17 23:07 smw_config.pl
-rwx------ 1 root root 1.5K Feb 19  2014 smw_cron_12hour
-rwx------ 1 root root 1.5K Feb 19  2014 smw_cron_24hour
-rwx------ 1 root root 1.5K Feb 19  2014 smw_cron_hourly
-rwxr-xr-x 1 root root 1.6K Feb 19  2014 smw_limiter

Qmail is having just normal sendmail binary file:

Quote
ls -l /var/qmail/bin | grep sendmail
-rwxr-xr-x 1 root   root   14K Mar 10  2014 sendmail

Then you just need to add the database attached (remove my users out there) and set it properly in this file:

Quote
cat smw_config.pl
#!/usr/bin/perl

### --CONFIGURATION

# DB information
$db_name='DBI:mysql:sendmailwrapper:localhost:3306';
$db_uid='sendmailwrapper';
$db_pwd='password';

### deliver report from cron about usage violations
# 0 = no reports sent
# 1 = reporting on, be sure to set report_email
$send_reports = 1;
$report_email = 'your@e-mail.com';

### 1 = disable all logging of sendmail
$log_disabled = 0;

### production mode
# 0  = bypass limiting
# 1+ = limiting per uid on
$limiter=1;

$logfile="/var/log/sendmail-limits.log";

### per hour group limits
# please read sendmail-chrisf.txt for description
# all users default to group one (1)

@sm_max = (100, 0,  500,  1500, 4500, 8000 );

# chrisf sendmail-wrapper v1.1b
1;

I'm using two groups:

- first 100 e-mails per hour (default)
- second 0 e-mails per hour (hacked customers)

See the database for more details (just change 1 to 2 to ban user).

Also some cron jobs to reset counters:

Quote
0 * * * * /usr/sbin/sendmailwrapper/smw_cron_hourly
0 0,12 * * * /usr/sbin/sendmailwrapper/smw_cron_12hour
0 0 * * * /usr/sbin/sendmailwrapper/smw_cron_24hour
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: MRatWork on 2015-04-20, 16:11:51
What's different things between your code and Kloxo-MR code related to sendmail limiter (except their file names)?.
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: Spacedust on 2015-04-20, 16:37:55
Here's my code

Quote
lrwxrwxrwx  1 root root       35 Apr 20 19:13 sendmail -> /usr/sbin/sendmailwrapper/send_mail

Quote
#!/bin/bash

CWD=$PWD

cd /usr/sbin/sendmailwrapper
if ./smw_limiter $CWD
then
../../../var/qmail/bin/sendmail $*
fi

#eof
Title: Re: /var/qmail/bin/sendmailwrapper* files does not exist
Post by: Spacedust on 2015-04-21, 15:03:26
I told you to remove my customers from the default list ;)

https://github.com/mustafaramadhan/kloxo/commit/03bfe091770f33ed85eed8b705c9847aabb522bf