Linux midolikit.vps 3.10.0-1160.118.1.el7.x86_64 #1 SMP Wed Apr 24 16:01:50 UTC 2024 x86_64
Apache/2
Server IP : 103.97.127.53 & Your IP : 216.73.216.191
Domains :
Cant Read [ /etc/named.conf ]
User : web259
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
etc /
Delete
Unzip
Name
Size
Permission
Date
Action
NetworkManager
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
X11
[ DIR ]
drwxr-xr-x
2018-06-02 11:11
alternatives
[ DIR ]
drwxr-xr-x
2025-05-15 10:01
audisp
[ DIR ]
drwxr-x---
2024-05-02 07:55
audit
[ DIR ]
drwxr-x---
2024-05-02 07:55
bash_completion.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:57
binfmt.d
[ DIR ]
drwxr-xr-x
2023-12-07 14:51
cagefs
[ DIR ]
drwxr-xr-x
2019-04-19 09:15
chkconfig.d
[ DIR ]
drwxr-xr-x
2020-10-13 15:46
cl.selector
[ DIR ]
drwxr-xr-x
2024-05-02 07:59
clamd.d
[ DIR ]
drwxr-xr-x
2018-04-10 18:03
cloud
[ DIR ]
drwxr-xr-x
2024-05-02 11:55
cron.d
[ DIR ]
drwxr-xr-x
2026-08-13 20:56
cron.daily
[ DIR ]
drwxr-xr-x
2026-08-13 20:56
cron.hourly
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
cron.monthly
[ DIR ]
drwxr-xr-x
2014-06-09 22:14
cron.weekly
[ DIR ]
drwxr-xr-x
2014-06-09 22:14
csf
[ DIR ]
drw-------
2025-05-15 16:05
dbus-1
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
default
[ DIR ]
drwxr-xr-x
2024-05-02 07:55
depmod.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:50
dhcp
[ DIR ]
drwxr-x---
2021-06-09 16:09
dovecot
[ DIR ]
drwxr-xr-x
2024-05-02 09:45
dracut.conf.d
[ DIR ]
drwxr-xr-x
2020-09-30 15:57
firewalld
[ DIR ]
drwxr-x---
2024-05-02 07:55
fonts
[ DIR ]
drwxr-xr-x
2019-04-19 09:24
gcrypt
[ DIR ]
drwxr-xr-x
2017-08-02 15:54
gnupg
[ DIR ]
drwxr-xr-x
2018-07-13 13:05
groff
[ DIR ]
drwxr-xr-x
2018-06-02 11:09
grub.d
[ DIR ]
drwx------
2024-05-02 07:51
gss
[ DIR ]
drwxr-xr-x
2022-11-30 19:01
httpd
[ DIR ]
drwxr-xr-x
2018-06-02 11:45
imunify-agent-proxy
[ DIR ]
drwx------
2026-08-26 16:28
imunify360
[ DIR ]
drwxr-xr-x
2019-04-19 09:15
init.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
iproute2
[ DIR ]
drwxr-xr-x
2024-05-02 07:49
kernel
[ DIR ]
drwxr-xr-x
2018-06-02 11:12
krb5.conf.d
[ DIR ]
drwxr-xr-x
2022-11-30 19:01
ld.so.conf.d
[ DIR ]
drwxr-xr-x
2025-05-15 11:09
libnl
[ DIR ]
drwxr-xr-x
2018-06-02 11:08
logrotate.d
[ DIR ]
drwxr-xr-x
2026-08-13 20:56
modprobe.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:55
modules-load.d
[ DIR ]
drwxr-xr-x
2023-12-07 14:51
my.cnf.d
[ DIR ]
drwxr-xr-x
2025-05-15 11:09
named
[ DIR ]
drwxr-x---
2023-10-16 13:26
needrestart
[ DIR ]
drwxr-xr-x
2026-03-10 20:48
nginx
[ DIR ]
drwx--x---
2026-08-07 11:54
openldap
[ DIR ]
drwxr-xr-x
2024-05-02 07:50
opt
[ DIR ]
drwxr-xr-x
2018-04-11 04:59
pam.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:55
pkcs11
[ DIR ]
drwxr-xr-x
2018-06-02 11:08
pki
[ DIR ]
drwxr-xr-x
2018-06-02 11:11
plymouth
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
pm
[ DIR ]
drwxr-xr-x
2018-06-02 11:08
polkit-1
[ DIR ]
drwxr-xr-x
2022-01-25 19:42
popt.d
[ DIR ]
drwxr-xr-x
2014-06-10 04:03
ppp
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
prelink.conf.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
profile.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
python
[ DIR ]
drwxr-xr-x
2024-05-02 07:48
qemu-ga
[ DIR ]
drwxr-xr-x
2024-05-02 07:55
rc.d
[ DIR ]
drwxr-xr-x
2024-05-02 09:49
rc0.d
[ DIR ]
drwxr-xr-x
2020-10-13 15:46
rc1.d
[ DIR ]
drwxr-xr-x
2020-10-13 15:46
rc2.d
[ DIR ]
drwxr-xr-x
2020-10-13 15:46
rc3.d
[ DIR ]
drwxr-xr-x
2020-10-13 15:46
rc4.d
[ DIR ]
drwxr-xr-x
2020-10-13 15:46
rc5.d
[ DIR ]
drwxr-xr-x
2020-10-13 15:46
rc6.d
[ DIR ]
drwxr-xr-x
2020-10-13 15:46
rpm
[ DIR ]
drwxr-xr-x
2024-05-02 07:55
rsyslog.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:55
rwtab.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:55
sasl2
[ DIR ]
drwxr-xr-x
2022-02-24 13:27
scl
[ DIR ]
drwxr-xr-x
2024-05-02 07:50
security
[ DIR ]
drwxr-xr-x
2025-05-15 11:09
selinux
[ DIR ]
drwxr-xr-x
2020-11-16 16:42
skel
[ DIR ]
drwxr-xr-x
2024-05-02 07:47
ssh
[ DIR ]
drwxr-xr-x
2026-06-16 13:28
ssl
[ DIR ]
drwxr-xr-x
2024-05-02 07:48
statetab.d
[ DIR ]
drwxr-xr-x
2020-11-16 16:20
sudoers.d
[ DIR ]
drwxr-x---
2023-01-25 16:36
sysconfig
[ DIR ]
drwxr-xr-x
2026-08-05 10:55
sysctl.d
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
systemd
[ DIR ]
drwxr-xr-x
2024-05-02 07:50
terminfo
[ DIR ]
drwxr-xr-x
2017-09-06 22:08
tmpfiles.d
[ DIR ]
drwxr-xr-x
2023-12-07 14:51
tuned
[ DIR ]
drwxr-xr-x
2024-05-02 07:55
udev
[ DIR ]
drwxr-xr-x
2024-05-02 07:58
virtual
[ DIR ]
drwx--x--x
2026-08-26 17:03
wpa_supplicant
[ DIR ]
drwxr-xr-x
2024-05-02 07:51
xdg
[ DIR ]
drwxr-xr-x
2018-06-02 11:11
xinetd.d
[ DIR ]
drwxr-xr-x
2018-04-11 04:59
yum
[ DIR ]
drwxr-xr-x
2024-05-02 07:50
yum.repos.d
[ DIR ]
drwxr-xr-x
2026-08-13 20:56
.pwd.lock
0
B
-rw-------
2018-06-02 11:10
.updated
163
B
-rw-r--r--
2018-06-02 11:49
DIR_COLORS
4.97
KB
-rw-r--r--
2020-11-16 14:40
DIR_COLORS.256color
5.59
KB
-rw-r--r--
2020-11-16 14:40
DIR_COLORS.lightbgcolor
4.56
KB
-rw-r--r--
2020-11-16 14:40
GREP_COLORS
94
B
-rw-r--r--
2017-03-24 16:39
GeoIP.conf
1.66
KB
-rw-r--r--
2023-06-12 14:00
adjtime
16
B
-rw-r--r--
2018-06-02 11:15
aliases
1.5
KB
-rw-r--r--
2018-06-02 12:28
aliases.db
12
KB
-rw-r--r--
2018-06-02 11:18
anacrontab
541
B
-rw-------
2023-05-16 14:28
asound.conf
55
B
-rw-r--r--
2019-08-08 11:47
bashrc
2.79
KB
-rw-r--r--
2020-04-01 04:29
centos-release
37
B
-rw-r--r--
2020-11-23 15:08
centos-release-upstream
51
B
-rw-r--r--
2020-11-23 15:08
chrony.conf
1018
B
-rw-r--r--
2019-04-19 13:34
chrony.keys
481
B
-rw-r-----
2019-08-08 11:40
cron.deny
15
B
-rw-------
2018-06-02 11:33
crontab
451
B
-rw-r--r--
2014-06-09 22:14
crypttab
0
B
-rw-------
2018-06-02 11:07
csh.cshrc
1.58
KB
-rw-r--r--
2020-04-01 04:29
csh.login
1.08
KB
-rw-r--r--
2020-04-01 04:29
dovecot.conf
1.37
KB
-rw-r--r--
2024-05-02 09:45
dracut.conf
1.25
KB
-rw-r--r--
2020-09-30 15:57
e2fsck.conf
112
B
-rw-r--r--
2020-09-30 13:21
environment
0
B
-rw-r--r--
2020-04-01 04:29
ethertypes
1.29
KB
-rw-r--r--
2018-04-11 02:44
exim.cert
1.95
KB
-rw-------
2017-12-07 23:45
exim.conf
34.99
KB
-rwxr-xr-x
2025-05-15 10:01
exim.conf.orig
34.76
KB
-rwxr-xr-x
2018-06-02 11:42
exim.conf.temp
34.76
KB
-rw-r--r--
2017-11-25 23:18
exim.key
3.2
KB
-rw-------
2017-12-07 23:45
exim.pl
13.26
KB
-rwxr-xr-x
2018-06-02 11:42
exim.pl.temp
13.26
KB
-rw-r--r--
2017-11-05 05:14
exim.strings.conf
2.03
KB
-rwxr-xr-x
2017-12-07 23:45
exim.variables.conf
924
B
-rwxr-xr-x
2017-12-07 23:45
exim.variables.conf.default
924
B
-rwxr-xr-x
2025-05-15 10:01
exports
0
B
-rw-r--r--
2013-06-07 14:31
favicon.png
1.05
KB
-rw-r--r--
2014-03-08 05:48
filesystems
70
B
-rw-r--r--
2020-04-01 04:29
fstab
392
B
-rw-r--r--
2018-06-02 11:40
gai.conf
296
B
-rw-r--r--
2018-06-15 09:14
group
2.29
KB
-rw-r--r--
2026-08-26 21:21
group-
2.29
KB
-rw-r--r--
2026-08-13 20:56
gshadow
1.74
KB
----------
2026-08-26 21:21
gshadow-
1.74
KB
----------
2026-08-13 20:56
host.conf
9
B
-rw-r--r--
2013-06-07 14:31
hostname
14
B
-rw-r--r--
2025-05-15 12:41
hosts
686
B
-rw-r--r--
2026-08-05 09:43
hosts.allow
370
B
-rw-r--r--
2013-06-07 14:31
hosts.deny
460
B
-rw-r--r--
2013-06-07 14:31
hosts.tmp
164
B
-rw-r--r--
2025-05-15 12:41
inittab
511
B
-rw-r--r--
2020-11-16 16:20
inputrc
942
B
-rw-r--r--
2013-06-07 14:31
issue
23
B
-rw-r--r--
2020-11-23 15:08
issue.net
22
B
-rw-r--r--
2020-11-23 15:08
kdump.conf
7.1
KB
-rw-r--r--
2024-05-02 07:55
krb5.conf
646
B
-rw-r--r--
2022-01-13 17:58
ld.so.cache
32.78
KB
-rw-r--r--
2025-05-15 11:15
ld.so.conf
60
B
-rw-r--r--
2024-05-02 08:43
libaudit.conf
191
B
-rw-r-----
2019-03-01 21:11
libuser.conf
2.33
KB
-rw-r--r--
2013-10-12 21:56
locale.conf
17
B
-rw-r--r--
2025-05-15 10:00
localtime
361
B
-rw-r--r--
2024-02-14 15:04
login.defs
1.98
KB
-rw-r--r--
2019-08-06 13:44
logrotate.conf
662
B
-rw-r--r--
2013-07-31 11:46
machine-id
33
B
-r--r--r--
2018-06-02 11:11
magic
111
B
-rw-r--r--
2020-09-30 16:07
mail.rc
1.92
KB
-rw-r--r--
2018-04-11 07:07
makedumpfile.conf.sample
5
KB
-rw-r--r--
2021-06-09 16:09
man_db.conf
5.05
KB
-rw-r--r--
2018-10-30 20:26
mime.types
59.42
KB
-rw-r--r--
2018-06-02 11:45
mke2fs.conf
1.08
KB
-rw-r--r--
2020-09-30 15:58
motd
858
B
-rw-r--r--
2024-05-02 08:39
mtab
0
B
-r--r--r--
2026-08-26 21:07
my.cnf
1.39
KB
-rw-r--r--
2025-11-30 04:19
my.cnf.bk
579
B
-rw-r--r--
2025-05-19 05:33
my.cnf.old
552
B
-rw-r--r--
2025-05-16 03:48
my.cnf.old2
69
B
-rw-r--r--
2025-05-16 05:47
my.cnf.rpmnew
193
B
-rw-r--r--
2022-08-10 10:53
my.cnf.rpmsave.custombuild
46
B
-rw-r--r--
2018-06-02 11:40
named.conf
45.8
KB
-rw-r-----
2026-08-09 13:53
named.iscdlv.key
3.83
KB
-rw-r--r--
2023-10-16 13:26
named.rfc1912.zones
931
B
-rw-r-----
2007-06-21 10:09
named.root.key
1.84
KB
-rw-r--r--
2017-04-13 14:17
netconfig
767
B
-rw-r--r--
2019-08-09 00:35
networks
58
B
-rw-r--r--
2020-11-16 16:20
nsswitch.conf
1.71
KB
-rw-r--r--
2018-06-02 11:11
nsswitch.conf.bak
1.69
KB
-rw-r--r--
2018-04-10 07:54
odbcinst.ini
577
B
-rw-r--r--
2019-08-09 03:11
os-release
393
B
-rw-r--r--
2020-11-23 15:08
passwd
5.88
KB
-rw-r--r--
2026-06-16 10:16
passwd-
5.84
KB
-rw-r--r--
2026-04-18 08:30
printcap
233
B
-rw-r--r--
2013-06-07 14:31
profile
1.78
KB
-rw-r--r--
2020-04-01 04:29
proftpd.conf
2.06
KB
-rw-r--r--
2025-05-15 10:00
proftpd.passwd
14.64
KB
-rw-r-----
2026-08-09 13:53
proftpd.vhosts.conf
0
B
-rw-r--r--
2025-05-15 10:00
projects
180
B
-rw-------
2026-08-07 11:38
projid
96
B
-rw-------
2026-08-07 11:38
protocols
6.39
KB
-rw-r--r--
2020-04-01 04:29
pure-ftpd-dhparams.pem
424
B
-rw-------
2018-06-02 12:28
pure-ftpd.conf
11.18
KB
-rw-r--r--
2024-05-02 09:32
pure-ftpd.pem
12.61
KB
-rw-------
2018-06-02 12:24
pureftpd.pdb
17.7
KB
-rw-------
2026-08-09 13:54
rc.local
472
B
-rwxr-xr-x
2025-05-15 10:01
redhat-release
37
B
-rw-r--r--
2020-11-23 15:08
resolv.conf
150
B
-rw-r--r--
2025-05-15 09:58
rhashrc
523
B
-rw-r--r--
2017-03-20 19:47
rndc.key
76
B
-rw-------
2018-06-02 11:33
rpc
1.6
KB
-rw-r--r--
2012-12-25 03:02
rsyncd.conf
458
B
-rw-r--r--
2022-12-15 16:21
rsyslog.conf
3.16
KB
-rw-r--r--
2022-01-13 19:10
rwtab
1008
B
-rw-r--r--
2020-11-16 16:20
screenrc
6.56
KB
-rw-r--r--
2021-03-09 15:26
securetty
221
B
-rw-------
2020-04-01 04:29
services
654.58
KB
-rw-r--r--
2013-06-07 14:31
sestatus.conf
216
B
-rw-r--r--
2020-04-01 04:04
shadow
13.31
KB
----------
2026-07-24 11:15
shadow-
13.19
KB
----------
2026-04-18 08:30
shells
44
B
-rw-r--r--
2020-04-01 04:29
statetab
212
B
-rw-r--r--
2020-11-16 16:20
subgid
2.06
KB
-rw-r--r--
2026-06-16 10:16
subgid-
2.03
KB
-rw-r--r--
2026-04-18 08:30
subuid
2.06
KB
-rw-r--r--
2026-06-16 10:16
subuid-
2.03
KB
-rw-r--r--
2026-04-18 08:30
sudo-ldap.conf
3.11
KB
-rw-r-----
2022-01-07 16:57
sudo.conf
1.74
KB
-rw-r-----
2022-01-07 16:57
sudoers
4
KB
-r--r-----
2025-05-16 05:32
sysctl.conf
449
B
-rw-r--r--
2020-11-16 16:20
system-release
37
B
-rw-r--r--
2020-11-23 15:08
system-release-cpe
23
B
-rw-r--r--
2020-11-23 15:08
system_filter.exim
12.48
KB
-rw-r--r--
2017-12-07 23:45
trusted-key.key
750
B
-rw-r--r--
2023-10-16 13:26
vconsole.conf
37
B
-rw-r--r--
2018-06-02 11:15
virc
1.94
KB
-rw-r--r--
2020-12-15 16:44
wgetrc
4.37
KB
-rw-r--r--
2019-05-15 21:01
yum.conf
1.04
KB
-rw-r--r--
2018-06-02 11:33
Save
Rename
#!/usr/bin/perl #VERSION=16 sub get_domain_owner { my ($domain) = @_; my $username=""; open(DOMAINOWNERS,"/etc/virtual/domainowners"); while (<DOMAINOWNERS>) { $_ =~ s/\n//; my ($dmn,$usr) = split(/: /, $_); if ($dmn eq $domain) { close(DOMAINOWNERS); return $usr; } } close(DOMAINOWNERS); return -1; } sub safe_name { my ($name) = @_; if ($name =~ /\//) { return 0; } if ($name =~ /\\/) { return 0; } if ($name =~ /\|/) { return 0; } if ($name =~ /\.\./) { return 0; } return 1; } # hit_limit_user # checks to see if a username has hit the send limit. # returns: # -1 for "there is no limit" # 0 for "still under the limit" # 1 for "at the limit" # 2 for "over the limit" sub hit_limit_user { my($username) = @_; my $count = 0; my $email_limit = 0; if (!safe_name($username)) { return 2; } if (open (LIMIT, "/etc/virtual/limit_$username")) { $email_limit = int(<LIMIT>); close(LIMIT); } else { open (LIMIT, "/etc/virtual/limit"); $email_limit = int(<LIMIT>); close(LIMIT); } if ($email_limit > 0) { #check this users limit $count = (stat("/etc/virtual/usage/$username"))[7]; #this is their last email. if ($count == $email_limit) { return 1; } if ($count > $email_limit) { return 2; } return 0; } return -1; } # hit_limit_email # same idea as hit_limit_user, except we check the limits (if any) for per-email accounts. sub hit_limit_email { my($user,$domain) = @_; if (!safe_name($user) || !safe_name($domain)) { return 2; } my $user_email_limit = 0; if (open (LIMIT, "/etc/virtual/$domain/limit/$user")) { $user_email_limit = int(<LIMIT>); close(LIMIT); } else { if (open (LIMIT, "/etc/virtual/user_limit")) { $user_email_limit = int(<LIMIT>); close(LIMIT); } } if ($user_email_limit > 0) { my $count = 0; $count = (stat("/etc/virtual/$domain/usage/$user"))[7]; if ($count == $user_email_limit) { return 1; } if ($count > $user_email_limit) { return 2; } return 0; } return -1; } #smtpauth #called by exim to verify if an smtp user is allowed to #send email through the server #possible success: # user is in /etc/virtual/domain.com/passwd and password matches # user is in /etc/passwd and password matches in /etc/shadow sub smtpauth { $username = Exim::expand_string('$1'); $password = Exim::expand_string('$2'); $extra = Exim::expand_string('$3'); $domain = ""; $unixuser = 1; #check for netscape that offsets the login/pass by one if (length($extra) > 0 ) { if ($username eq "" || $username eq $password) { $username = $password; $password = $extra; } } if (!safe_name($username)) { Exim::log_write("SMTPAuth: Invalid username: $username"); return "no"; } if ($username =~ /\@/) { $unixuser = 0; ($username,$domain) = split(/\@/, $username); if ($domain eq "") { return "no"; } } if ($unixuser == 1) { #the username passed doesn't have a domain, so its a system account $homepath = (getpwnam($username))[7]; if ($homepath eq "") { return 0; } open(PASSFILE, "< $homepath/.shadow") || return "no"; $crypted_pass = <PASSFILE>; close PASSFILE; if ($crypted_pass eq crypt($password, $crypted_pass)) { my $limit_check = hit_limit_user($username); if ($limit_check > 1) { die("The email send limit for $username has been reached\n"); } return "yes"; } else { return "no"; } } else { #the username contain a domain, which is now in $domain. #this is a pure virtual pop account. open(PASSFILE, "< /etc/virtual/$domain/passwd") || return "no"; while (<PASSFILE>) { ($test_user,$test_pass) = split(/:/,$_); $test_pass =~ s/\n//g; #snip out the newline at the end if ($test_user eq $username) { if ($test_pass eq crypt($password, $test_pass)) { close PASSFILE; my $domain_owner = get_domain_owner($domain); if ($domain_owner != -1) { my $limit_check = hit_limit_user($domain_owner); if ($limit_check > 1) { die("The email send limit for $domain_owner has been reached\n"); } $limit_check = hit_limit_email($username, $domain); if ($limit_check > 1) { die("The email send limit for $username\@${domain} has been reached\n"); } } return "yes"; } } } close PASSFILE; return "no"; } return "no"; } sub find_uid_apache { my ($work_path) = @_; my @pw; # $pwd will probably look like '/home/username/domains/domain.com/public_html' # it may or may not use /home though. others are /usr/home, but it's ultimately # specified in the /etc/passwd file. We *could* parse through it, but for efficiency # reasons, we'll only check /home and /usr/home .. if they change it, they can # manually adjust if needed. @dirs = split(/\//, $work_path); foreach $dir (@dirs) { # check the dir name for a valid user # get the home dir for that user # compare it with the first part of the work_path if ( (@pw = getpwnam($dir)) ) { if ($work_path =~/^$pw[7]/) { return $pw[2]; } } } return -1; } sub find_uid_auth_id { # this will be passwed either # 'username' or 'user@domain.com' my ($auth_id) = @_; my $unixuser = 1; my $domain = ""; my $user = ""; my $username = $auth_id; my @pw; if (!safe_name($username)) { Exim::log_write("find_uid_auth_id: Invalid username: $username"); return "-1"; } if ($auth_id =~ /\@/) { $unixuser = 0; ($user,$domain) = split(/\@/, $auth_id); if ($domain eq "") { return "-1"; } } if (!$unixuser) { # we need to take $domain and get the user from /etc/virtual/domainowners # once we find it, set $username my $u = get_domain_owner($domain);; if ($u != -1) { $username = $u; } } #log_str("username found from $auth_id: $username:\n"); if ( (@pw = getpwnam($username)) ) { return $pw[2]; } return -1; } sub find_uid_sender { my $sender_address = Exim::expand_string('$sender_address'); my ($user,$domain) = split(/\@/, $sender_address); my $primary_hostname = Exim::expand_string('$primary_hostname'); if ( $domain eq $primary_hostname ) { @pw = getpwnam($user); return $pw[2]; } my $username = get_domain_owner($domain); if ( (@pw = getpwnam($username)) ) { return $pw[2]; } return -1; } sub find_uid { my $uid = Exim::expand_string('$originator_uid'); my $username = getpwuid($uid); my $auth_id = Exim::expand_string('$authenticated_id'); my $work_path = $ENV{'PWD'}; if ($username eq "apache" || $username eq "nobody" || $username eq "webapps") { $uid = find_uid_apache($work_path); if ($uid != -1) { return $uid; } } $uid = find_uid_auth_id($auth_id); if ($uid != -1) { return $uid; } # we don't want to rely on this, but it's all thats left. return find_uid_sender; } sub uid_exempt { my ($uid) = @_; if ($uid == 0) { return 1; } my $name = getpwuid($uid); if ($name eq "root") { return 1; } if ($name eq "diradmin") { return 1; } return 0; } #check_limits #used to enforce limits for the number of emails sent #by a user. It also logs the bandwidth of the data #for received mail. sub check_limits { #find the curent user $uid = find_uid(); #log_str("Found uid: $uid\n"); if (uid_exempt($uid)) { return "yes"; } my $name=""; #check this users limit $name = getpwuid($uid); if (!defined($name)) { #possibly the sender-verify $name = "unknown"; #return "yes"; } my $count = 0; my $email_limit = 0; if (open (LIMIT, "/etc/virtual/limit_$name")) { $email_limit = int(<LIMIT>); close(LIMIT); } else { open (LIMIT, "/etc/virtual/limit"); $email_limit = int(<LIMIT>); close(LIMIT); } my $sender_address = Exim::expand_string('$sender_address'); my $authenticated_id = Exim::expand_string('$authenticated_id'); my $sender_host_address = Exim::expand_string('$sender_host_address'); my $mid = Exim::expand_string('$message_id'); my $message_size = Exim::expand_string('$message_size'); my $local_part = Exim::expand_string('$local_part'); my $domain = Exim::expand_string('$domain'); my $timestamp = time(); my $is_retry = 0; if ($email_limit > 0) { #check this users limit $count = (stat("/etc/virtual/usage/$name"))[7]; if ($count > $email_limit) { die("You ($name) have reached your daily email limit of $email_limit emails\n"); } if ($mid ne "") { if (! -d "/etc/virtual/usage/${name}_ids") { mkdir("/etc/virtual/usage/${name}_ids", 0770); } my $mid_char = substr($mid, 0, 1); if (! -d "/etc/virtual/usage/${name}_ids/$mid_char") { mkdir("/etc/virtual/usage/${name}_ids/$mid_char", 0770); } if (! -d "/etc/virtual/usage/${name}_ids/$mid_char/$mid") { mkdir("/etc/virtual/usage/${name}_ids/$mid_char/$mid", 0770); } my $dest_str = get_b64_string("$local_part-$domain"); my $id_file = "/etc/virtual/usage/${name}_ids/$mid_char/$mid/$dest_str"; if (-f $id_file) { $is_retry = 1; } else { open(IDF, ">>$id_file"); print IDF "log_time=$timestamp\n"; close(IDF); chmod (0660, $id_file); } } #this is their last email. if (($count == $email_limit) && ($is_retry != 1)) { #taddle on the dataskq #note that the sender_address here is only the person who sent the last email #it doesnt meant that they have sent all the spam #this action=limit will trigger a check on usage/user.bytes, and DA will try and figure it out. open(TQ, ">>/etc/virtual/mail_task.queue"); print TQ "action=limit&username=$name&count=$count&limit=$email_limit&email=$sender_address&authenticated_id=$authenticated_id&sender_host_address=$sender_host_address&log_time=$timestamp\n"; close(TQ); chmod (0660, "/etc/virtual/mail_task.queue"); } if ($is_retry != 1) { open(USAGE, ">>/etc/virtual/usage/$name"); print USAGE "1"; close(USAGE); chmod (0660, "/etc/virtual/usage/$name"); } } if ( ($authenticated_id ne "") && ($is_retry != 1) ) { my $user=""; my $domain=""; ($user, $domain) = (split(/@/, $authenticated_id)); if (!safe_name($authenticated_id)) { Exim::log_write("check_limits: Invalid username: $authenticated_id"); return "no"; } if ($domain ne "") { my $user_email_limit = 0; if (open (LIMIT, "/etc/virtual/$domain/limit/$user")) { $user_email_limit = int(<LIMIT>); close(LIMIT); } else { if (open (LIMIT, "/etc/virtual/user_limit")) { $user_email_limit = int(<LIMIT>); close(LIMIT); } } if ($user_email_limit > 0) { $count = 0; $count = (stat("/etc/virtual/$domain/usage/$user"))[7]; if ($count == $user_email_limit) { open(TQ, ">>/etc/virtual/mail_task.queue"); print TQ "action=userlimit&username=$name&count=$count&limit=$user_email_limit&email=$sender_address&authenticated_id=$authenticated_id&sender_host_address=$sender_host_address&log_time=$timestamp\n"; close(TQ); chmod (0660, "/etc/virtual/mail_task.queue"); } if ($count > $user_email_limit) { die("Your E-Mail ($authenticated_id) has reached it's daily email limit of $user_email_limit emails\n"); } if (! -d "/etc/virtual/$domain/usage") { mkdir("/etc/virtual/$domain/usage", 0770); } if (-d "/etc/virtual/$domain/usage") { open(USAGE, ">>/etc/virtual/$domain/usage/$user"); print USAGE "1"; close(USAGE); chmod (0660, "/etc/virtual/$domain/usage/$user"); } } } } log_bandwidth($uid,"type=email&email=$sender_address&method=outgoing&id=$mid&authenticated_id=$authenticated_id&sender_host_address=$sender_host_address&log_time=$timestamp&message_size=$message_size&local_part=$local_part&domain=$domain"); return "yes" } sub log_email { my($lp,$dmn) = @_; #log_str("logging $lp\@$dmn\n"); my $user = get_domain_owner($dmn); if ($user == -1) { return "no"; } my $mid = Exim::expand_string('$message_id'); my $timestamp = time(); if ( (@pw = getpwnam($user)) ) { log_bandwidth($pw[2],"type=email&email=$lp\@$dmn&method=incoming&log_time=$timestamp&id=$mid"); } return "yes"; } sub save_virtual_user { my $dmn = Exim::expand_string('$domain'); my $lp = Exim::expand_string('$local_part'); my $usr = ""; my $pss = ""; my $entry = ""; if (!safe_name($dmn) || !safe_name($lp)) { Exim::log_write("save_virtual_user: Invalid username: $lp or domain: $dmn"); return "no"; } open (PASSWD, "/etc/virtual/$dmn/passwd") || return "no"; while ($entry = <PASSWD>) { ($usr,$pss) = split(/:/,$entry); if ($usr eq $lp) { close(PASSWD); log_email($lp, $dmn); return "yes"; } } close (PASSWD); return "no"; } sub log_bandwidth { my ($uid,$data) = @_; my $name = getpwuid($uid); if (uid_exempt($uid)) { return; } if ($name eq "") { $name = "unknown"; } my $bytes = Exim::expand_string('$message_size'); if ($bytes == -1) { return; } my $work_path = $ENV{'PWD'}; open (BYTES, ">>/etc/virtual/usage/$name.bytes"); print BYTES "$bytes=$data&path=$work_path\n"; close(BYTES); chmod (0660, "/etc/virtual/usage/$name.bytes"); } sub get_b64_string { my ($str) = @_; eval { require MIME::Base64; MIME::Base64->import(); }; unless($@) { my $enc = MIME::Base64::encode_base64($str); # an evil newline is added. get rid of it. $enc =~ s/\n//; return $enc; } return $str; } sub log_str { my ($str) = @_; open (LOG, ">> /tmp/test.txt"); print LOG $str; close(LOG); }