@@ -123,7 +123,21 @@ function check_system($data) {
123123
124124 if (!is_dir ($ mail_config ['dkim_path ' ])) {
125125 $ app ->log ('DKIM Path ' .$ mail_config ['dkim_path ' ].' not found - (re)created. ' , LOGLEVEL_DEBUG );
126- mkdir ($ mail_config ['dkim_path ' ], 0750 , true );
126+ if ($ app ->system ->is_user ('amavis ' )) {
127+ $ amavis_user ='amavis ' ;
128+ } elseif ($ app ->system ->is_user ('vscan ' )) {
129+ $ amavis_user ='vscan ' ;
130+ }
131+ else {
132+ $ amavis_user ='' ;
133+ }
134+ if (!empty ($ amavis_user )) {
135+ mkdir ($ mail_config ['dkim_path ' ], 0750 , true );
136+ exec ('chown ' .$ amavis_user .' /var/lib/amavis/dkim ' );
137+ unset($ amavis_user );
138+ } else {
139+ mkdir ($ mail_config ['dkim_path ' ], 0755 , true );
140+ }
127141 }
128142
129143 if (!is_writeable ($ mail_config ['dkim_path ' ])) {
@@ -173,7 +187,7 @@ function write_dkim_key($key_file, $key_value, $key_domain) {
173187 $ app ->log ('Saved DKIM Private-key to ' .$ key_file .'.private ' , LOGLEVEL_DEBUG );
174188 $ success =true ;
175189 /* now we get the DKIM Public-key */
176- exec ('cat ' .escapeshellarg ($ key_file .'.private ' ).'|openssl rsa -pubout ' , $ pubkey , $ result );
190+ exec ('cat ' .escapeshellarg ($ key_file .'.private ' ).'|openssl rsa -pubout 2> /dev/null ' , $ pubkey , $ result );
177191 $ public_key ='' ;
178192 foreach ($ pubkey as $ values ) $ public_key =$ public_key .$ values ."\n" ;
179193 /* save the DKIM Public-key in dkim-dir */
0 commit comments