Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-03-29, 09:53:31

Author Topic: sendmail userid usage limits [script v1.1b]  (Read 17097 times)

0 Members and 1 Guest are viewing this topic.

Offline chrisf

  • Senior Master
  • **
  • Posts: 883
  • Karma: +11/-1
  • Gender: Male
  • Be the change that you wish to see in the world.
    • View Profile
    • Conviction's Hosting
sendmail userid usage limits [script v1.1b]
« on: 2014-02-19, 08:41:30 »
This is a update and rewrite of the first script.  Please read:
http://forum.mratwork.com/kloxo-mr-tips-and-tricks/sendmail-userid-usage-limits-(script-v1-0b)/

The idea behind this update is no longer to send the mail piped line by line to the original sendmail.  Malformed email, or an extra carriage return/enter was causing the script to halt and not send.  To overcome this, I use a bash script to check with our database (OK to send mail) and then pipe it directly to the qmail sendmail program.  It gets it unaltered.  If a limit is reached, it simply doesn't pass it to the qmail sendmail.

This also made it faster, and under load, it performs better.  The logging has been changed, and can be either on or off.  It will log the time, working directory of the script which invoked it, user, user id, current count / Max count, and status.

If you already installed v1.0 you do not have to redo the SQL, but the configuration file and all else have changed.  Right before running the new install script, issue this command
Code: [Select]
rm -rf /usr/sbin/sendmailwrapper

Install is
Code: [Select]
cd /tmp
wget http://cc-server1.us/sendmail_wrapper20140219.zip
unzip sendmail_wrapper20140219.zip
./smw_install.sh

Log can be found at: /var/log/sendmail-limits.log and is rotated automatically daily, saving previous 10.

Read the txt file for details BEFORE running the install script, configuration is easy.  Again, report any issues.  This is a must for a shared hosting environment.

Enjoy!
« Last Edit: 2014-02-19, 08:49:33 by chrisf »
Christopher

Knowledge in: PHP, Perl, MySQL, Javascript, Actionscript, FLASH, HTML, CSS
Server Administrator / Developer: https://convictionshosting.com

Offline Spacedust

  • Super Grand Master
  • ****
  • Posts: 4,050
  • Karma: +1/-0
    • View Profile
Re: sendmail userid usage limits [script v1.1b]
« Reply #1 on: 2014-02-19, 22:20:58 »
Works well !!! Kloxo works fine, php scripts works fine. Fantastic job !

Offline vpsbox

  • Junior Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
    • http://www.vpsbox.eu
Re: sendmail userid usage limits [script v1.1b]
« Reply #2 on: 2014-03-02, 15:54:33 »
this is major for everybody from free / payd host to personal vps on which site can be hacked on a user level and accout used as provy for spam... thnx

Offline Hugo

  • Junior Member
  • *
  • Posts: 32
  • Karma: +0/-0
    • View Profile
    • KimeraLive - Tailored Clouds
Re: sendmail userid usage limits [script v1.1b]
« Reply #3 on: 2014-09-18, 17:31:15 »
Hello chrisf, I'm using your script and it works great, mails start to get dropped when the limit is reached and I get the notification e-mail, so thank you alot for this!

I am however not sure how to add users to the groups even after reading the instructions.

Could you provide an example of the configuration as such:

userA should belong to group 1
userB should belong to group 2

how would this look in the config file?

thanks again!

Offline Spacedust

  • Super Grand Master
  • ****
  • Posts: 4,050
  • Karma: +1/-0
    • View Profile
Re: sendmail userid usage limits [script v1.1b]
« Reply #4 on: 2014-09-21, 17:08:34 »
The hourly script stop working when many users send e-mail above limit:

Quote
[root@online stanislawbil]# /usr/sbin/sendmailwrapper/smw_cron_hourly
sendmail: fatal: file /etc/postfix/main.cf: parameter mail_owner: unknown user name value: postfix
Died at /usr/sbin/sendmailwrapper/smw_cron_hourly line 38.

Offline chrisf

  • Senior Master
  • **
  • Posts: 883
  • Karma: +11/-1
  • Gender: Male
  • Be the change that you wish to see in the world.
    • View Profile
    • Conviction's Hosting
Re: sendmail userid usage limits [script v1.1b]
« Reply #5 on: 2014-09-22, 18:03:11 »
@Asciiker - a new version will be released in a few weeks, a command line tool simplifies configuration.

@Spacedust, how many overages does it take?  I've had 80.  That line where it is exiting is for sending the email.  In the new version I have rewrote the send routines and will have you test to let me know.
Christopher

Knowledge in: PHP, Perl, MySQL, Javascript, Actionscript, FLASH, HTML, CSS
Server Administrator / Developer: https://convictionshosting.com

Offline Spacedust

  • Super Grand Master
  • ****
  • Posts: 4,050
  • Karma: +1/-0
    • View Profile
Re: sendmail userid usage limits [script v1.1b]
« Reply #6 on: 2015-03-22, 17:37:18 »
Links are down. Please bring them back !

Offline Spacedust

  • Super Grand Master
  • ****
  • Posts: 4,050
  • Karma: +1/-0
    • View Profile
Re: sendmail userid usage limits [script v1.1b]
« Reply #7 on: 2015-07-30, 19:57:40 »
Bring it back !!!

Offline Spacedust

  • Super Grand Master
  • ****
  • Posts: 4,050
  • Karma: +1/-0
    • View Profile
Re: sendmail userid usage limits [script v1.1b]
« Reply #8 on: 2015-09-19, 11:44:37 »
These messages are looking wrong:

X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on xxx.pl X-Spam-Level:  X-Spam-Status: No, score=-0.0 required=5.0 tests=NO_RELAYS    autolearn=unavailable autolearn_force=no version=3.4.0 Delivered-To: xxx.pl-admin@xxx.pl Received: (qmail 18465 invoked by uid 0); 19 Sep 2015 08:00:01 -0000 Date: 19 Sep 2015 08:00:01 -0000 Message-ID: <20150919080001.18464.qmail@xxx.pl> From: root@xxx.pl Subject: Mail limit report To: admin@xxx.pl  The following clients have violated sender limits: (Hourly ~ groups 1 and 2)  1:gatek89:7812 (720/100) - 2015-09-19 09:56:23

Offline noob

  • Valuable Member
  • *
  • Posts: 98
  • Karma: +0/-0
  • Gender: Male
    • View Profile
    • KombatHost
Re: sendmail userid usage limits [script v1.1b]
« Reply #9 on: 2015-10-05, 05:59:55 »
hello, it's 25 an hour or for 1 day?
is count in tables client_sendmail will reset for 1 hour or not?

because my client with > 25 cannot send email anymore before i reset count to 0

thanks
http://kombathost.com | Your ultimate webhosting

Offline noob

  • Valuable Member
  • *
  • Posts: 98
  • Karma: +0/-0
  • Gender: Male
    • View Profile
    • KombatHost
Re: sendmail userid usage limits [script v1.1b]
« Reply #10 on: 2015-10-05, 06:22:48 »
my bad, i not set cron :D

thanks @chrisf for the great script
http://kombathost.com | Your ultimate webhosting

Offline Spacedust

  • Super Grand Master
  • ****
  • Posts: 4,050
  • Karma: +1/-0
    • View Profile
Re: sendmail userid usage limits [script v1.1b]
« Reply #11 on: 2015-10-07, 20:06:06 »
chrisf can you add message body to these reports ?

Offline noob

  • Valuable Member
  • *
  • Posts: 98
  • Karma: +0/-0
  • Gender: Male
    • View Profile
    • KombatHost
Re: sendmail userid usage limits [script v1.1b]
« Reply #12 on: 2015-11-28, 15:14:41 »
uhm... sorry for bother you guys.
but, i install the script at leaseweb cloud vps, and i got error (in folder /tmp):
Code: [Select]
-bash: ./smw_install.sh: Permission denied

can't you help me. please :D
http://kombathost.com | Your ultimate webhosting

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: sendmail userid usage limits [script v1.1b]
« Reply #13 on: 2015-11-28, 15:58:39 »
Permission of 'smw_install.sh' muat 755 or run with 'sh ./smw_install.sh'.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline noob

  • Valuable Member
  • *
  • Posts: 98
  • Karma: +0/-0
  • Gender: Male
    • View Profile
    • KombatHost
Re: sendmail userid usage limits [script v1.1b]
« Reply #14 on: 2015-11-28, 16:34:53 »
Permission of 'smw_install.sh' muat 755 or run with 'sh ./smw_install.sh'.

works! thanks
http://kombathost.com | Your ultimate webhosting

 


Top 10 Social Networking:    Facebook    Twitter    LinkedIn    Pinterest    Google Plus    Tumblr    Instagram    VK    Flickr    Vine

Page created in 0.077 seconds with 18 queries.

web stats analysis