Dies ist eine alte Version des Dokuments!
DKIM - Domain Key Identified Mail unter CentOS 7.x
aktuell in Bearbeitung!
domain_maps
# yum install perl-DBD-MySQL -y
# mysql -h localhost -u root -p
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 170683 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE USER 'amavisd'@'vml000067.dmz.nausch.org' IDENTIFIED BY 'hT1ojlODbxckhcn16Uy7Lk5wMO'; Query OK, 0 rows affected (0.01 sec) mysql> CREATE USER 'amavisd'@'10.0.0.67' IDENTIFIED BY 'hT1ojlODbxckhcn16Uy7Lk5wMO'; Query OK, 0 rows affected (0.01 sec) mysql> GRANT ALL PRIVILEGES ON postfix.* TO 'amavisd'@'vml000067.dmz.nausch.org' IDENTIFIED BY 'hT1ojlODbxckhcn16Uy7Lk5wMO' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; Query OK, 0 rows affected (0.01 sec) mysql> GRANT ALL PRIVILEGES ON postfix.* TO 'amavisd'@'10.0.0.67' IDENTIFIED BY 'hT1ojlODbxckhcn16Uy7Lk5wMO' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; Query OK, 0 rows affected (0.01 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) mysql> exit Bye
# vim /root/bin/generate_local_domains_map
- root/bin/generate_local_domains_map
#!/usr/bin/perl use DBI; use strict; my $config = "/etc/postfix/all_local_domains_map"; my $dbh = DBI->connect("dbi:mysql:database=postfix;host=mysql.dmz.nausch.org:3306;user=amavisd;password=hT1ojlODbxckhcn16Uy7Lk5wMO") || die "Cannot connect to database\n", $DBI::Errstr; my $sth = $dbh->prepare("select domain from domain where active = '1'"); $sth->execute || die "failed to execute:\n ", $DBI::Errstr; open (FH, "> $config") || die "Cannot open file\n"; while (my @row = $sth->fetchrow_array) { print FH join(', ', @row), "\n"; } close FH; $dbh->disconnect;
# chmod +x /root/bin/generate_local_domains_map
# vim /etc/crontab
- /etc/crontab
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed # Django : 2014-11-22 # jede Stunde alle Maildomains in configfile für amavisd schreiben 0 * * * * root /root/bin/generate_local_domains_map