@@ -75,7 +75,7 @@ def default(self):
7575 def pre_pref (self , apt_packages ):
7676 """Pre settings to do before installation packages"""
7777 if set (EEVariables .ee_postfix ).issubset (set (apt_packages )):
78- Log .info (self , "Pre-seeding Postfix" )
78+ Log .debug (self , "Pre-seeding Postfix" )
7979 EEShellExec .cmd_exec (self , "echo \" postfix postfix"
8080 "/main_mailer_type string \' Internet Site\' \" "
8181 " | debconf-set-selections" )
@@ -90,7 +90,7 @@ def pre_pref(self, apt_packages):
9090 EERepo .add_key (self , '1C4CBDCDCD2EFD2A' ,
9191 keyserver = "subkeys.pgp.net" )
9292 chars = '' .join (random .sample (string .ascii_letters , 8 ))
93- Log .info (self , "Pre-seeding MySQL" )
93+ Log .debug (self , "Pre-seeding MySQL" )
9494 EEShellExec .cmd_exec (self , "echo \" percona-server-server-5.6 "
9595 "percona-server-server/root_password "
9696 "password {chars}\" | "
@@ -203,7 +203,7 @@ def post_pref(self, apt_packages, packages):
203203 '/etc/nginx/common' )
204204 os .makedirs ('/etc/nginx/common' )
205205
206- data = dict ()
206+ data = dict (webroot = EEVariables . ee_webroot )
207207 Log .debug (self , 'Writting the nginx configuration to '
208208 'file /etc/nginx/common/acl.conf' )
209209 ee_nginx = open ('/etc/nginx/common/acl.conf' , 'w' )
@@ -450,8 +450,9 @@ def post_pref(self, apt_packages, packages):
450450 myfile .write ("<?php\n phpinfo();\n ?>" )
451451
452452 EEFileUtils .chown (self , "{0}22222"
453- .format (EEVariables .ee_webroot ), 'www-data' ,
454- 'www-data' , recursive = True )
453+ .format (EEVariables .ee_webroot ),
454+ EEVariables .ee_php_user ,
455+ EEVariables .ee_php_user , recursive = True )
455456
456457 EEGit .add (self , ["/etc/php5" ], msg = "Adding PHP into Git" )
457458 EEService .reload_service (self , 'php5-fpm' )
@@ -640,10 +641,38 @@ def post_pref(self, apt_packages, packages):
640641 "smtp-amavis:[127.0.0.1]:10024\" " )
641642 EEShellExec .cmd_exec (self , "sed -i \" s/1 pickup/1 "
642643 "pickup"
643- "\\ n -o content_filter=\\ n -o"
644+ "\\ n -o content_filter=\\ n -o"
644645 " receive_override_options=no_header_body"
645646 "_checks/\" /etc/postfix/master.cf" )
646647
648+ amavis_master = ("""smtp-amavis unix - - n - 2 smtp
649+ -o smtp_data_done_timeout=1200
650+ -o smtp_send_xforward_command=yes
651+ -o disable_dns_lookups=yes
652+ -o max_use=20
653+ 127.0.0.1:10025 inet n - n - - smtpd
654+ -o content_filter=
655+ -o smtpd_delay_reject=no
656+ -o smtpd_client_restrictions=permit_mynetworks,reject
657+ -o smtpd_helo_restrictions=
658+ -o smtpd_sender_restrictions=
659+ -o smtpd_recipient_restrictions=permit_mynetworks,reject
660+ -o smtpd_data_restrictions=reject_unauth_pipelining
661+ -o smtpd_end_of_data_restrictions=
662+ -o smtpd_restriction_classes=
663+ -o mynetworks=127.0.0.0/8
664+ -o smtpd_error_sleep_time=0
665+ -o smtpd_soft_error_limit=1001
666+ -o smtpd_hard_error_limit=1000
667+ -o smtpd_client_connection_count_limit=0
668+ -o smtpd_client_connection_rate_limit=0
669+ -o receive_override_options=no_header_body_checks,""" +
670+ """no_unknown_recipient_check
671+ -o local_header_rewrite_clients=""" )
672+
673+ with open ("/etc/postfix/master.cf" , "a" ) as am_config :
674+ am_config .write (amavis_master )
675+
647676 # Amavis ClamAV configuration
648677 Log .debug (self , "Adding new user clamav amavis" )
649678 EEShellExec .cmd_exec (self , "adduser clamav amavis" )
@@ -681,11 +710,9 @@ def post_pref(self, apt_packages, packages):
681710 shutil .move ('/tmp/phpmyadmin-STABLE/' ,
682711 '{0}22222/htdocs/db/pma/'
683712 .format (EEVariables .ee_webroot ))
684- Log .debug (self , 'Setting Privileges of www-data:www-data to '
713+ Log .debug (self , 'Setting Privileges of webroot permission to '
685714 '{0}22222/htdocs/db/pma file '
686715 .format (EEVariables .ee_webroot ))
687- # EEShellExec.cmd_exec(self, 'chown -R www-data:www-data '
688- # '/var/www/22222/htdocs/db/pma')
689716 EEFileUtils .chown (self , '{0}22222'
690717 .format (EEVariables .ee_webroot ),
691718 EEVariables .ee_php_user ,
@@ -702,8 +729,6 @@ def post_pref(self, apt_packages, packages):
702729 Log .debug (self , "Setting Privileges to "
703730 "{0}22222/htdocs/cache/memcache file"
704731 .format (EEVariables .ee_webroot ))
705- # EEShellExec.cmd_exec(self, 'chown -R www-data:www-data '
706- # '/var/www/22222/htdocs/cache/memcache')
707732 EEFileUtils .chown (self , '{0}22222'
708733 .format (EEVariables .ee_webroot ),
709734 EEVariables .ee_php_user ,
@@ -729,11 +754,9 @@ def post_pref(self, apt_packages, packages):
729754 "/usr/bin/dot\' \" {0}22222/htdocs/"
730755 "php/webgrind/config.php"
731756 .format (EEVariables .ee_webroot ))
732- Log .debug (self , "Setting Privileges of www-data:www-data to "
757+ Log .debug (self , "Setting Privileges of webroot permission to "
733758 "{0}22222/htdocs/php/webgrind/ file "
734759 .format (EEVariables .ee_webroot ))
735- # EEShellExec.cmd_exec(self, 'chown -R www-data:www-data '
736- # '/var/www/22222/htdocs/php/webgrind/')
737760 EEFileUtils .chown (self , '{0}22222'
738761 .format (EEVariables .ee_webroot ),
739762 EEVariables .ee_php_user ,
@@ -830,7 +853,8 @@ def post_pref(self, apt_packages, packages):
830853
831854 # Custom Vimbadmin configuration by EasyEngine
832855 data = dict (salt = vm_salt , host = EEVariables .ee_mysql_host ,
833- password = vm_passwd )
856+ password = vm_passwd ,
857+ php_user = EEVariables .ee_php_user )
834858 Log .debug (self , 'Writting the ViMbAdmin configuration to '
835859 'file {0}22222/htdocs/vimbadmin/application/'
836860 'configs/application.ini'
@@ -989,7 +1013,7 @@ def post_pref(self, apt_packages, packages):
9891013 static = False ,
9901014 basic = True , wp = False , w3tc = False , wpfc = False ,
9911015 wpsc = False , multisite = False , wpsubdir = False ,
992- webroot = '/var/www' , ee_db_name = '' ,
1016+ webroot = EEVariables . ee_webroot , ee_db_name = '' ,
9931017 ee_db_user = '' , ee_db_pass = '' , ee_db_host = '' ,
9941018 rc = True )
9951019
@@ -1154,7 +1178,15 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
11541178 "Adminer" ]]
11551179
11561180 if self .app .pargs .mailscanner :
1157- apt_packages = (apt_packages + EEVariables .ee_mailscanner )
1181+ if not EEAptGet .is_installed (self , 'amavisd-new' ):
1182+ if (EEAptGet .is_installed (self , 'dovecot-core' ) or
1183+ self .app .pargs .mail ):
1184+ apt_packages = (apt_packages +
1185+ EEVariables .ee_mailscanner )
1186+ else :
1187+ Log .error (self , "Failed to find installed Dovecot" )
1188+ else :
1189+ Log .error (self , "Mail scanner allready installed" )
11581190
11591191 if self .app .pargs .utils :
11601192 Log .debug (self , "Setting packages variable for utils" )
@@ -1238,7 +1270,8 @@ def remove(self):
12381270 (not self .app .pargs .php ) and (not self .app .pargs .mysql ) and
12391271 (not self .app .pargs .postfix ) and (not self .app .pargs .wpcli ) and
12401272 (not self .app .pargs .phpmyadmin ) and
1241- (not self .app .pargs .adminer ) and (not self .app .pargs .utils )):
1273+ (not self .app .pargs .adminer ) and (not self .app .pargs .utils ) and
1274+ (not self .app .pargs .mailscanner )):
12421275 self .app .pargs .web = True
12431276
12441277 if self .app .pargs .web :
@@ -1326,7 +1359,8 @@ def purge(self):
13261359 (not self .app .pargs .php ) and (not self .app .pargs .mysql ) and
13271360 (not self .app .pargs .postfix ) and (not self .app .pargs .wpcli ) and
13281361 (not self .app .pargs .phpmyadmin ) and
1329- (not self .app .pargs .adminer ) and (not self .app .pargs .utils )):
1362+ (not self .app .pargs .adminer ) and (not self .app .pargs .utils ) and
1363+ (not self .app .pargs .mailscanner )):
13301364 self .app .pargs .web = True
13311365
13321366 if self .app .pargs .web :
0 commit comments