3xPr1nc3

rotate ips exim

Nov 20th, 2021 (edited)
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Here's a very easy way
  2.  
  3. create /etc/exim/exim.pl with the following content:
  4.  
  5.  
  6. -----------------------------------
  7.  
  8. use feature qw[state];
  9.  
  10. sub randomhosts {
  11. state $current;
  12.  
  13. my @inet = (
  14. "x.x.x.x:hostname1.domain.com",
  15. "x.x.x.x:hostname2.domain.com",
  16. "x.x.x.x:hostname3.domain.com"
  17. );
  18.  
  19. if ($_[0] eq 'generate') {
  20. shift;
  21. @{$current}{qw[ip host]} = split /:/, $inet[rand @inet];
  22. }
  23.  
  24. return $current->{$_[0]};
  25. }
  26.  
  27.  
  28. -----------------------
  29.  
  30.  
  31. Replace the x.x.x.x with IP and the hostname ( after colon, which will be used as HELO).
  32.  
  33. Now add this to top of your exim.conf
  34.  
  35. perl_startup = do '/etc/exim/exim.pl'
  36.  
  37. Now, under remote_smtp: section append this
  38.  
  39. interface = "${perl{randomhosts}{generate}{ip}}"
  40. helo_data = "${perl{randomhosts}{host}}"
  41.  
  42. That's it. Now emails will randomly go through all the IPs you added to Perl script, and will use the valid HELOs.
  43.  
Advertisement
Add Comment
Please, Sign In to add comment