Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #!/usr/bin/perl
  2. $mysql_pass = `cat /root/.lp_config/mysql_pass`;
  3. chomp $mysql_pass;
  4. $domain = `cat ~/.lp_config/domain`;
  5. chomp $domain;
  6. `mysql -u root --password=$mysql_pass -e "select home_directory from accounts_data.accounts into outfile 'dirs.txt';"`;
  7. open f, "/var/lib/mysql/dirs.txt" or die $!;
  8. open sec, ">> /etc/httpd/conf.d/user-security.conf" or die $!;
  9. while(<f>) {
  10. chomp $_;
  11. $sub = $_;
  12. $sub =~ s/\/htdocs\///;
  13. if(-e "$sub/.done") {
  14. next;
  15. }
  16. print sec "<Directory $_>\n";
  17. print sec "php_admin_value open_basedir \"$sub/htdocs\"\n";
  18. print sec "php_admin_value upload_tmp_dir \"$sub/htdocs\"\n";
  19. if(-e "$sub/.phpsec") {
  20. print sec "php_admin_flag safe_mode off\n";
  21. `mysql -u root --password=$mysql_pass -e "select user_name from accounts_data.accounts where home_directory='$_' into outfile 'user.txt';"`;
  22. $user = `cat /var/lib/mysql/user.txt`;
  23. chomp $user;
  24. print "$user\n";
  25. print sec "php_admin_value mail.force_extra_parameters \"-f $user\@$domain\"\n";
  26. `rm -f /var/lib/mysql/user.txt`;
  27. }
  28. print sec "</Directory>\n";
  29. `touch $sub/.done`;
  30. }
  31. close f;
  32. close sec;
  33. `rm -f /var/lib/mysql/dirs.txt`;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement