Browse Source

Updated postfixadmin

tags/v2.0.0
Robin Thoni 1 year ago
parent
commit
3c1fdfd568
100 changed files with 53 additions and 24832 deletions
  1. 9
    39
      postfixadmin/Dockerfile
  2. 0
    59
      postfixadmin/apache2.conf
  3. 18
    0
      postfixadmin/config/states/apache2/init.sls
  4. 14
    0
      postfixadmin/config/states/postfixadmin/config_3.2.2.local.php
  5. 12
    0
      postfixadmin/config/states/postfixadmin/init.sls
  6. 0
    40
      postfixadmin/postfixadmin-3.0/ADDITIONS/convert-passwd-to-postfixadmin.pl
  7. 0
    124
      postfixadmin/postfixadmin-3.0/ADDITIONS/mailbox_remover.pl
  8. 0
    70
      postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/README
  9. 0
    44
      postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/common.php
  10. 0
    102
      postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/functions.inc.php
  11. 0
    27
      postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/index.php
  12. 0
    128
      postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/postfixadmin_changepass.php
  13. 0
    165
      postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/postfixadmin_forward.php
  14. 0
    157
      postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/postfixadmin_vacation.php
  15. 0
    61
      postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/setup.php
  16. 0
    185
      postfixadmin/postfixadmin-3.0/ADDITIONS/virtualmaildel.php
  17. 0
    1015
      postfixadmin/postfixadmin-3.0/CHANGELOG.TXT
  18. 0
    214
      postfixadmin/postfixadmin-3.0/DOCUMENTS/DOVECOT.txt
  19. 0
    111
      postfixadmin/postfixadmin-3.0/DOCUMENTS/UPGRADE.txt
  20. 0
    159
      postfixadmin/postfixadmin-3.0/INSTALL.TXT
  21. 0
    222
      postfixadmin/postfixadmin-3.0/VIRTUAL_VACATION/INSTALL.TXT
  22. 0
    22
      postfixadmin/postfixadmin-3.0/VIRTUAL_VACATION/index.php
  23. 0
    726
      postfixadmin/postfixadmin-3.0/VIRTUAL_VACATION/vacation.pl
  24. 0
    140
      postfixadmin/postfixadmin-3.0/backup.php
  25. 0
    104
      postfixadmin/postfixadmin-3.0/broadcast-message.php
  26. 0
    105
      postfixadmin/postfixadmin-3.0/common.php
  27. 0
    591
      postfixadmin/postfixadmin-3.0/config.inc.php
  28. 0
    95
      postfixadmin/postfixadmin-3.0/css/calendar.css
  29. 0
    5
      postfixadmin/postfixadmin-3.0/debian/apache/postfixadmin.conf
  30. 0
    46
      postfixadmin/postfixadmin-3.0/debian/changelog
  31. 0
    27
      postfixadmin/postfixadmin-3.0/debian/control
  32. 0
    4
      postfixadmin/postfixadmin-3.0/debian/lighttpd/90-postfixadmin.conf
  33. 0
    55
      postfixadmin/postfixadmin-3.0/debian/patches/0001-db_credentials.patch
  34. 0
    1
      postfixadmin/postfixadmin-3.0/debian/patches/series
  35. 0
    4
      postfixadmin/postfixadmin-3.0/debian/postfixadmin.dirs
  36. 0
    8
      postfixadmin/postfixadmin-3.0/debian/postfixadmin.install
  37. 0
    1
      postfixadmin/postfixadmin-3.0/debian/postfixadmin.links
  38. 0
    24
      postfixadmin/postfixadmin-3.0/debian/postfixadmin.postinst
  39. 0
    11
      postfixadmin/postfixadmin-3.0/debian/postfixadmin.prerm
  40. 0
    58
      postfixadmin/postfixadmin-3.0/debian/rules
  41. 0
    59
      postfixadmin/postfixadmin-3.0/delete.php
  42. 0
    229
      postfixadmin/postfixadmin-3.0/edit.php
  43. 0
    59
      postfixadmin/postfixadmin-3.0/editactive.php
  44. 0
    1921
      postfixadmin/postfixadmin-3.0/functions.inc.php
  45. 0
    17
      postfixadmin/postfixadmin-3.0/images/index.php
  46. 0
    89
      postfixadmin/postfixadmin-3.0/index.php
  47. 0
    385
      postfixadmin/postfixadmin-3.0/languages/bg.lang
  48. 0
    384
      postfixadmin/postfixadmin-3.0/languages/ca.lang
  49. 0
    384
      postfixadmin/postfixadmin-3.0/languages/cn.lang
  50. 0
    397
      postfixadmin/postfixadmin-3.0/languages/cs.lang
  51. 0
    398
      postfixadmin/postfixadmin-3.0/languages/da.lang
  52. 0
    396
      postfixadmin/postfixadmin-3.0/languages/de.lang
  53. 0
    397
      postfixadmin/postfixadmin-3.0/languages/en.lang
  54. 0
    386
      postfixadmin/postfixadmin-3.0/languages/es.lang
  55. 0
    388
      postfixadmin/postfixadmin-3.0/languages/et.lang
  56. 0
    383
      postfixadmin/postfixadmin-3.0/languages/eu.lang
  57. 0
    384
      postfixadmin/postfixadmin-3.0/languages/fi.lang
  58. 0
    389
      postfixadmin/postfixadmin-3.0/languages/fo.lang
  59. 0
    386
      postfixadmin/postfixadmin-3.0/languages/fr.lang
  60. 0
    383
      postfixadmin/postfixadmin-3.0/languages/hr.lang
  61. 0
    397
      postfixadmin/postfixadmin-3.0/languages/hu.lang
  62. 0
    22
      postfixadmin/postfixadmin-3.0/languages/index.php
  63. 0
    384
      postfixadmin/postfixadmin-3.0/languages/is.lang
  64. 0
    385
      postfixadmin/postfixadmin-3.0/languages/it.lang
  65. 0
    395
      postfixadmin/postfixadmin-3.0/languages/ja.lang
  66. 0
    422
      postfixadmin/postfixadmin-3.0/languages/language-update.sh
  67. 0
    42
      postfixadmin/postfixadmin-3.0/languages/language.php
  68. 0
    390
      postfixadmin/postfixadmin-3.0/languages/lt.lang
  69. 0
    385
      postfixadmin/postfixadmin-3.0/languages/mk.lang
  70. 0
    385
      postfixadmin/postfixadmin-3.0/languages/nb.lang
  71. 0
    385
      postfixadmin/postfixadmin-3.0/languages/nl.lang
  72. 0
    384
      postfixadmin/postfixadmin-3.0/languages/nn.lang
  73. 0
    390
      postfixadmin/postfixadmin-3.0/languages/pl.lang
  74. 0
    397
      postfixadmin/postfixadmin-3.0/languages/pt-br.lang
  75. 0
    396
      postfixadmin/postfixadmin-3.0/languages/ro.lang
  76. 0
    397
      postfixadmin/postfixadmin-3.0/languages/ru.lang
  77. 0
    385
      postfixadmin/postfixadmin-3.0/languages/sk.lang
  78. 0
    384
      postfixadmin/postfixadmin-3.0/languages/sl.lang
  79. 0
    397
      postfixadmin/postfixadmin-3.0/languages/sv.lang
  80. 0
    384
      postfixadmin/postfixadmin-3.0/languages/tr.lang
  81. 0
    386
      postfixadmin/postfixadmin-3.0/languages/tw.lang
  82. 0
    477
      postfixadmin/postfixadmin-3.0/list-virtual.php
  83. 0
    140
      postfixadmin/postfixadmin-3.0/list.php
  84. 0
    91
      postfixadmin/postfixadmin-3.0/login.php
  85. 0
    31
      postfixadmin/postfixadmin-3.0/main.php
  86. 0
    206
      postfixadmin/postfixadmin-3.0/model/AdminHandler.php
  87. 0
    109
      postfixadmin/postfixadmin-3.0/model/AdminpasswordHandler.php
  88. 0
    417
      postfixadmin/postfixadmin-3.0/model/AliasHandler.php
  89. 0
    130
      postfixadmin/postfixadmin-3.0/model/AliasdomainHandler.php
  90. 0
    86
      postfixadmin/postfixadmin-3.0/model/CliDelete.php
  91. 0
    256
      postfixadmin/postfixadmin-3.0/model/CliEdit.php
  92. 0
    65
      postfixadmin/postfixadmin-3.0/model/CliHelp.php
  93. 0
    104
      postfixadmin/postfixadmin-3.0/model/CliScheme.php
  94. 0
    114
      postfixadmin/postfixadmin-3.0/model/CliView.php
  95. 0
    227
      postfixadmin/postfixadmin-3.0/model/Config.php
  96. 0
    320
      postfixadmin/postfixadmin-3.0/model/DomainHandler.php
  97. 0
    181
      postfixadmin/postfixadmin-3.0/model/FetchmailHandler.php
  98. 0
    730
      postfixadmin/postfixadmin-3.0/model/MailboxHandler.php
  99. 0
    893
      postfixadmin/postfixadmin-3.0/model/PFAHandler.php
  100. 0
    0
      postfixadmin/postfixadmin-3.0/model/VacationHandler.php

+ 9
- 39
postfixadmin/Dockerfile View File

@@ -1,43 +1,13 @@
1
-FROM debian:jessie
1
+FROM php:7-apache-stretch
2 2
 
3
-# FROM https://github.com/ZHAJOR/Docker-Apache-2.4-Php-5.6-for-Laravel
4
-MAINTAINER Robin Thoni <robin@rthoni.com>
3
+ADD https://raw.githubusercontent.com/docker-gcf/docker-gcf/v1.5.0/setup.sh /tmp/docker-utils-setup.sh
4
+RUN sh /tmp/docker-utils-setup.sh
5
+CMD ["gcf-entrypoint", "apache2-foreground"]
5 6
 
6
-RUN apt-get update && apt-get -y install\
7
-        apache2=2.4.*\
8
-        libapache2-mod-php5\
9
-        php5\
10
-        php5-mcrypt\
11
-        php5-pgsql\
12
-        php5-mysql\
13
-        php5-gd\
14
-        php5-curl\
15
-        php5-imap &&\
16
-        apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
7
+RUN pkgs-install libpq-dev libc-client-dev libkrb5-dev
8
+RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
9
+RUN docker-php-ext-install pdo pdo_pgsql pgsql imap
17 10
 
18
-RUN /usr/sbin/a2enmod rewrite &&\
19
-    rm -rf /var/www/html &&\
20
-    mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html &&\
21
-    chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
11
+COPY ./postfixadmin-3.2.2/ /var/www/html/
22 12
 
23
-RUN rm -rf /var/log/* &&\
24
-    mkdir -p /var/log/apache2 &&\
25
-    ln -s /dev/stderr /var/log/apache2/error.log &&\
26
-    ln -s /dev/stdout /var/log/apache2/access.log &&\
27
-    ln -s /dev/stdout /var/log/apache2/other_vhosts_access.log
28
-
29
-COPY apache2.conf /etc/apache2/apache2.conf
30
-
31
-COPY ./postfixadmin-3.0/ /var/www/html/
32
-
33
-RUN chmod -R 777 /var/www/html/templates_c
34
-
35
-COPY ./vars-vars /etc/vars-vars
36
-
37
-COPY ./vars-files /etc/vars-files
38
-
39
-COPY ./run.sh /run.sh
40
-
41
-EXPOSE 80
42
-
43
-CMD ["/run.sh"]
13
+COPY ./config /etc/salt/base/

+ 0
- 59
postfixadmin/apache2.conf View File

@@ -1,59 +0,0 @@
1
-# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
2
-
3
-Mutex file:/var/lock/apache2 default
4
-PidFile /var/run/apache2/apache2.pid
5
-Timeout 300
6
-KeepAlive On
7
-MaxKeepAliveRequests 100
8
-KeepAliveTimeout 5
9
-User www-data
10
-Group www-data
11
-HostnameLookups Off
12
-ErrorLog /var/log/apache2/error.log
13
-LogLevel warn
14
-
15
-IncludeOptional mods-enabled/*.load
16
-IncludeOptional mods-enabled/*.conf
17
-
18
-# ports.conf
19
-Listen 80
20
-<IfModule ssl_module>
21
-    Listen 443
22
-</IfModule>
23
-<IfModule mod_gnutls.c>
24
-    Listen 443
25
-</IfModule>
26
-
27
-DocumentRoot "/var/www/html/"
28
-
29
-<Directory />
30
-    Options FollowSymLinks
31
-    AllowOverride None
32
-    Require all denied
33
-</Directory>
34
-
35
-<Directory /var/www/html/>
36
-    Options FollowSymLinks
37
-    AllowOverride All
38
-    Require all granted
39
-</Directory>
40
-
41
-
42
-
43
-LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
44
-LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
45
-LogFormat "%h %l %u %t \"%r\" %>s %O" common
46
-LogFormat "%{Referer}i -> %U" referer
47
-LogFormat "%{User-agent}i" agent
48
-
49
-CustomLog /var/log/apache2/access.log combined
50
-
51
-<FilesMatch \.php$>
52
-    SetHandler application/x-httpd-php
53
-</FilesMatch>
54
-
55
-# Multiple DirectoryIndex directives within the same context will add
56
-# to the list of resources to look for rather than replace
57
-# https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex
58
-DirectoryIndex disabled
59
-DirectoryIndex index.php index.html

+ 18
- 0
postfixadmin/config/states/apache2/init.sls View File

@@ -0,0 +1,18 @@
1
+{% raw %}
2
+apache2-config:
3
+  file.blockreplace:
4
+      - name: /etc/apache2/apache2.conf
5
+      - append_if_not_found: True
6
+      - content: |
7
+                   ServerName postfixadmin
8
+                   LogFormat "%{%Y-%m-%d %H:%M:%S}t %v:%p %h %l %u \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
9
+                   LogFormat "%{%Y-%m-%d %H:%M:%S}t %h %l %u \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
10
+                   LogFormat "%{%Y-%m-%d %H:%M:%S}t %h %l %u \"%r\" %>s %O" common
11
+
12
+apache2-config-site:
13
+  file.line:
14
+      - name: /etc/apache2/sites-available/000-default.conf
15
+      - match: DocumentRoot .*
16
+      - mode: replace
17
+      - content: DocumentRoot /var/www/html/public
18
+{% endraw %}

+ 14
- 0
postfixadmin/config/states/postfixadmin/config_3.2.2.local.php View File

@@ -0,0 +1,14 @@
1
+<?php
2
+
3
+{% for key, value in salt['pillar.get']("model:postfixadmin:extraConfig", {}).items() %}
4
+$CONF['{{ key }}'] = {{ value }};
5
+{% endfor %}
6
+
7
+$CONF['database_type'] = 'pgsql';
8
+$CONF['database_host'] = '{{ salt['pillar.get']("model:postgres:host") }}';
9
+$CONF['database_port'] = '{{ salt['pillar.get']("model:postgres:port") }}';
10
+$CONF['database_user'] = '{{ salt['pillar.get']("model:postgres:user") }}';
11
+$CONF['database_password'] = '{{ salt['pillar.get']("model:postgres:password") }}';
12
+$CONF['database_name'] = '{{ salt['pillar.get']("model:postgres:database") }}';
13
+
14
+$CONF['configured'] = true;

+ 12
- 0
postfixadmin/config/states/postfixadmin/init.sls View File

@@ -0,0 +1,12 @@
1
+postfixadmin-config:
2
+  file.managed:
3
+    - name: /var/www/html/config.local.php
4
+    - source: salt://postfixadmin/config_3.2.2.local.php
5
+    - template: jinja
6
+
7
+postfixadmin-templates-c-dir:
8
+  file.directory:
9
+    - name: /var/www/html/templates_c
10
+    - user: www-data
11
+    - group: www-data
12
+    - mode: 700

+ 0
- 40
postfixadmin/postfixadmin-3.0/ADDITIONS/convert-passwd-to-postfixadmin.pl View File

@@ -1,40 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# Postfix Admin 
4
-# 
5
-# LICENSE 
6
-# This source file is subject to the GPL license that is bundled with  
7
-# this package in the file LICENSE.TXT. 
8
-# 
9
-# Further details on the project are available at http://postfixadmin.sf.net 
10
-# 
11
-# @version $Id: convert-passwd-to-postfixadmin.pl 1558 2013-11-10 15:57:32Z christian_boltz $ 
12
-# @license GNU GPL v2 or later. 
13
-#
14
-#
15
-# Really crude attempt at taking all users from a local 
16
-# passwd file (/etc/shadow) and creating postfixadmin mailboxes for them.
17
-#
18
-# The script outputs some SQL, which you need to then insert into your database
19
-# as appropriate.
20
-#
21
-# Notes:
22
-#  1) Change $mydomain and $true as required.
23
-#  2) Ideally it should parse /etc/passwd, or call the getpw()? function and
24
-#     populate someone's name if known.
25
-#  3) There's plenty of room for improvement.
26
-#
27
-# Original author: David Goodwin <david at palepurple-co-uk> - 2007/10/05.
28
-#
29
-use strict;
30
-
31
-open(FH, '</etc/shadow') or die ('Cannot open shadow file; you need to be root - ' . $!);
32
-my $mydomain = "test.com";
33
-my $true = "t"; # t for pgsql; 1 for mysql
34
-foreach(<FH>) { 
35
-    my ($username, $password) = split(':', $_);
36
-    next if $password eq '!';
37
-    next if $password eq '*';
38
-    my $maildir = "$username\@$mydomain/";
39
-    print "insert into mailbox (username, password, domain, active, maildir) values ('$username', '$password', '$mydomain', $true, '$maildir');\n";
40
-}

+ 0
- 124
postfixadmin/postfixadmin-3.0/ADDITIONS/mailbox_remover.pl View File

@@ -1,124 +0,0 @@
1
-#!/usr/bin/perl
2
-#
3
-# by Petr Znojemsky (c) 2004
4
-# Mailbox remover 0.1a 23/10/2004 - the very first version for MySQL
5
-# removes maildirs from disk when they are not found in a database
6
-#
7
-# Added subdir support and pause --- Alan Batie 2007
8
-# Lists directories to be deleted then pauses for 5 seconds for chance to abort
9
-# $Id: mailbox_remover.pl 211 2007-11-11 23:36:46Z christian_boltz $
10
-#
11
-# All your maildirs or other directories could be accidentally removed.
12
-# Use it at own risk. No warranties!
13
-
14
-use strict;
15
-use DBI;
16
-use File::Path;
17
-
18
-##########
19
-# Set these variables according to your configuration
20
-
21
-# when mailboxes are removed, save their tarballs here
22
-my $archdir="/var/archive/mailboxes";
23
-
24
-# expected to support z option, tweak invocation if you want different
25
-my $archcmd="/usr/bin/tar";
26
-
27
-# trailing slash not needed
28
-my $maildir_path="/var/mail";
29
-# find out if we need to check subdirs for mailboxes or just maildir_path
30
-# $CONF['domain_path'] = 'YES';
31
-my $pfadmin_config="/usr/local/www/postfixadmin/config.inc.php";
32
-
33
-# database information
34
-my $host="localhost";
35
-my $port="3306";
36
-my $userid="dbuser";
37
-my $passwd="dbpw";
38
-my $db="dbname";
39
-############
40
-
41
-my $connectionInfo="DBI:mysql:database=$db;$host:$port";
42
-# make connection to database
43
-my $dbh = DBI->connect($connectionInfo,$userid,$passwd);
44
-# prepare and execute query
45
-my $query = "SELECT maildir FROM mailbox";
46
-my $sth = $dbh->prepare($query);
47
-$sth->execute();
48
-
49
-# assign fields to variables
50
-my ($db_maildir, %db_maildirs);
51
-$sth->bind_columns(\$db_maildir);
52
-
53
-# load up directory list
54
-while($sth->fetch()) {
55
-    $db_maildirs{$db_maildir} = 1;
56
-}
57
-
58
-$sth->finish();
59
-# disconnect from database
60
-$dbh->disconnect;
61
-
62
-# 
63
-# find out if we need to check subdirs for mailboxes or just maildir_path
64
-# $CONF['domain_path'] = 'YES';
65
-#
66
-my $use_subdirs = 0;
67
-open(CONFIG, "<$pfadmin_config") || die "Can't open '$pfadmin_config': $!\n";
68
-while(<CONFIG>) {
69
-    if (/\$CONF\['domain_path'\] *= *'([^']*)'/) {
70
-	$use_subdirs = ($1 =~ /yes/i);
71
-    }
72
-}
73
-close(CONFIG);
74
-
75
-# store maildir list to %directories
76
-# key is path, value is username to use in archive file
77
-my %directories;
78
-opendir(DIR, $maildir_path) || die "Cannot open dir $maildir_path: $!\n";
79
-foreach my $name (readdir(DIR)) {
80
-    next if ($name eq '.' || $name eq '..' || ! -d "$maildir_path/$name");
81
-
82
-    if ($use_subdirs) {
83
-	opendir(SUBDIR, "$maildir_path/$name") || die "Cannot open dir $maildir_path/$name: $!\n";
84
-	foreach my $subname (readdir(SUBDIR)) {
85
-	    next if ($subname eq '.' || $subname eq '..' || ! -d "$maildir_path/$name/$subname");
86
-	    # db entry has trailing slash...
87
-	    if (!defined($db_maildirs{"$name/$subname/"})) {
88
-	        print "marking $maildir_path/$name/$subname for deletion.\n";
89
-		$directories{"$name/$subname"} = "$name-$subname";
90
-	    }
91
-	}
92
-	closedir(SUBDIR);
93
-    } else {
94
-	# db entry has trailing slash...
95
-	if (!defined($db_maildirs{"$name/"})) {
96
-	    print "marking $maildir_path/$name for deletion.\n";
97
-	    $directories{"$name"} = $name;
98
-	}
99
-    }
100
-}
101
-closedir(DIR);
102
-
103
-print "Ctrl-C in 5 seconds to abort before removal starts...\n";
104
-sleep 5;
105
-
106
-my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
107
-# yyyymmddhhmm
108
-my $tstamp = sprintf("%04d%02d%02d%02d%02d", $year+1900, $mon+1, $mday, $hour, $min);
109
-
110
-# compare two arrays and erase maildirs not found in database
111
-chdir $maildir_path || die "Can't change to maildir '$maildir_path': $!\n";;
112
-my @args;
113
-foreach my $maildir (keys(%directories)) {
114
-    my $archive = "$archdir/$directories{$maildir}-$tstamp.tgz";
115
-    # quick permissions check
116
-    open(TOUCH, ">$archive") || die "Can't create archive file $archive: $!\n";
117
-    close(TOUCH);
118
-    print "Archiving $maildir\n";
119
-    @args = ($archcmd, "cvzf", $archive, $maildir);
120
-	system(@args) == 0 or die "Creating archive for $maildir failed: $?"
121
-
122
-    rmtree($maildir);
123
-    print localtime() . " $maildir has been deleted.\n";
124
-}

+ 0
- 70
postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/README View File

@@ -1,70 +0,0 @@
1
-Squirrelmail Plugin Postfixadmin
2
-********************************
3
-
4
-The Postfixadmin SquirrelMail plugin let users change their virtual alias,
5
-vacation status/message and password if you are using the great postfixadmin
6
-tool from http://high5.net/postfixadmin
7
-
8
-Version 0.4.3   2007/08/14
9
-
10
-Postfixadmin - Postfixadmin+MySQL/PgSQL plugin for Squirrelmail
11
-
12
-
13
-Author: Florian Kimmerl <info@spacekoeln.de>
14
-Author: Sam Brookes <sam at pale purple.co.uk>
15
-    - Initial conversion to MDB2
16
-    - Fix SQL Injections etc
17
-Author: David Goodwin <david at pale purple.co.uk>
18
-    - Subsequent tidyup + testing etc
19
-Author: Krzysztof 'Mad Max' Laska - <madmax at riders.pl>
20
-    - Polish Translation.
21
-
22
-
23
-
24
-The Initial Developer of the Original postfixadmin Code is Mischa Peters.
25
-Portions created by Mischa Peters are Copyright (c) 2002, 2003, 2004.
26
-All Rights Reserved.
27
-
28
-REQUIREMENTS
29
-
30
-o SquirrelMail 1.4x
31
-
32
-o A working Mail-System "Virtual Domains and Users with postfix+Courier-IMAP+MySQL" (or PostgreSQL) See http://high5.net/howto/
33
-
34
-o POSTFIXADMIN version 2.2.0 or higher. See http://sf.net/projects/postfixadmin
35
-
36
-o This plugin only uses the postfixadmin database
37
-
38
-o Pear MDB2 database abstraction layer - see http://pear.php.net 
39
-
40
-o PHP installation with register globals TURNED OFF (huraren on IRC reports that the MDB2 driver isn't happy with it turned on)
41
-
42
-INSTALLATION
43
-
44
-See the included file INSTALL
45
-
46
-BUGS
47
-
48
-o Probably vulnerable to cross site scripting, certainly when setting the vacation message.
49
-
50
-o There may be some remaining SQL injection holes.
51
-
52
-TODO
53
-
54
--Code Cleanup
55
--Tranlation
56
-
57
-
58
-TRANSLATIONS
59
-
60
-Translations are welcome! Send the *.po-File to: david@NO.codepoets.SPAM.co.uk
61
-
62
-
63
-ACKNOWLEDGMENTS
64
-
65
-Thanks to the SquirrelMail team for building such a great app and
66
-for all the work they do to keep it running.
67
-
68
-Thanks to high5.net for writing the great Postfixadmin tool
69
-
70
-

+ 0
- 44
postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/common.php View File

@@ -1,44 +0,0 @@
1
-<?php
2
-// vim:ts=4:sw=4:et
3
-ini_set('include_path', get_include_path() . ':' . dirname(__FILE__));
4
-
5
-@include_once('Zend/Version.php');
6
-if(!class_exists('Zend_Version', false)) {
7
-	die("Zend Framework not found. Please check the INSTALL File.");
8
-}
9
-chdir("..");
10
-
11
-
12
-if (!defined('SM_PATH')) 
13
-{
14
-    define('SM_PATH','../');
15
-}
16
-include_once(dirname(__FILE__)  . '/config.php');
17
-include_once(dirname(__FILE__) . '/functions.inc.php');
18
-include_if_exists(dirname(__FILE__) . '/../include/validate.php');
19
-if (file_exists(dirname(__FILE__) . '/../include/validate.php')) 
20
-{
21
-    include_once(dirname(__FILE__) . '/include/validate.php');
22
-}
23
-else { 
24
-    include_if_exists(SM_PATH . 'src/validate.php');
25
-}
26
-include_once(SM_PATH . 'functions/page_header.php');
27
-include_once(SM_PATH . 'functions/display_messages.php');
28
-include_once(SM_PATH . 'functions/imap.php');
29
-include_if_exists(SM_PATH . 'functions/array.php');
30
-if (file_exists(SM_PATH . 'src/load_prefs.php'))
31
-{
32
-    include_once(SM_PATH . 'src/load_prefs.php');
33
-}
34
-else {
35
-    include_if_exists(SM_PATH . 'include/load_prefs.php');
36
-}
37
-// overwrite squirrelmail's content type to utf8...
38
-header("Content-Type: text/html; charset=utf8");
39
-
40
-
41
-//global $VACCONFMESSAGE;
42
-bindtextdomain('postfixadmin', dirname(__FILE__) . '/postfixadmin/locale');
43
-textdomain('postfixadmin');
44
-

+ 0
- 102
postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/functions.inc.php View File

@@ -1,102 +0,0 @@
1
-<?php
2
-/**
3
- * Postfixadmin (http://postfixadmin.sf.net) integration with Squirrelmail.
4
- * See http://squirrelmail-postfixadmin.palepurple.co.uk
5
- * @author David Goodwin and many others
6
- */
7
-
8
-
9
-function do_header() {
10
-    global $color;
11
-    displayPageHeader($color, 'None');
12
-}
13
-
14
-function do_footer() {
15
-    echo "</body></html>";
16
-}
17
-
18
-function _display_password_form() {
19
-    bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
20
-    textdomain('postfixadmin');
21
-    do_header('Postfixadmin Squirrelmail - Login');
22
-    echo _('The PostfixAdmin plugin needs your current mailbox password');
23
-    echo "<form action='' method='post'>";
24
-    echo _('Password for');
25
-    echo " " . $_SESSION['username'] . " :"; 
26
-    echo "<input type='password' name='password' value=''>";
27
-    echo "<input type='submit' value='" . _('Submit') . "'></form>";
28
-    do_footer();
29
-}
30
-
31
-/**
32
- * This returns a Zend_XmlRpc_Client instance - unless we can't log you in...
33
- */
34
-function get_xmlrpc() {
35
-    global $CONF;
36
-    require_once('Zend/XmlRpc/Client.php');
37
-    $client = new Zend_XmlRpc_Client($CONF['xmlrpc_url']);
38
-    $http_client = $client->getHttpClient();
39
-    $http_client->setCookieJar();
40
-
41
-    $login_object = $client->getProxy('login');
42
-
43
-    if(empty($_SESSION['password'])) {
44
-        if(empty($_POST['password'])) {
45
-            _display_password_form();
46
-            exit(0);
47
-        }
48
-        else {
49
-            try {
50
-                $success = $login_object->login($_SESSION['username'], $_POST['password']);
51
-            }
52
-            catch(Exception $e) {
53
-                //var_dump($client->getHttpClient()->getLastResponse()->getBody());
54
-                error_log("Failed to login to xmlrpc instance - " . $e->getMessage());
55
-                die('Failed to login to xmlrpc instance');
56
-            }
57
-            if($success) {
58
-                $_SESSION['password'] = $_POST['password'];
59
-                // reload the current page as a GET request.
60
-                header("Location: {$_SERVER['REQUEST_URI']}");
61
-                exit(0);
62
-            }
63
-            else {
64
-                _display_password_form();
65
-                exit(0);
66
-            }
67
-        }
68
-    }
69
-    else {
70
-        $success = $login_object->login($_SESSION['username'], $_SESSION['password']);
71
-    }
72
-
73
-    if(!$success) {
74
-        unset($_SESSION['password']);
75
-        die("Invalid details cached... refresh this page and re-enter your mailbox password");
76
-    }
77
-    return $client;
78
-}
79
-
80
-function include_if_exists($filename) {
81
-    if(file_exists($filename)) {
82
-        include_once($filename);
83
-    }
84
-    return;
85
-}
86
-global $optmode;
87
-$optmode = 'display';
88
-
89
-//
90
-// check_email
91
-// Action: Checks if email is valid and returns TRUE if this is the case.
92
-// Call: check_email (string email)
93
-//
94
-function check_email($email) {
95
-    $return = filter_var($email, FILTER_VALIDATE_EMAIL);
96
-    if($return === false) {
97
-        return false;
98
-    }
99
-    return true;
100
-}
101
-
102
-

+ 0
- 27
postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/index.php View File

@@ -1,27 +0,0 @@
1
-<?php
2
-
3
-/****************************************************************************************
4
-
5
-    Author ......... Florian Kimmerl
6
-    Contact ........ info@spacekoeln.de
7
-    Home Site ...... http://www.spacekoeln.de/
8
-    Program ........ postfixadmin
9
-    Version ........ 0.3-1.4
10
-    Purpose ........ Allows you to change your postfixadmin settings within squirrelmail
11
-
12
- /**
13
- * index.php
14
- *
15
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
16
- * Licensed under the GNU GPL. For full terms see the file COPYING.
17
- *
18
- * This file simply takes any attempt to view source files and sends those
19
- * people to the login screen. At this point no attempt is made to see if
20
- * the person is logged or not.
21
- *
22
- *
23
-****************************************************************************************/
24
-
25
-header("Location: ../../index.php");
26
-
27
-?>

+ 0
- 128
postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/postfixadmin_changepass.php View File

@@ -1,128 +0,0 @@
1
-<?php
2
-require_once(dirname(__FILE__) . '/common.php');
3
-
4
-$xmlrpc = get_xmlrpc();
5
-$user = $xmlrpc->getProxy('user');
6
-
7
-global $username;
8
-
9
-do_header();
10
-
11
-$USERID_USERNAME = $username;
12
-$tmp = preg_split ('/@/', $USERID_USERNAME);
13
-$USERID_DOMAIN = $tmp[1];
14
-
15
-
16
-$stMessage = '';
17
-$tMessage = '';
18
-$pPassword_admin_text = '';
19
-$pPassword_password_current_text = '';
20
-$pPassword_password_text = '';
21
-$error = 0;
22
-
23
-if ($_SERVER['REQUEST_METHOD'] == "POST")
24
-{
25
-    //$pPassword_password_text = _("pPassword_password_text");
26
-    $fPassword_current = $_POST['fPassword_current'];
27
-    $fPassword = $_POST['fPassword'];
28
-    $fPassword2 = $_POST['fPassword2'];
29
-    $username = $USERID_USERNAME;
30
-
31
-    if(!$user->login($_SESSION['username'], $_POST['fPassword_current'])) {
32
-        $error = 1;
33
-        bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
34
-        textdomain('postfixadmin');
35
-        $pPassword_password_current_text = _("You didn't supply your current password!");
36
-        bindtextdomain('squirrelmail', SM_PATH . 'locale');
37
-        textdomain('squirrelmail');
38
-    }
39
-    $min_length = 0;
40
-    if(isset($CONF['min_password_length'])) {
41
-        $min_length = $CONF['min_password_length'];
42
-    }
43
-    if (empty ($fPassword) or ($fPassword != $fPassword2) or ($min_length > 0 && strlen($fPassword) < $min_length)) {
44
-        $error = 1;
45
-        bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
46
-        textdomain('postfixadmin');
47
-        if(empty($fPassword)) {
48
-            $pPassword_password_text .= _("The passwords that you supplied are empty!");
49
-        }
50
-        if($fPassword != $fPassword2) {
51
-            $pPassword_password_text .= _("The passwords that you supplied don't match!");
52
-        }
53
-        if($min_length > 0 && strlen($fPassword) < $min_length) {
54
-            $pPassword_password_text .= _("The password you supplied is too short!");
55
-        }
56
-        bindtextdomain('squirrelmail', SM_PATH . 'locale');
57
-        textdomain('squirrelmail');
58
-    }
59
-
60
-    if ($error != 1) {
61
-        $success = $user->changePassword($fPassword_current, $fPassword);
62
-
63
-        if ($success) {
64
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
65
-            textdomain('postfixadmin');
66
-            $tMessage = _("Your password has been changed!");
67
-            $stMessage = _("Please sign out and log back again with your new password!");
68
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
69
-            textdomain('squirrelmail');
70
-        }
71
-        else {
72
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
73
-            textdomain('postfixadmin');
74
-            $tMessage = _("Unable to change your password!");
75
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
76
-            textdomain('squirrelmail');
77
-        }
78
-    }
79
-}
80
-bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
81
-textdomain('postfixadmin');
82
-echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
83
-    <tr>
84
-    <td align=\"center\"><b>". _("Options") ." - ". _("Change Password")." </b>
85
-    <table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
86
-    <tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
87
-    <table align=\"center\" width=\"95%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
88
-    <td bgcolor=\"$color[3]\" align=\"center\"><b>" ._("Change your login password") ."\n
89
-    </b></td>
90
-    </tr>
91
-    <tr>
92
-    <td bgcolor=\"$color[0]\" align=\"center\"><form name=\"mailbox\" method=\"post\">
93
-    <b>$tMessage<b><font color=red><br>
94
-    <a href=\"../../src/signout.php\" target=\"_top\">$stMessage</a>
95
-    ".$pPassword_admin_text."\n
96
-    ".$pPassword_password_current_text."\n
97
-    ".$pPassword_password_text."\n
98
-    </b><table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
99
-    <tr>
100
-    <td width=\"37%\"><b>". _("Alias") . ":\n</td>
101
-    <td width=\"63%\">{$_SESSION['username']}</td>
102
-    </tr>
103
-    <tr>
104
-    <td><b>". _("Password current"). ":\n</td>
105
-    <td><input type=\"password\" name=\"fPassword_current\" size=\"30\" /></td>
106
-    </tr>
107
-    <tr>
108
-    <td><b>". _("Password new"). ":\n</td>
109
-    <td><input type=\"password\" name=\"fPassword\" size=\"30\" /></td>
110
-    </tr>
111
-    <tr>
112
-    <td><b>". _("Password new again"). ":\n</td>
113
-    <td><input type=\"password\" name=\"fPassword2\" size=\"30\" /></td>
114
-    </tr>
115
-    <tr>
116
-    <td>&nbsp;</td>
117
-    <td><input type=\"submit\" name=\"submit\" value=\"" ._("Change Password") . "\" /></td>
118
-    <td>&nbsp;</td>
119
-    </tr>
120
-    </table>
121
-    <TT></TT></FORM></td>
122
-    </tr><tr><td bgcolor=\"$color[4]\" align=\"left\">&nbsp;</td>
123
-    </tr></table><BR>
124
-    </td>
125
-    </tr></table></td></tr></table>";
126
-bindtextdomain('squirrelmail', SM_PATH . 'locale');
127
-textdomain('squirrelmail');
128
-?>

+ 0
- 165
postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/postfixadmin_forward.php View File

@@ -1,165 +0,0 @@
1
-<?php
2
-
3
-require_once(dirname(__FILE__) . '/common.php');
4
-
5
-
6
-
7
-$USERID_USERNAME = $username;
8
-$tmp = preg_split ('/@/', $USERID_USERNAME);
9
-$USERID_LOCALPART = $tmp[0];
10
-$USERID_DOMAIN = $tmp[1];
11
-
12
-$xmlrpc = get_xmlrpc();
13
-$alias = $xmlrpc->getProxy('alias');
14
-do_header();
15
-// Normal page request (GET)
16
-if ($_SERVER['REQUEST_METHOD'] == "GET")
17
-{
18
-    $row = $alias->get();
19
-    if($row === false) {
20
-        bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
21
-        textdomain('postfixadmin');
22
-        $tMessage = _("Unable to locate alias!");
23
-        bindtextdomain('squirrelmail', SM_PATH . 'locale');
24
-        textdomain('squirrelmail');
25
-        exit(0);
26
-    }
27
-}
28
-
29
-if ($_SERVER['REQUEST_METHOD'] == "POST")
30
-{
31
-    $pEdit_alias_goto = _("To");
32
-
33
-    $fGoto = $_POST['fGoto'];
34
-
35
-    // reform string into a list...
36
-    $goto = preg_replace ('/\r\n/', ',', $fGoto);
37
-    $goto = preg_replace ('/[\s]+/i', '', $goto);
38
-    $goto = preg_replace ('/\,*$/', '', $goto);
39
-    $array = preg_split ('/,/', $goto);
40
-    $error = 0;
41
-    // check that we have valid addresses in the list
42
-
43
-    foreach($array as $key => $email_address) 
44
-    {
45
-        if (empty($email_address))
46
-        {
47
-            unset($array[$key]);	
48
-            continue;
49
-        }
50
-        if (!check_email($email_address)) 
51
-        {
52
-            $error = 1;
53
-            $tGoto = $goto;
54
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
55
-            textdomain('postfixadmin');
56
-            $tMessage = _("The email address that you have entered is not valid:") . " $email_address</font>";
57
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
58
-            textdomain('squirrelmail');
59
-        }
60
-    }
61
-    if ($error != 1) {
62
-        $flag = 'forward_and_store'; // goto = $USERID_USERNAME;
63
-        $success = $alias->update($array, $flag);
64
-        if(!$success) {
65
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
66
-            textdomain('postfixadmin');
67
-            $tMessage = _("Unable to modify the alias!");
68
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
69
-            textdomain('squirrelmail');
70
-        }
71
-        else {
72
-
73
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
74
-            textdomain('postfixadmin');
75
-            echo "<p align=center><b>". _("Alias successfully changed!"). "\n</b></p>";
76
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
77
-            textdomain('squirrelmail');
78
-            echo "<p align=center><a href=\"javascript:history.go(-1)\">". _("Click here to go back") ."</a></p>";
79
-            exit;
80
-        }
81
-    }
82
-}
83
-bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
84
-textdomain('postfixadmin');
85
-
86
-if(!isset($tMessage)) {
87
-    $tMessage = '';
88
-}
89
-echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
90
-<tr>
91
-<td align=\"center\" bgcolor=\"$color[0]\" colspan=\"2\">
92
-<b>". _("Options") ." - ". _("Edit Alias"). " </b>
93
-<table align=\"center\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
94
-<tr>
95
-<td bgcolor=\"$color[4]\" align=\"center\">
96
-<table align=\"center\" width=\"100%\">
97
-<tr>
98
-<td align=\"left\">". _("Edit an alias* for your email address.<br />One entry per line."). " </td>
99
-</tr>
100
-<tr>
101
-<td align=\"left\">". _("*Additional forward-aliases always receive messages BCC!"). "\n
102
-</tr>
103
-<tr>
104
-<td align=\"left\">" . _("To remove an alias, simply delete its line from the text box.") . "</td>
105
-</tr>
106
-</table>
107
-<table align=\"center\" width\"95%\" cellpadding=\"5\" cellspacing=\"1\">
108
-<form name=\"mailbox\" method=\"post\">
109
-<tr>
110
-<td bgcolor=\"$color[3]\" align=\"center\"><b>". _("Edit Forwards"). "</b>
111
-</td>
112
-</tr>
113
-<tr>
114
-<td bgcolor=\"$color[5]\" align=\"center\">$tMessage
115
-<table cellpadding=\"5\" cellspacing=\"1\">
116
-<tr>
117
-<th align=\"left\">". _("Alias"). ":\n
118
-</th>
119
-<td align=\"left\">" . $_SESSION['username'] . "</td>
120
-</tr>
121
-<tr>
122
-<th>&nbsp;</th>
123
-<td>&nbsp;</td>
124
-</tr>
125
-<tr>
126
-<th align=\"left\" valign=\"top\">". _("To"). ":\n</th>
127
-<td>
128
-<textarea rows=\"8\" cols=\"50\" name=\"fGoto\">";
129
-bindtextdomain('squirrelmail', SM_PATH . 'locale');
130
-textdomain('squirrelmail');
131
-$aliases = $alias->get();
132
-foreach($aliases as $address) {
133
-    if ($address == "" || $address == NULL) { continue; }
134
-    print "$address\n";
135
-}
136
-bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
137
-textdomain('postfixadmin');
138
-echo "
139
-</textarea>
140
-</td>
141
-</tr>
142
-<tr>
143
-<th>&nbsp;</th>
144
-<td>&nbsp;</td>
145
-</tr>
146
-<tr>
147
-<th>&nbsp;</th>
148
-<td align=\"left\"colspan=\"2\">
149
-<input type=\"submit\" name=\"submit\" value=\"" . _("Edit Alias") . "\">
150
-</td>
151
-</tr>
152
-</table>
153
-</td>
154
-</tr>
155
-</table>
156
-</form>
157
-</td>
158
-</tr>
159
-</table>
160
-</td></tr>
161
-</table>
162
-";
163
-bindtextdomain('squirrelmail', SM_PATH . 'locale');
164
-textdomain('squirrelmail');
165
-?>

+ 0
- 157
postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/postfixadmin_vacation.php View File

@@ -1,157 +0,0 @@
1
-<?php
2
-
3
-require_once(dirname(__FILE__) . '/common.php');
4
-
5
-$xmlrpc = get_xmlrpc();
6
-$vacation = $xmlrpc->getProxy('vacation');
7
-
8
-$VACCONFTXT = _("I will be away from <date> until <date>. For urgent matters you can contact <contact person>.");
9
-bindtextdomain('squirrelmail', SM_PATH . 'locale');
10
-textdomain('squirrelmail');
11
-$VACCONF = <<<EOM
12
-$VACCONFTXT
13
-EOM;
14
-
15
-do_header();
16
-
17
-$USERID_USERNAME = $username;
18
-$tmp = preg_split ('/@/', $USERID_USERNAME);
19
-$USERID_DOMAIN = $tmp[1];
20
-
21
-if ($_SERVER['REQUEST_METHOD'] == "GET")
22
-{
23
-    $details = $vacation->getDetails();
24
-    if($vacation->checkVacation()) {
25
-
26
-        bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
27
-        textdomain('postfixadmin');
28
-        $tMessage = _("You already have an auto response configured!");
29
-        bindtextdomain('squirrelmail', SM_PATH . 'locale');
30
-        textdomain('squirrelmail');
31
-        bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
32
-        textdomain('postfixadmin');
33
-        echo "<table bgcolor=\"#b8cbdc\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\"><tr>
34
-            <td align=\"center\"><b>". _("Options") ." - ". _("Auto Response") ."</b>
35
-            <table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
36
-            <tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
37
-            <table align=\"center\" width=\"70%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
38
-            <td bgcolor=\"$color[3]\" align=\"center\"><b>". _("Auto Response") ."\n
39
-            </b></td></tr><tr>
40
-            <td bgcolor=\"$color[0]\" align=\"center\"><form name=\"vacation\" method=\"post\">
41
-            <table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
42
-            <tr>
43
-            <td><center>$tMessage<p></center></td>
44
-            </tr>
45
-            <tr>
46
-            <td> <div align=\"center\">
47
-            <input type=\"submit\" name=\"fBack\" value=\"" . _("Coming Back"). "\" />
48
-            </div></td>
49
-            </tr>
50
-            </table>
51
-            <TT></TT></FORM>
52
-            </td>
53
-            </tr><tr><td bgcolor=\"$color[4]\" align=\"left\">&nbsp;</td>
54
-            </tr></table><BR></td></tr></table></td></tr></table>";
55
-        bindtextdomain('squirrelmail', SM_PATH . 'locale');
56
-        textdomain('squirrelmail');
57
-    }
58
-    else
59
-    {
60
-        $tSubject = "Out of Office";
61
-        $tSubject = $details['subject'];
62
-        $VACCONF = $details['body'];
63
-
64
-        $tMessage = '';
65
-        bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
66
-        textdomain('postfixadmin');
67
-        echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
68
-            <tr>
69
-            <td align=\"center\"><b>". _("Options") ." - ". _("Auto Response") ." </b>
70
-            <table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
71
-            <tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
72
-            <table align=\"center\" width=\"70%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
73
-            <td bgcolor=\"$color[3]\" align=\"center\"><b>" . _("Auto Response") ."\n
74
-            </b></td></tr><tr>
75
-            <td bgcolor=\"$color[0]\" align=\"center\"><form name=\"vacation\" method=\"post\">$tMessage
76
-            <table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr>
77
-            <td width=\"23%\">". _("Subject") .":\n</td>
78
-            <td width=\"2%\">&nbsp;</td>
79
-            <td width=\"69%\"><input type=\"text\" name=\"fSubject\" value=\"" . $tSubject . "\" /></td>
80
-            <td width=\"2%\">&nbsp;</td>
81
-            <td width=\"4%\">&nbsp;</td>
82
-            </tr><tr>
83
-            <td>". _("Body") .":\n</td>
84
-            <td>&nbsp;</td>
85
-            <td><textarea rows=\"10\" cols=\"80\" name=\"fBody\">$VACCONF\n
86
-            </textarea></td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td>
87
-            <td><input type=\"submit\" name=\"fAway\" value=\"" . _("Going Away") . "\" /></td>
88
-            <td>&nbsp;</td><td>&nbsp;</td></tr>
89
-            </table><TT></TT></FORM></td>
90
-            </tr><tr><td bgcolor=\"$color[4]\" align=\"left\">&nbsp;</td>
91
-            </tr></table><BR></td></tr></table></td></tr></table>";
92
-        bindtextdomain('squirrelmail', SM_PATH . 'locale');
93
-        textdomain('squirrelmail');
94
-    }
95
-}
96
-
97
-if ($_SERVER['REQUEST_METHOD'] == "POST")
98
-{
99
-    $fBack = null;
100
-    $fAway = null;
101
-    foreach(array('fBack', 'fAway', 'fSubject', 'fBody') as $key) {
102
-        $$key = null;
103
-        if(isset($_POST[$key])) {
104
-            $$key = $_POST[$key];
105
-        }
106
-    }
107
-    
108
-    if (!empty($fBack))
109
-    {
110
-        $success = $vacation->remove();
111
-
112
-        if(!$success)
113
-        {
114
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
115
-            textdomain('postfixadmin');
116
-            $tMessage = _("Unable to update your auto response settings!");
117
-            echo "<p>This may signify an error; please contact support (1)</p>";
118
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
119
-            textdomain('squirrelmail');
120
-        }
121
-        else
122
-        {
123
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
124
-            textdomain('postfixadmin');
125
-            echo "<p align=center><b>". _("Your auto response has been removed!") ."</b></p>";
126
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
127
-            textdomain('squirrelmail');
128
-
129
-        }
130
-    }
131
-
132
-    if (!empty ($fAway))
133
-    {
134
-        // add record into vacation
135
-        $success = $vacation->setAway($fSubject, $fBody);
136
-
137
-        if(!$success) {
138
-            $error = 1;
139
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
140
-            textdomain('postfixadmin');
141
-            $tMessage = _("Unable to update your auto response settings!");
142
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
143
-            textdomain('squirrelmail');
144
-        }
145
-        else
146
-        {
147
-            bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
148
-            textdomain('postfixadmin');
149
-            echo "<p align=center><b>". _("Your auto response has been set!") ."</b></p>";
150
-            bindtextdomain('squirrelmail', SM_PATH . 'locale');
151
-            textdomain('squirrelmail');
152
-
153
-        }
154
-    }
155
-}
156
-
157
-?>

+ 0
- 61
postfixadmin/postfixadmin-3.0/ADDITIONS/squirrelmail-plugin/setup.php View File

@@ -1,61 +0,0 @@
1
-<?php
2
-// vim:ts=4:sw=4:et
3
-include_once(SM_PATH . 'functions/i18n.php');
4
-
5
-function squirrelmail_plugin_init_postfixadmin() {
6
-    include(dirname(__FILE__) . '/config.php');
7
-    global $squirrelmail_plugin_hooks;
8
-
9
-    $squirrelmail_plugin_hooks['optpage_register_block']['postfixadmin'] = 'postfixadmin_optpage_register_block';
10
-
11
-}
12
-
13
-function postfixadmin_version(){
14
-    return '2.3.0';
15
-}
16
-
17
-function postfixadmin_optpage_register_block () {
18
-    // Gets added to the user's OPTIONS page.
19
-    global $optpage_blocks;
20
-    global $AllowVacation;
21
-    global $AllowChangePass;
22
-
23
-    //  if ( !soupNazi() ) {
24
-
25
-    bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
26
-    textdomain('postfixadmin');
27
-    $optpage_blocks[] = array (
28
-        'name' => _("Forwarding"),
29
-        'url'  => '../plugins/postfixadmin/postfixadmin_forward.php',
30
-        'desc' => _("Here you can create and edit E-Mail forwards."),
31
-        'js'   => FALSE
32
-    );
33
-    bindtextdomain('squirrelmail', SM_PATH . 'locale');
34
-    textdomain('squirrelmail');
35
-
36
-    bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
37
-    textdomain('postfixadmin');
38
-    if($AllowVacation) {
39
-        $optpage_blocks[] = array(
40
-            'name' => _("Auto Response"),
41
-            'url'  => '../plugins/postfixadmin/postfixadmin_vacation.php',
42
-            'desc' => _("Set an OUT OF OFFICE message or auto responder for your mail."),
43
-            'js'   => false
44
-        );
45
-        bindtextdomain('squirrelmail', SM_PATH . 'locale');
46
-        textdomain('squirrelmail');
47
-    }
48
-    bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
49
-    textdomain('postfixadmin');
50
-    if($AllowChangePass) {
51
-        $optpage_blocks[] = array(
52
-            'name' => _("Change Password"),
53
-            'url'  => '../plugins/postfixadmin/postfixadmin_changepass.php',
54
-            'desc' => _("Change your mailbox password."),
55
-            'js'   => false
56
-        );
57
-        bindtextdomain('squirrelmail', SM_PATH . 'locale');
58
-        textdomain('squirrelmail');
59
-    }
60
-}
61
-?>

+ 0
- 185
postfixadmin/postfixadmin-3.0/ADDITIONS/virtualmaildel.php View File

@@ -1,185 +0,0 @@
1
-<?php
2
-//
3
-// Virtual Mail Delete
4
-// by George Vieira <george at citadelcomputer dot com dot au>
5
-//
6
-// You can run this from your crontab with something like
7
-//
8
-// 0 4 * * * *    vmail    php -q virtualmaildel.php >/dev/null
9
-
10
-	//
11
-	// Setup location of postfixadmin config files. Needed to login to mysql
12
-	//
13
-	$conf		= '/home/httpd/mail/admin/config.inc.php';
14
-
15
-	//
16
-	// Where's the homedir accounts stored. (GET THIS RIGHT OTHERWISE IT THINK NONE EXIST AND DELETES ALL)
17
-	//
18
-	$homedir	= '/home/virtual';
19
-
20
-	//
21
-	// Make sure everything is everything before continuing
22
-	//
23
-	if ( ! file_exists( $conf ) )
24
-		die( "Cannot find config file $conf\n" );
25
-
26
-	if ( ! is_dir( $homedir ) )
27
-		die( "Cannot find home directory for virtual mailboxes in $homedir\n" );
28
-
29
-	//
30
-	// Load mysql authentication from postfixadmin
31
-	//
32
-	include( $conf );
33
-
34
-	//
35
-	// Recursive Delete Function
36
-	//
37
-	function deldir($dir)
38
-	{
39
-		$current_dir = opendir($dir);
40
-		while($entryname = readdir($current_dir))
41
-		{
42
-			if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!=".."))
43
-			{
44
-				deldir("${dir}/${entryname}");
45
-			}
46
-			elseif($entryname != "." and $entryname!="..")
47
-			{
48
-				unlink("${dir}/${entryname}");
49
-			}
50
-		}
51
-		closedir($current_dir);
52
-		@rmdir(${dir});
53
-	}
54
-
55
-// --- Main Start ---
56
-
57
-	//
58
-	// Get list of directories
59
-	//
60
-	$fr = opendir( $homedir );
61
-	while ( ($domain = readdir($fr)) !== false)
62
-	{
63
-		//
64
-		// Check if it's a dir
65
-		//
66
-		if ( $domain != "." and $domain != ".." and filetype($homedir .'/'. $domain) == "dir" )
67
-		{
68
-			//
69
-			// Open the (assumed) DOMAIN directory
70
-			//
71
-			$ff = opendir( $homedir .'/'. $domain );
72
-			while ( ($user = readdir($ff)) !== false)
73
-			{
74
-				//
75
-				// Check for directories assuming it's a user account
76
-				//
77
-				if ( $user!="." and $user!=".." and filetype($homedir .'/'. $domain .'/'. $user) == "dir" )
78
-				{
79
-					//
80
-					// if the dir 'new' exists inside then it's an account
81
-					//
82
-					if ( file_exists($homedir .'/'. $domain .'/'. $user .'/'. "new") )
83
-					{
84
-						$dir[$domain][$user] = "";
85
-					}
86
-					else
87
-					{
88
-						//
89
-						// Alert that the dir doesn't have a 'new' dir, possibly not an account. Leave it.
90
-						//
91
-						echo "UNKNOWN  : " . $homedir ."/". $domain ."/". $user ."/new NOT FOUND. Possibly not an account. Leaving untouched\n";
92
-					}
93
-				}
94
-			} 
95
-		}
96
-	} 
97
-	//
98
-	// OK, got an array of accounts from the dir, Now connect to the DB and check them
99
-	//
100
-	$conx = mysql_connect( $CONF['database_host'],$CONF['database_user'],$CONF['database_password'] );
101
-	//
102
-	// Is there a problem connecting?
103
-	//
104
-	if ( $conx != false )
105
-	{
106
-		//
107
-		// Select the database
108
-		//
109
-		mysql_select_db( $CONF['database_name'] , $conx) or die ("Can't access database postfix : " . mysql_error()); 
110
-
111
-		//
112
-		// Select all mailboxes to verify against dirs listed in array
113
-		//
114
-		$query = "SELECT * FROM mailbox";
115
-		$result = mysql_query( $query );
116
-
117
-		//
118
-		// Query the mailbox table
119
-		//
120
-		if ( $result != false )
121
-		{
122
-			//
123
-			// Fetch the list of results
124
-			//
125
-			while ( $row = mysql_fetch_assoc( $result ) )
126
-			{
127
-				//
128
-				// Pull apart the maildir field, needed to figure out the directory structure to compare
129
-				//
130
-				$strip = explode("/",$row['maildir']);
131
-				//
132
-				// Unset the array if it exists. This stops it being erased later.
133
-				//
134
-				unset( $dir[ $strip[0] ][ $strip[1] ] );
135
-			}
136
-			//
137
-			// If there are results. unset the domain too.
138
-			//
139
-			if ( count($dir[$strip[0]])==0 and mysql_num_rows($result)>0 )
140
-				unset( $dir[$strip[0]] );
141
-		}
142
-		else
143
-			die( "Failed SELECT in mailboxes\n" );
144
-	}
145
-	else
146
-		die( 'Cannot connect to the database!\n' );
147
-
148
-	//
149
-	// OK, time to clean up. All known users/domains have been removed from the list.
150
-	//
151
-
152
-	//
153
-	// If the array still exists (incase nothing there)
154
-	//
155
-	if ( is_array($dir) )
156
-	{
157
-		//
158
-		// Go through each dir
159
-		//
160
-		foreach ( $dir as $key => $value )
161
-		{
162
-			//
163
-			// Is this a user array?
164
-			//
165
-			if ( is_array( $value) )
166
-			{
167
-				//
168
-				// Go through and nuke the folders
169
-				//
170
-				foreach ( $value as $user => $value2 )
171
-				{
172
-					//
173
-					// Nuke.. need any more explanations?
174
-					//
175
-					echo "REMOVING : " . $homedir."/".$key."/".$user."\n" ;
176
-					deldir( $homedir."/".$key."/".$user ) ;
177
-				}
178
-			}
179
-		}
180
-	}
181
-	//
182
-	// And we are outta here....
183
-	//
184
-	echo "Cleanup process completed\n";
185
-?>

+ 0
- 1015
postfixadmin/postfixadmin-3.0/CHANGELOG.TXT
File diff suppressed because it is too large
View File


+ 0
- 214
postfixadmin/postfixadmin-3.0/DOCUMENTS/DOVECOT.txt View File

@@ -1,214 +0,0 @@
1
-#
2
-# Dovecot configuration for Postfix Admin
3
-# Originally written by: Massimo <AndyCapp> Danieli
4
-# Revised by: Sampsa Hario <shario> for Dovecot v1.0
5
-# Revised by: David Goodwin <david@palepurple.co.uk> for Dovecot 2.1.x  (2014/01/02)
6
-#
7
-
8
-More complete Dovecot documentation:
9
-
10
-http://wiki.dovecot.org/Quota
11
-http://wiki.dovecot.org/Quota/Dict
12
-http://www.opensourcehowto.org/how-to/mysql/mysql-users-postfixadmin-postfix-dovecot--squirrelmail-with-userprefs-stored-in-mysql.html
13
-
14
-
15
-Here are the relevant parts of Dovecot v2.1.x configuration for Postfixadmin setup.
16
-
17
-Please refer to Dovecot documentation for complete information.
18
-
19
-The setup gets userdb and passdb info from MySQL as well as quotas, and 
20
-uses dict backend to store used quotas as key=value pairs so that they can
21
-be viewed real-time in Postfixadmin.
22
-
23
-
24
-1. Dovecot setup
25
------------------
26
-
27
-A basic /etc/dovecot/dovecot.conf is as follows, this was generated using 'dovecot -n' on a vanilla install and then
28
-changing to talk to a PostgreSQL or MySQL database. 
29
-
30
-# BEGIN /etc/dovecot/dovecot.conf:
31
-# Change this to where your mail root is, this needs to match whatever structure postfix expects....
32
-
33
-mail_location = maildir:/var/mail/vmail/%u/
34
-
35
-namespace inbox {
36
-  inbox = yes
37
-  location = 
38
-  mailbox Drafts {
39
-    special_use = \Drafts
40
-  }
41
-  mailbox Junk {
42
-    special_use = \Junk
43
-  }
44
-  mailbox Sent {
45
-    special_use = \Sent
46
-  }
47
-  mailbox "Sent Messages" {
48
-    special_use = \Sent
49
-  }
50
-  mailbox Trash {
51
-    special_use = \Trash
52
-  }
53
-  prefix = 
54
-}
55
-
56
-protocols = "imap pop3"
57
-# change to 'no' if you don't have ssl cert/keys, and comment out ssl_cert/ssl_key
58
-ssl = yes 
59
-ssl_cert = </etc/dovecot/private/dovecot.pem
60
-ssl_key = </etc/dovecot/private/dovecot.pem
61
-
62
-# login is for outlook express smtpd auth
63
-auth_mechanisms = plain login
64
-
65
-# If you're having trouble, try uncommenting these :
66
-#auth_debug = yes
67
-#auth_debug_passwords = yes
68
-
69
-userdb { 
70
-    driver = sql
71
-    args = /etc/dovecot/dovecot-sql.conf 
72
-}
73
-
74
-passdb { 
75
-    driver = sql
76
-    args = /etc/dovecot/dovecot-sql.conf 
77
-}
78
-
79
-# Uncomment this if you want Postfix to be able to do smtpd auth through dovecot
80
-# At a minimum Postfix probably needs : smtpd_sasl_type = dovecot 
81
-# And additionally: smtpd_sasl_path = private/auth
82
-#service auth {
83
-#    unix_listener /var/spool/postfix/private/auth {
84
-#        mode = 0660
85
-#        user = postfix
86
-#        group = postfix
87
-#    }
88
-#    user = postfix
89
-#    group = postfix
90
-#}
91
-
92
-# Needs to match Postfix virtual_uid_maps
93
-first_valid_uid = 1001 
94
-
95
-# allow plaintext auth (change to 'yes' to block plaintext passwords)
96
-disable_plaintext_auth = no
97
-
98
-#END
99
-
100
-
101
-2. Dovecot *sql setup
102
-----------------------
103
-
104
-Below you'll find the relevant part of dovecot-sql.conf file regarding our
105
-setup. 
106
-
107
-Things you will probably need to change are db connection settings (connect=)
108
-and the default_pass_scheme.
109
-
110
-#BEGIN /etc/dovecot/dovecot-sql.conf
111
-
112
-connect = host=localhost dbname=postfix user=postfix password=postfix
113
-# Use either 
114
-driver = mysql
115
-# Or 
116
-# driver = pgsql
117
-
118
-# Default password scheme - change to match your Postfixadmin setting.
119
-# depends on your $CONF['encrypt'] setting:
120
-# md5crypt  -> MD5-CRYPT
121
-# md5       -> PLAIN-MD5
122
-# cleartext -> PLAIN
123
-default_pass_scheme = MD5-CRYPT
124
-
125
-# Query to retrieve password. user can be used to retrieve username in other
126
-# formats also.
127
-
128
-password_query = SELECT username AS user,password FROM mailbox WHERE username = '%u' AND active='1'
129
-
130
-# Query to retrieve user information, note uid matches dovecot.conf AND Postfix virtual_uid_maps parameter.
131
-user_query = SELECT maildir, 1001 AS uid, 1001 AS gid FROM mailbox WHERE username = '%u' AND active='1'
132
-
133
-
134
-# MYSQL :
135
-user_query = SELECT CONCAT('/var/vmail/mail/', maildir) AS home, 1001 AS uid, 1001 AS gid, 
136
-	CONCAT('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND active='1'
137
-# PostgreSQL : (no Quota though) :
138
-# user_query = SELECT '/var/vmail/mail/' || maildir AS home, 1001 as uid, 1001 as gid FROM mailbox WHERE username = '%u' AND active = '1'
139
-
140
-#END /etc/dovecot/dovecot-sql.conf
141
-
142
-
143
-
144
-
145
-
146
-3. Dovecot v1.0 quota support (optional)
147
-----------------------------------------
148
-
149
-Please note that you need to use Dovecot's own local delivery agent to
150
-enforce and update quotas. Then you can view real-time used quotas in
151
-Postfixadmin.
152
-
153
-Add to dovecot.conf:
154
-
155
-## IMAP quota
156
-protocol imap {
157
-  quota = dict:storage=200000 proxy::quota
158
-}
159
-
160
-## POP quota
161
-protocol pop3 {
162
-  mail_plugins = quota
163
-}
164
-
165
-## Local Delivery Agent
166
-protocol lda {
167
-  mail_plugins = quota
168
-}
169
-
170
-## Dictionary DB proxy
171
-dict {
172
-  quota = mysql:/etc/dovecot-dict-quota.conf
173
-}
174
-
175
-## Default quota values
176
-plugin {
177
-quota = dict:storage=200000 proxy::quota
178
-}
179
-
180
-
181
-Change dovecot-sql.conf to return quota values:
182
-
183
-for MySQL:
184
-user_query = SELECT maildir, 1001 AS uid, 1001 AS gid, CONCAT('dict:storage=',floor(quota/1000),' proxy::quota') as quota FROM mailbox WHERE username = '%u' AND active='1'
185
-
186
-for PostgreSQL:
187
-user_query = SELECT maildir, 1001 AS uid, 1001 AS gid, 'dict:storage=' || floor(quota/1000) || '::proxy::quota' as quota FROM mailbox WHERE username = '%u' AND active='1'
188
-
189
-
190
-Create file dovecot-dict-quota.conf:
191
-
192
-driver = mysql
193
-connect = host=localhost dbname=postfix user=postfix password=postfix
194
-default_pass_scheme = MD5-CRYPT
195
-table = quota
196
-select_field = current
197
-where_field = path
198
-username_field = username
199
-
200
-
201
-Create database in Mysql:
202
-(This is automatically done by postfixadmin's setup.php)
203
-
204
-Enable quota support in Postfixadmin config.inc.php:
205
-
206
-$CONF['used_quotas'] = 'YES';
207
-$CONF['quota'] = 'YES';
208
-
209
-Note: The above text describes the configuration for dovecot 1.0 & 1.1 quota table format.
210
-
211
-If you use dovecot 1.2 or newer, 
212
-- use the 'quota2' table (also created by setup.php)
213
-- set $CONF['new_quota_table'] = 'YES'
214
-

+ 0
- 111
postfixadmin/postfixadmin-3.0/DOCUMENTS/UPGRADE.txt View File

@@ -1,111 +0,0 @@
1
-#
2
-# Postfix Admin
3
-# by Mischa Peters <mischa at high5 dot net>
4
-# Copyright (c) 2002 - 2005 High5!
5
-# Licensed under GPL for more info check GPL-LICENSE.TXT
6
-#
7
-
8
-REQUIRED!!
9
-----------
10
-- You are using Postfix 2.0 or higher.
11
-- You are using Apache 1.3.27 / Lighttpd 1.3.15 or higher.
12
-- You are using PHP 5.1.2 or higher.
13
-- You are using MySQL 3.23 or higher OR PostgreSQL v7.4+
14
-
15
-
16
-READ THIS FIRST!
17
-----------------
18
-
19
-This document describes upgrading from an older PostfixAdmin version
20
-(>= v1.5x)
21
-
22
-It's recommend that you install Postfix Admin in a new folder and not
23
-on-top of the old install!! (At the very least, make sure you have backups of 
24
-the database and relevant filesystem!)
25
-
26
-When upgrading Postfix Admin, make sure you backup your database before
27
-running upgrade.php.
28
-
29
-
30
-1. Backup the Database
31
-----------------------
32
-When you install from a previous version make sure you backup your database
33
-first. There are a lot of changes in the database structure since Postfix Admin
34
-1.5.4.
35
-
36
-  $ mysqldump -a -u root -p > /tmp/postfixadmin-backup.sql
37
-or
38
-  $ pg_dump -ad -u postfix postfix > /tmp/postfixadmin-backup.sql
39
-
40
-
41
-2. Unarchive new Postfix Admin
42
-------------------------------
43
-Make sure that you are in your WWW directory and then unarchive the
44
-Postfix Admin archive (whatever the filename is):
45
-
46
-  $ tar -zxvf postfixadmin-X.X.tgz
47
-
48
-
49
-3. Change permissions
50
-----------------------
51
-Since the database password is stored in the config.inc.php it's a good idea
52
-to have change the permissions for Postfix Admin.
53
-
54
-  $ cd /usr/local/www/postfixadmin
55
-  $ find -type f -print0 | xargs -0 chmod 640
56
-  $ find -type f -print0 | xargs -0 chown root:www
57
-
58
-(the last command assumes your Apache is running with group "www")
59
-
60
-Since version 2.4 we use smarty templates. That means the templates_c directory
61
-needs to be writeable for your webserver.
62
-
63
-  $ chown -R www-data templates_c/
64
-
65
-(if your Apache runs as user "www-data")
66
-
67
-
68
-4. Configure
69
-------------
70
-Check the config.inc.php file. There you can specify settings that are
71
-relevant to your setup.
72
-
73
-Comparing config.inc.php with your previous using "diff" might save you some
74
-time.
75
-
76
-You can use a config.local.php file to contain your local settings. These will override any 
77
-defined in config.inc.php - and save some time when upgrading to a new version of PostfixAdmin ;-)
78
-
79
-5. Run setup.php
80
-----------------------------------------
81
-
82
-Access setup.php through a web browser.
83
-
84
-It will attempt to upgrade your database, and also allow you to create a superadmin user.
85
-(In case the database upgrade fails, you can run setup.php?debug=1 to see the last executed query.)
86
-
87
-From version 2.3, you need to specify a setup_password in config.inc.php - 
88
-setup.php should guide you through this process. If you do not have a setup_password, type one
89
-into the form, and setup.php will echo out the hashed value (which needs to go into config.inc.php).
90
-The setup_password removes the requirement for you to delete setup.php, and also closes a security hole.
91
-
92
-Since version 2.2 of Postfixadmin, setup.php can perform the needed database 
93
-updates automatically .
94
-
95
-If you update from 2.1 or older, also create a superadmin account using setup.php.
96
-
97
-Note that admin/ has been merged into the main directory. Login with the
98
-superadmin account to setup domains and domain admins.
99
-
100
-6. Upgrade your postfix config
101
-------------------------------
102
-
103
-Since version 2.3, PostfixAdmin supports alias domains ($CONF['alias_domain']).
104
-If you want to use them, you have to add some queries to your postfix config -
105
-see POSTFIX_CONF for details.
106
-
107
-
108
-7. Done
109
--------
110
-This is all that is needed. Fire up your browser and go to the site that you
111
-specified to host Postfix Admin.

+ 0
- 159
postfixadmin/postfixadmin-3.0/INSTALL.TXT View File

@@ -1,159 +0,0 @@
1
-#
2
-# Postfix Admin
3
-# by Mischa Peters <mischa at high5 dot net>
4
-# Copyright (c) 2002 - 2005 High5!
5
-# Licensed under GPL for more info check GPL-LICENSE.TXT
6
-#
7
-
8
-REQUIRED!!
9
-----------
10
-- You are using Postfix 2.0 or higher.
11
-- You are using Apache 1.3.27 / Lighttpd 1.3.15 or higher.
12
-- You are using PHP 5.1.2 or higher.
13
-- You are using MySQL 3.23 or higher (5.x recommended) OR PostgreSQL 7.4 (or higher)
14
-
15
-
16
-READ THIS FIRST!
17
-----------------
18
-When this is an upgrade from a previous version of Postfix Admin, please read 
19
-DOCUMENTS/UPGRADE.TXT also!
20
-
21
-If you need to setup Postfix to be able to handle Virtual Domains and Virtual
22
-Users check out:
23
-
24
-  - the PostfixAdmin documentation in the DOCUMENTS/ directory
25
-  - our wiki at http://sourceforge.net/apps/mediawiki/postfixadmin/
26
-
27
-There are also lots of HOWTOs around the web. Be warned that many of them 
28
-(even those listed below) may be outdated or incomplete. 
29
-Please stick to the PostfixAdmin documentation, and use those HOWTOs only if
30
-you need some additional information that is missing in the PostfixAdmin 
31
-DOCUMENTS/ folder.
32
-  - http://codepoets.co.uk/postfixadmin-postgresql-courier-squirrelmail-debian-etch-howto-tutorial (Debian+Courier+PostgreSQL+Postfix+Postfixadmin)
33
-  - http://bliki.rimuhosting.com/space/knowledgebase/linux/mail/postfixadmin+on+debian+sarge (Postfix+MySQL+Postfixadmin+Dovecot)
34
-  - http://en.gentoo-wiki.com/wiki/Virtual_mail_server_using_Postfix,_Courier_and_PostfixAdmin (Postfix+MySQL+Postfixadmin+Courier)
35
-
36
-
37
-1. Unarchive new Postfix Admin
38
-------------------------------
39
-Make sure that you are in your WWW directory and then unarchive the
40
-Postfix Admin archive (whatever the filename is):
41
-
42
-  $ tar -zxvf postfixadmin-$version.tgz
43
-
44
-
45
-2. Setup a Database
46
--------------------
47
-
48
-With your chosen/preferred database server (i.e. MySQL or PostgreSQL), 
49
-you need to create a new database. A good name for this could be :
50
-
51
-  postfix
52
-
53
-The mechanics of creating the database vary depending on which server 
54
-you are using. Most users will find using phpMyAdmin or phpPgAdmin the
55
-easiest route.
56
-
57
-If you wish to use the command line, you'll need to do something like :
58
-
59
-For MySQL:
60
-  CREATE DATABASE postfix;
61
-  CREATE USER 'postfix'@'localhost' IDENTIFIED BY 'choose_a_password';
62
-  GRANT ALL PRIVILEGES ON `postfix` . * TO 'postfix'@'localhost';
63
-
64
-For PostgreSQL:
65
-  CREATE USER postfix WITH PASSWORD 'whatever';
66
-  CREATE DATABASE postfix OWNER postfix ENCODING 'unicode';
67
-
68
-
69
-3. Configure PostfixAdmin so it can find the database
70
------------------------------------------------------
71
-
72
-Create a config.local.php file for your local configuration:
73
-
74
-<?php
75
-$CONF['database_type'] = 'mysqli';
76
-$CONF['database_user'] = 'postfix';
77
-$CONF['database_password'] = 'postfixadmin';
78
-$CONF['database_name'] = 'postfix';
79
-
80
-$CONF['configured'] = true;
81
-?>
82
-
83
-See config.inc.php for all available config options and their default value.
84
-
85
-You can also edit config.inc.php instead of creating a config.local.php,
86
-but this will make updates harder and is therefore not recommended.
87
-
88
-The most important settings are those for your database server.
89
-
90
-You must also change the line that says :
91
-
92
-$CONF['configured'] = false;
93
-
94
-to
95
-
96
-$CONF['configured'] = true;
97
-
98
-
99
-PostfixAdmin does not require write access to any files except the templates_c 
100
-directory (smarty cache). You can therefore leave the files owned as root (or
101
-another user); as long as the web server user (e.g. www-data) can read them, it
102
-will be fine.
103
-For templates_c/, allow write access (only) for the web server user (e. g. www-data).
104
-The easiest way to do this is   chown -R www-data templates_c
105
-
106
-
107
-4. Check settings, and create Admin user
108
-----------------------------------------
109
-
110
-Hit http://yourserver.tld/postfixadmin/setup.php in a web browser.
111
-
112
-You should see a list of 'OK' messages. 
113
-
114
-The setup.php script will attempt to create the database structure 
115
-(or upgrade it if you're coming from a previous version). 
116
-
117
-Assuming everything is OK you can specify a password (which you'll 
118
-need to use setup.php again in the future); when you submit the form, 
119
-the hashed value (which you need to enter into config.inc.php is echoed 
120
-out - with appropriate instructions on what to do with it).
121
-
122
-create the admin user using the form displayed.
123
-
124
-5. Use PostfixAdmin
125
--------------------
126
-
127
-This is all that is needed. Fire up your browser and go to the site that you
128
-specified to host Postfix Admin.
129
-
130
-6. Integration with Postfix, Dovecot etc.
131
------------------------------------------
132
-
133
-Now that PostfixAdmin is working, you need to do some configuration in Postfix,
134
-Dovecot etc. so that they use the domains, mailboxes and aliases you setup in
135
-PostfixAdmin.
136
-
137
-The files in the DOCUMENTS/ directory explain which settings you need to
138
-do/change.
139
-
140
-7. XMLRPC Integration (OPTIONAL!)
141
---------------------------------
142
-
143
-See ADDITIONS/squirrelmail-plugin
144
-See xmlrpc.php - only a subset of Postfixadmin's functionality is currently exposed.
145
-See config.inc.php - see xmlrpc_enabled key (defaults to off).
146
-
147
-You'll need to install a copy of the Zend Framework (version 1.12.x) within Postfixadmin
148
-or your PHP include_path (see header within xmlrpc.php).
149
-NOTE: The XMLRPC interface is _not compatible_ with Zend Framework version 2.x.
150
-You'll need to enable the xmlrpc link (see config.inc.php)
151
-
152
-8. More information
153
--------------------
154
-As of March 2007, PostfixAdmin moved to SourceForge.  For the
155
-forum posts and source updates, see:
156
-
157
-https://sourceforge.net/projects/postfixadmin
158
-
159
-There is also #postfixadmin on irc.freenode.net.

+ 0
- 222
postfixadmin/postfixadmin-3.0/VIRTUAL_VACATION/INSTALL.TXT View File

@@ -1,222 +0,0 @@
1
-######################################
2
-# Virtual Vacation for Postfix Admin #
3
-######################################
4
-#
5
-# Postfix Admin (Virtual Vacation)
6
-# Originally authored by Mischa Peters <mischa at high5 dot net>
7
-# Copyright (c) 2002 - 2005 High5!
8
-# Licensed under GPL for more info check GPL-LICENSE.TXT
9
-#
10
-
11
-REQUIRED!
12
----------
13
-There are a bunch of Perl modules which need installing, depending on your 
14
-distribution these may be available through your package management tool, or
15
-will need installing through CPAN.
16
-
17
-A full list of required modules can be found in the source of vacation.pl.
18
-
19
-It obviously relies on Perl
20
-
21
-About Virtual Vacation
22
-----------------------
23
-The vacation script runs as service within Postfix's master.cf configuration file.
24
-Mail is sent to the vacation service via a transport table mapping.
25
-When users mark themselves as away on vacation, an alias is added to their account 
26
-sending a copy of all mail to them to the vacation service.
27
-
28
-e.g. mail to billy@goat.com will be delivered to 
29
-    billy@goat.com AND 
30
-    billy#goat.com@autoreply.goat.com
31
-
32
-Mail to @autoreply.goat.com is caught by the vacation.pl script and a reply 
33
-will be sent based on various settings. By default a reply is only sent once.
34
-
35
-
36
-Install Virtual Vacation
37
-------------------------
38
-
39
-1. Create a local account
40
--------------------------
41
-
42
-Create a dedicated local user account called "vacation". 
43
-This user handles all potentially dangerous mail content - that is why it
44
-should be a separate account.
45
-
46
-Do not use "nobody", and most certainly do not use "root" or "postfix".  The
47
-user will never log in, and can be given a "*" password and non-existent
48
-shell and home directory.
49
-
50
-Also create a separate "vacation" group.
51
-
52
-This should look like this:
53
-
54
-#/etc/passwd
55
-vacation:*:65501:65501:Virtual Vacation:/nonexistent:/sbin/nologin
56
-
57
-#/etc/group
58
-vacation:*:65501:
59
-
60
-
61
-2. Create a log directory or log file
62
--------------------------------------
63
-
64
-If you want to log to a file ($log_to_file), create a log directory or an 
65
-empty log file.
66
-
67
-This file or directory needs to be writeable for the "vacation" user.
68
-
69
-Note: If you are logging to syslog, you can skip this step.
70
-
71
-
72
-3. Install vacation.pl
73
-----------------------
74
-
75
-Create a directory /usr/lib/postfixadmin/ and copy the vacation.pl file to it:
76
-
77
-  $ mkdir /usr/lib/postfixadmin
78
-  $ cp vacation.pl /usr/lib/postfixadmin/vacation.pl
79
-  $ chown -R root:vacation /usr/lib/postfixadmin
80
-  $ chmod 750 /usr/lib/postfixadmin/ /usr/lib/postfixadmin/vacation.pl
81
-
82
-Which will then look something like:
83
-
84
--rwxr-x---   1 root  vacation  3356 Dec 21 00:00 vacation.pl*
85
-
86
-
87
-4. Setup the transport type
88
----------------------------
89
-Define the transport type in the Postfix master file:
90
-
91
-#/etc/postfix/master.cf:
92
-vacation    unix  -       n       n       -       -       pipe
93
-  flags=Rq user=vacation argv=/usr/lib/postfixadmin/vacation.pl -f ${sender} -- ${recipient}
94
-
95
-5. Setup the transport maps file
96
---------------------------------
97
-
98
-Tell Postfix to use a transport maps file, so add the following to your
99
-Postfix main.cf:
100
-
101
-#/etc/postfix/main.cf:
102
-transport_maps = hash:/etc/postfix/transport
103
-
104
-Then add the transport definition to the newly created transport file.
105
-Obviously, change yourdomain.com to your own domain. This can be any
106
-arbitrary domain, and it is easiest if you just choose one that will be used
107
-for all your domains.
108
-
109
-#/etc/postfix/transport
110
-autoreply.yourdomain.com	vacation:
111
-
112
-(You may need to create an entry in /etc/hosts for your non-existant domain)
113
-
114
-Execute "postmap /etc/postfix/transport" to build the hashed database.
115
-
116
-Execute "postfix reload" to complete the change.
117
-
118
-
119
-
120
-
121
-6. Configure vacation.pl
122
-------------------------
123
-
124
-The perl vacation.pl script needs to know which database you are using, and also
125
-how to connect to the database.
126
-
127
-Namely :
128
-
129
-Change any variables starting with '$db_' and '$db_type' to either 'mysql' or 'pgsql'.
130
-
131
-Change the $vacation_domain variable to match what you entered in your /etc/postfix/transport 
132
-file.
133
-
134
-You can do this in two ways:
135
-
136
-a) edit vacation.pl directly (not recommended!)
137
-
138
-b) create /etc/postfixadmin/vacation.conf and enter your settings there
139
-
140
-   Just use perl syntax there to fill the config variables listed in vacation.pl
141
-   (without the "our" keyword). Example:
142
-   $db_username = 'mail';
143
-
144
-   To make sure nobody except vacation.pl can read your vacation.conf (including the
145
-   database password), run
146
-
147
-   $ chown root:vacation /etc/postfixadmin/vacation.conf
148
-   $ chmod 640 /etc/postfixadmin/vacation.conf
149
-
150
-
151
-7. Check the alias expansion
152
-----------------------------
153
-
154
-Depending on your setup, you may have multiple 'smtpd' service definitions within 
155
-your postfix master.cf file. This is especially the case if you are also using AMAVIS or
156
-another content filtering system when mail is re-injected into Postfix using the smtpd daemon.
157
-
158
-If you are, it's likely that alias expansion may happen more than once, in which case you 
159
-may see vacation-style responses duplicated. To suppress this behaviour, you need to add:
160
-
161
-  -o receive_override_options=no_address_mappings
162
-
163
-For example :
164
-
165
-smtp      inet  n       -       -       -       12       smtpd
166
-    -o content_filter=amavis:[127.0.0.50]:10024
167
-    -o receive_override_options=no_address_mappings
168
-
169
-127.0.0.1:10025 inet    n   -   -   -   - smtpd
170
-    -o smtpd_autorized_xforward_hosts=127.0.0.0/8
171
-    -o smtpd_client_restrictions=
172
-    -o smtpd_helo_restrictions=
173
-    -o smtpd_sender_restrictions=
174
-    -o smtpd_recipient_restrictions=permit_mynetworks,reject
175
-    -o mynetworks=127.0.0.0/8
176
-    -o receive_override_options=no_header_body_checks
177
-
178
-	^^^ Alias expansion occurs here, so we don't want it to happen again for the
179
-		first smtpd daemon (above). If you have per-user settings in amavis,
180
-		you might want to have no_address_mappings in the smtpd on port 10025
181
-		instead.
182
-
183
-
184
-8. Security
185
------------
186
-
187
-If security is an issue for you, read ../DOCUMENTS/Security.txt
188
-
189
-
190
-
191
-
192
-What do these files do?
193
------------------------
194
-When a user enables a vacation message on their account, the alias
195
-definition is changed so that in addition to delivering to their own
196
-mailbox, it also delivers to a dummy alias which calls the vacation.pl
197
-program. In other words, if joeuser@domain.com enables their vacation, the
198
-entry in the alias database table will deliver mail to
199
-joeuser@something.com, as well as
200
-joeuser#something.com@autoreply.yourdomain.com
201
-
202
-vacation.pl then checks the database to see wether a user is on holiday and
203
-what message to send back. Make sure that vacation.pl is able to communicate
204
-to your database. You have to specify the database, username and password for 
205
-it as described in the "Configure vacation.pl" section.
206
-
207
-NOTE: Make sure that the path to perl in vacation.pl is correct.
208
-
209
-
210
-I'm in trouble!
211
----------------
212
-When something is not working there are a couple of files that you can have
213
-a look at. The most important one is your maillog (usually in /var/log/).
214
-
215
-Vacation.pl also has some debugging and logging capabilties. Check the top
216
-of vacation.pl.
217
-
218
-
219
-Done!
220
------
221
-When this is all in place you need to have a look at the Postfix Admin
222
-config.inc.php. Here you need to enable Virtual Vacation for the site.

+ 0
- 22
postfixadmin/postfixadmin-3.0/VIRTUAL_VACATION/index.php View File

@@ -1,22 +0,0 @@
1
-<?php
2
-// 
3
-// Postfix Admin 
4
-// by Mischa Peters <mischa at high5 dot net>
5
-// Copyright (c) 2002 - 2005 High5!
6
-// Licensed under GPL for more info check GPL-LICENSE.TXT
7
-//
8
-// File: index.php
9
-//
10
-// Template File: -none-
11
-//
12
-// Template Variables:
13
-//
14
-// -none-
15
-//
16
-// Form POST \ GET Variables:
17
-//
18
-// -none-
19
-//
20
-header ("Location: ../login.php");
21
-exit;
22
-?>

+ 0
- 726
postfixadmin/postfixadmin-3.0/VIRTUAL_VACATION/vacation.pl View File

@@ -1,726 +0,0 @@
1
-#!/usr/bin/perl -w
2
-#
3
-# Virtual Vacation 4.0r1
4
-#
5
-# $Revision: 1857 $
6
-# Originally by Mischa Peters <mischa at high5 dot net>
7
-#
8
-# Copyright (c) 2002 - 2005 High5!
9
-# Licensed under GPL for more info check GPL-LICENSE.TXT
10
-#
11
-# Additions:
12
-# 2004/07/13  David Osborn <ossdev at daocon.com>
13
-#             strict, processes domain level aliases, more
14
-#             subroutines, send reply from original to address
15
-#
16
-# 2004/11/09  David Osborn <ossdev at daocon.com>
17
-#             Added syslog support
18
-#             Slightly better logging which includes messageid
19
-#             Avoid infinite loops with domain aliases
20
-#
21
-# 2005-01-19  Troels Arvin <troels at arvin.dk>
22
-#             PostgreSQL-version.
23
-#             Normalized DB schema from one vacation table ("vacation")
24
-#             to two ("vacation", "vacation_notification"). Uses
25
-#             referential integrity CASCADE action to simplify cleanup
26
-#             when a user is no longer on vacation.
27
-#             Inserting variables into queries stricly by prepare()
28
-#             to try to avoid SQL injection.
29
-#             International characters are now handled well.
30
-#
31
-# 2005-01-21  Troels Arvin <troels at arvin.dk>
32
-#             Uses the Email::Valid package to avoid sending notices
33
-#             to obviously invalid addresses.
34
-#
35
-# 2007-08-15  David Goodwin <david at palepurple.co.uk>
36
-#             Use the Perl Mail::Sendmail module for sending mail
37
-#             Check for headers that start with blank lines (patch from forum)
38
-#
39
-# 2007-08-20  Martin Ambroz <amsys at trustica.cz>
40
-#             Added initial Unicode support
41
-#
42
-# 2008-05-09  Fabio Bonelli <fabiobonelli at libero.it>
43
-#             Properly handle failed queries to vacation_notification.
44
-#             Fixed log reporting.
45
-#
46
-# 2008-07-29  Patch from Luxten to add repeat notification after timeout. See:
47
-#             https://sourceforge.net/tracker/index.php?func=detail&aid=2031631&group_id=191583&atid=937966
48
-#
49
-# 2008-08-01  Luigi Iotti <luigi at iotti dot biz>
50
-#             Use envelope sender/recipient instead of using
51
-#             From: and To: header fields;
52
-#             Support to good vacation behavior as in
53
-#             http://www.irbs.net/internet/postfix/0707/0954.html
54
-#             (needs to be tested);
55
-#
56
-# 2008-08-04  David Goodwin <david at palepurple dot co dot uk>
57
-#             Use Log4Perl
58
-#             Added better testing (and -t option)
59
-#
60
-# 2009-06-29  Stevan Bajic <stevan at bajic.ch>
61
-#             Add Mail::Sender for SMTP auth + more flexibility
62
-#
63
-# 2009-07-07  Stevan Bajic <stevan at bajic.ch>
64
-#             Add better alias lookups
65
-#             Check for more heades from Anti-Virus/Anti-Spam solutions
66
-#
67
-# 2009-08-10  Sebastian <reg9009 at yahoo dot de>
68
-#             Adjust SQL query for vacation timeframe. It is now possible to set from/until date for vacation message.
69
-#
70
-# 2012-04-1   Nikolaos Topp <info at ichier.de>
71
-#             Add configuration parameter $smtp_client in order to get mails through
72
-#             postfix helo-checks, using check_helo_access whitelist without permitting 'localhost' default style stuff
73
-#
74
-# 2012-04-19  Jan Kruis <jan at crossreference dot nl>
75
-#             change SQL query for vacation into function.
76
-#             Add sub get_interval()
77
-#             Gives the user the option to set the interval time ( 0 = one reply, 1 = autoreply, > 1 = Delay reply ) 
78
-#             See https://sourceforge.net/tracker/?func=detail&aid=3508083&group_id=191583&atid=937966
79
-#
80
-# 2012-06-18  Christoph Lechleitner <christoph.lechleitner@iteg.at>
81
-#             Add capability to include the subject of the original mail in the subject of the vacation message.
82
-#             A good vacation subject could be: 'Re: $SUBJECT'
83
-#             Also corrected log entry about "Already informed ..." to show the $orig_from, not $email
84
-#
85
-
86
-# Requirements - the following perl modules are required:
87
-# DBD::Pg or DBD::mysql
88
-# Mail::Sender, Email::Valid MIME::Charset, Log::Log4perl, Log::Dispatch, MIME::EncWords and GetOpt::Std
89
-#
90
-# You may install these via CPAN, or through your package tool.
91
-# CPAN: 'perl -MCPAN -e shell', then 'install Module::Whatever'
92
-#
93
-# On Debian based systems :
94
-#   libmail-sender-perl
95
-#   libdbd-pg-perl
96
-#   libemail-valid-perl
97
-#   libmime-perl
98
-#   liblog-log4perl-perl
99
-#   liblog-dispatch-perl
100
-#   libgetopt-argvfile-perl
101
-#   libmime-charset-perl (currently in testing, see instructions below)
102
-#   libmime-encwords-perl (currently in testing, see instructions below)
103
-#
104
-# Note: When you use this module, you may start seeing error messages
105
-# like "Cannot insert a duplicate key into unique index
106
-# vacation_notification_pkey" in your system logs. This is expected
107
-# behavior, and not an indication of trouble (see the "already_notified"
108
-# subroutine for an explanation).
109
-#
110
-# You must also have the Email::Valid and MIME-tools perl-packages
111
-# installed. They are available in some package collections, under the
112
-# names 'perl-Email-Valid' and 'perl-MIME-tools', respectively.
113
-# One such package collection (for Linux) is:
114
-# http://dag.wieers.com/home-made/apt/packages.php
115
-#
116
-
117
-use utf8;
118
-use DBI;
119
-use MIME::Base64 qw(encode_base64);
120
-use Encode qw(encode decode);
121
-use MIME::EncWords qw(:all);
122
-use Email::Valid;
123
-use strict;
124
-use Mail::Sender;
125
-use Getopt::Std;
126
-use Log::Log4perl qw(get_logger :levels);
127
-use File::Basename;
128
-
129
-# ========== begin configuration ==========
130
-
131
-# IMPORTANT: If you put passwords into this script, then remember
132
-# to restrict access to the script, so that only the vacation user
133
-# can read it.
134
-
135
-# db_type - uncomment one of these
136
-our $db_type = 'Pg';
137
-#our $db_type = 'mysql';
138
-
139
-# leave empty for connection via UNIX socket
140
-our $db_host = '';
141
-
142
-# connection details
143
-our $db_username = 'user';
144
-our $db_password = 'password';
145
-our $db_name     = 'postfix';
146
-
147
-our $vacation_domain = 'autoreply.example.org';
148
-
149
-# smtp server used to send vacation e-mails
150
-our $smtp_server = 'localhost';
151
-our $smtp_server_port = 25;
152
-
153
-# this is the helo we [the vacation script] use on connection; you may need to change this to your hostname or something,
154
-# depending upon what smtp helo restrictions you have in place within Postfix. 
155
-our $smtp_client = 'localhost';
156
-
157
-# SMTP authentication protocol used for sending.
158
-# Can be 'PLAIN', 'LOGIN', 'CRAM-MD5' or 'NTLM'
159
-# see "perldoc Mail::Sender" (search for "auth") for more options and details
160
-# Leave it blank if you don't use authentication
161
-our $smtp_auth = undef;
162
-# username used to login to the server
163
-our $smtp_authid = 'someuser';
164
-# password used to login to the server
165
-our $smtp_authpwd = 'somepass';
166
-
167
-# This specifies the mail 'from' name which is shown to recipients of vacation replies.
168
-# If you leave it empty, the vacation mail will contain: 
169
-# From: <original@recipient.domain>
170
-# If you specify something here you'd instead see something like :
171
-# From: Some Friendly Name <original@recipient.domain>
172
-our $friendly_from = '';
173
-
174
-# use TLS for the SMTP connection?
175
-# while in general this would be a good idea, TLS with Mail::Sender 0.8.22 is buggy - https://rt.cpan.org/Public/Bug/Display.html?id=85438
176
-our $smtp_tls_allowed = 0;
177
-
178
-# Set to 1 to enable logging to syslog.
179
-our $syslog = 0;
180
-
181
-# path to logfile, when empty logging is suppressed
182
-# change to e.g. /dev/null if you want nothing logged.
183
-# if we can't write to this, and $log_to_file is 1 (below) the script will abort.
184
-our $logfile='/var/log/vacation.log';
185
-# 2 = debug + info, 1 = info only, 0 = error only
186
-our $log_level = 2;
187
-# Whether to log to file or not, 0 = do not write to a log file
188
-our $log_to_file = 0;
189
-
190
-# notification interval, in seconds
191
-# set to 0 to notify only once
192
-# e.g. 1 day ...
193
-#our $interval = 60*60*24;
194
-# disabled by default
195
-our $interval = 0;
196
-
197
-# Send vacation mails to do-not-reply email addresses.
198
-# By default vacation email addresses will be sent.
199
-# For now emails from bounce|do-not-reply|facebook|linkedin|list-|myspace|twitter won't
200
-# be answered when $custom_noreply_pattern is set to 1.
201
-# default = 0
202
-our $custom_noreply_pattern = 0;
203
-our $noreply_pattern = 'bounce|do-not-reply|facebook|linkedin|list-|myspace|twitter'; 
204
-
205
-
206
-# instead of changing this script, you can put your settings to /etc/mail/postfixadmin/vacation.conf
207
-# or /etc/postfixadmin/vacation.conf just use Perl syntax there to fill the variables listed above
208
-# (without the "our" keyword). Example:
209
-# $db_username = 'mail';
210
-if (-f '/etc/mail/postfixadmin/vacation.conf') {
211
-    require '/etc/mail/postfixadmin/vacation.conf';
212
-} elsif (-f '/etc/postfixadmin/vacation.conf') {
213
-    require '/etc/postfixadmin/vacation.conf';
214
-}
215
-
216
-# =========== end configuration ===========
217
-
218
-if($log_to_file == 1) {
219
-    if (( ! -w $logfile ) && (! -w dirname($logfile))) {
220
-        # Cannot log; no where to write to.
221
-        die("Cannot create logfile : $logfile");
222
-    }
223
-}
224
-
225
-my ($from, $to, $cc, $replyto , $subject, $messageid, $lastheader, $smtp_sender, $smtp_recipient, %opts, $test_mode, $logger);
226
-
227
-$subject='';
228
-$messageid='unknown';
229
-
230
-# Setup a logger...
231
-#
232
-getopts('f:t:', \%opts) or die "Usage: $0 [-t yes] -f sender -- recipient\n\t-t for testing only\n";
233
-$opts{f} and $smtp_sender = $opts{f} or die '-f sender not present on command line';
234
-$test_mode = 0;
235
-$opts{t} and $test_mode = 1;
236
-$smtp_recipient = shift or die 'recipient not given on command line';
237
-
238
-my $log_layout = Log::Log4perl::Layout::PatternLayout->new('%d %p> %F:%L %M - %m%n');
239
-
240
-if($test_mode == 1) {
241
-    $logger = get_logger();
242
-    # log to stdout
243
-    my $appender = Log::Log4perl::Appender->new('Log::Dispatch::Screen');
244
-    $appender->layout($log_layout);
245
-    $logger->add_appender($appender);
246
-    $logger->debug('Test mode enabled');
247
-} else {
248
-    $logger = get_logger();
249
-    if($log_to_file == 1) {
250
-        # log to file
251
-        my $appender = Log::Log4perl::Appender->new(
252
-            'Log::Dispatch::File',
253
-            filename => $logfile,
254
-            mode => 'append');
255
-
256
-        $appender->layout($log_layout);
257
-        $logger->add_appender($appender);
258
-    }
259
-
260
-    if($syslog == 1) {
261
-        my $syslog_appender = Log::Log4perl::Appender->new(
262
-            'Log::Dispatch::Syslog',
263
-            facility => 'mail',
264
-        );
265
-        $logger->add_appender($syslog_appender);
266
-    }
267
-}
268
-
269
-# change to $DEBUG, $INFO or $ERROR depending on how much logging you want.
270
-$logger->level($ERROR);
271
-if($log_level == 1) {
272
-    $logger->level($INFO);
273
-}
274
-if($log_level == 2) {
275
-    $logger->level($DEBUG);
276
-}
277
-
278
-binmode (STDIN,':encoding(UTF-8)');
279
-
280
-my $dbh;
281
-if ($db_host) {
282
-    $dbh = DBI->connect("DBI:$db_type:dbname=$db_name;host=$db_host","$db_username", "$db_password", { RaiseError => 1 });
283
-} else {
284
-    $dbh = DBI->connect("DBI:$db_type:dbname=$db_name","$db_username", "$db_password", { RaiseError => 1 });
285
-}
286
-
287
-if (!$dbh) {
288
-    $logger->error('Could not connect to database'); # eval { } etc better here?
289
-    exit(0);
290
-}
291
-
292
-my $db_true; # MySQL and PgSQL use different values for TRUE, and unicode support...
293
-if ($db_type eq 'mysql') {
294
-    $dbh->do('SET CHARACTER SET utf8;');
295
-    $db_true = '1';
296
-} else { # Pg
297
-    $dbh->do("SET CLIENT_ENCODING TO 'UTF8'");
298
-    $db_true = 'True';
299
-}
300
-
301
-# used to detect infinite address lookup loops
302
-my $loopcount=0;
303
-
304
-#
305
-# Get interval_time for email user from the vacation table 
306
-#
307
-sub get_interval {
308
-    my ($to) = @_;
309
-    my $query = qq{SELECT interval_time  FROM vacation  WHERE  email=? };
310
-    my $stm = $dbh->prepare($query) or panic_prepare($query);
311
-    $stm->execute($to) or panic_execute($query," 'email='$to'");
312
-    my $rv = $stm->rows;
313
-    if ($rv == 1) {
314
-        my @row = $stm->fetchrow_array;
315
-        my $interval = $row[0] ;
316
-        return $interval ;
317
-    } else {
318
-        return 0 ;
319
-    }
320
-}
321
-
322
-
323
-sub already_notified {
324
-    my ($to, $from) = @_;
325
-    my $logger = get_logger();
326
-    my $query;
327
-
328
-    # delete old notifications
329
-    if ($db_type eq 'Pg') {
330
-        $query = qq{DELETE FROM vacation_notification USING vacation WHERE vacation.email = vacation_notification.on_vacation AND on_vacation = ? AND notified = ? AND notified_at < vacation.activefrom;};
331
-    } else { # mysql
332
-        $query = qq{DELETE vacation_notification.* FROM vacation_notification LEFT JOIN vacation ON vacation.email = vacation_notification.on_vacation WHERE on_vacation = ? AND notified = ? AND notified_at < vacation.activefrom};
333
-    }
334
-    my $stm = $dbh->prepare($query);
335
-    if (!$stm) {
336
-        $logger->error("Could not prepare query (trying to delete old vacation notifications) :'$query' to: $to, from:$from");
337
-        return 1;
338
-    }
339
-    $stm->execute($to,$from);
340
-
341
-    $query = qq{INSERT into vacation_notification (on_vacation,notified) values (?,?)};
342
-    $stm = $dbh->prepare($query);
343
-    if (!$stm) {
344
-        $logger->error("Could not prepare query '$query' to: $to, from:$from");
345
-        return 1;
346
-    }
347
-    $stm->{'PrintError'} = 0;
348
-    $stm->{'RaiseError'} = 0;
349
-    if (!$stm->execute($to,$from)) {
350
-        my $e=$dbh->errstr;
351
-
352
-# Violation of a primary key constraint may happen here, and that's
353
-# fine. All other error conditions are not fine, however.
354
-        if ($e !~ /(?:_pkey|^Duplicate entry)/) {
355
-            $logger->error("Failed to insert into vacation_notification table (to:$to from:$from error:'$e' query:'$query')");
356
-            # Let's play safe and notify anyway
357
-            return 1;
358
-        }
359
-
360
-        $interval = get_interval($to);
361
-
362
-        if ($interval) {
363
-            if ($db_type eq 'Pg') {
364
-                $query = qq{SELECT extract( epoch from (NOW()-notified_at))::int FROM vacation_notification WHERE on_vacation=? AND notified=?};
365
-            } else { # mysql
366
-                $query = qq{SELECT NOW()-notified_at FROM vacation_notification WHERE on_vacation=? AND notified=?};
367
-            }
368