Skip to content

Commit c33bba3

Browse files
author
Till Brehm
committed
Fixed #5288 Wrong permissions of dkim cert folder on CentOS 7
1 parent 03f54d5 commit c33bba3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

install/dist/lib/centos_base.lib.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,25 @@ public function configure_amavis() {
111111

112112
removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn # REMOVE ME', 1);
113113
replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
114+
115+
// get shell-group for amavis
116+
$amavis_group=exec('grep -o "^amavis:\|^vscan:" /etc/group');
117+
if(!empty($amavis_group)) {
118+
$amavis_group=rtrim($amavis_group, ":");
119+
}
120+
// get shell-user for amavis
121+
$amavis_user=exec('grep -o "^amavis:\|^vscan:" /etc/passwd');
122+
if(!empty($amavis_user)) {
123+
$amavis_user=rtrim($amavis_user, ":");
124+
}
125+
126+
// Create the director for DKIM-Keys
127+
if(!is_dir('/var/lib/amavis')) mkdir('/var/lib/amavis', 0750, true);
128+
if(!empty($amavis_user)) exec('chown '.$amavis_user.' /var/lib/amavis');
129+
if(!empty($amavis_group)) exec('chgrp '.$amavis_group.' /var/lib/amavis');
130+
if(!is_dir('/var/lib/amavis/dkim')) mkdir('/var/lib/amavis/dkim', 0750);
131+
if(!empty($amavis_user)) exec('chown -R '.$amavis_user.' /var/lib/amavis/dkim');
132+
if(!empty($amavis_group)) exec('chgrp -R '.$amavis_group.' /var/lib/amavis/dkim');
114133

115134

116135
}

0 commit comments

Comments
 (0)