mirror of
				https://bitbucket.org/jsuto/piler.git
				synced 2025-11-04 03:32:26 +01:00 
			
		
		
		
	minor fixes
This commit is contained in:
		
							
								
								
									
										21
									
								
								contrib/webserver/piler-apache-2.x.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								contrib/webserver/piler-apache-2.x.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					#### IMPORTANT!!!
 | 
				
			||||||
 | 
					####
 | 
				
			||||||
 | 
					#### Fix the hostname
 | 
				
			||||||
 | 
					####
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<VirtualHost *:80>
 | 
				
			||||||
 | 
					    ServerName piler.yourdomain.com
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    DocumentRoot "/var/www/piler.yourdomain.com"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <Directory /var/www/piler.yourdomain.com>
 | 
				
			||||||
 | 
					       Order allow,deny
 | 
				
			||||||
 | 
					       Allow from all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       AllowOverride all
 | 
				
			||||||
 | 
					    </Directory>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ErrorLog "/var/log/apache2/piler.yourdomain.com-error_log"
 | 
				
			||||||
 | 
					    CustomLog "/var/log/apach2/piler.yourdomain.com-access_log" common
 | 
				
			||||||
 | 
					</VirtualHost>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										48
									
								
								contrib/webserver/piler-nginx.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								contrib/webserver/piler-nginx.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					#### IMPORTANT!!!
 | 
				
			||||||
 | 
					####
 | 
				
			||||||
 | 
					#### Fix the listen IP-address, and the hostname
 | 
				
			||||||
 | 
					####
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					server {
 | 
				
			||||||
 | 
					        listen       1.2.3.4:80;
 | 
				
			||||||
 | 
					        server_name  piler.yourdomain.com;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        root /var/www/piler.piler.yourdomain.com;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        access_log  /var/log/nginx/piler.yourdomain.com-access.log  main;
 | 
				
			||||||
 | 
					        error_log   /var/log/nginx/piler.yourdomain.com-error.log;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        location / {
 | 
				
			||||||
 | 
					            index  index.php index.html;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #error_page  404              /404.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        error_page   500 502 503 504  /50x.html;
 | 
				
			||||||
 | 
					        location = /50x.html {
 | 
				
			||||||
 | 
					            root   html;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        location ~ \.php$ {
 | 
				
			||||||
 | 
					            fastcgi_pass   127.0.0.1:9000;
 | 
				
			||||||
 | 
					            fastcgi_index  index.php;
 | 
				
			||||||
 | 
					            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 | 
				
			||||||
 | 
					            include        fastcgi_params;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        rewrite /search.php /index.php?route=search/search&type=simple;
 | 
				
			||||||
 | 
					        rewrite /advanced.php /index.php?route=search/search&type=advanced;
 | 
				
			||||||
 | 
					        rewrite /expert.php /index.php?route=search/search&type=expert;
 | 
				
			||||||
 | 
					        rewrite /search-helper.php /index.php?route=search/helper;
 | 
				
			||||||
 | 
					        rewrite /audit-helper.php /index.php?route=audit/helper;
 | 
				
			||||||
 | 
					        rewrite /message.php /index.php?route=message/view;
 | 
				
			||||||
 | 
					        rewrite /bulkrestore.php /index.php?route=message/bulkrestore;
 | 
				
			||||||
 | 
					        rewrite /folders.php /index.php?route=folder/list&;
 | 
				
			||||||
 | 
					        rewrite /settings.php /index.php?route=user/settings;
 | 
				
			||||||
 | 
					        rewrite /login.php /index.php?route=login/login;
 | 
				
			||||||
 | 
					        rewrite /logout.php /index.php?route=login/logout;
 | 
				
			||||||
 | 
					        rewrite /google.php /index.php?route=login/google;
 | 
				
			||||||
 | 
					        rewrite /view/javascript/piler.js /js.php;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -3,15 +3,6 @@
 | 
				
			|||||||
### be sure to review it and adjust it for your needs ###
 | 
					### be sure to review it and adjust it for your needs ###
 | 
				
			||||||
#########################################################
 | 
					#########################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
root's crontab:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### optional: query postfix queue statistics
 | 
					 | 
				
			||||||
*/5 * * * * PATH=$PATH:/usr/sbin:/usr/local/sbin /usr/sbin/qshape > LOCALSTATEDIR/piler/stat/active+incoming
 | 
					 | 
				
			||||||
*/5 * * * * PATH=$PATH:/usr/sbin:/usr/local/sbin /usr/sbin/qshape -s > LOCALSTATEDIR/piler/stat/active+incoming-sender
 | 
					 | 
				
			||||||
*/5 * * * * PATH=$PATH:/usr/sbin:/usr/local/sbin /usr/sbin/qshape deferred > LOCALSTATEDIR/piler/stat/deferred
 | 
					 | 
				
			||||||
*/5 * * * * PATH=$PATH:/usr/sbin:/usr/local/sbin /usr/sbin/qshape -s deferred > LOCALSTATEDIR/piler/stat/deferred-sender
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
piler's crontab:
 | 
					piler's crontab:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### mandatory
 | 
					### mandatory
 | 
				
			||||||
@@ -23,13 +14,10 @@ piler's crontab:
 | 
				
			|||||||
*/15 * * * * /usr/local/bin/indexer --quiet note1 --rotate
 | 
					*/15 * * * * /usr/local/bin/indexer --quiet note1 --rotate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### optional: the same report you can see on the health page
 | 
					### optional: the same report you can see on the health page
 | 
				
			||||||
30 7 * * * /usr/local/libexec/piler/daily-report.php /srv/www/webui.yourdomain.com
 | 
					30 7 * * * /usr/bin/php LIBEXECDIR/piler/daily-report.php /srv/www/webui.yourdomain.com
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### optional: populate accouting data
 | 
					### optional: populate accouting data
 | 
				
			||||||
30 6 * * * /usr/local/libexec/piler/generate_stats.php /srv/www/webui.yourdomain.com
 | 
					30 6 * * * /usr/bin/php LIBEXECDIR/piler/generate_stats.php /srv/www/webui.yourdomain.com
 | 
				
			||||||
 | 
					 | 
				
			||||||
### optional: regular AD sync
 | 
					 | 
				
			||||||
0 8 * * * /usr/bin/php LIBEXECDIR/piler/ldap_sync.php /srv/www/webui.yourdomain.com > LOCALSTATEDIR/piler/stat/adsync.stat
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
### optional: purge aged emails
 | 
					### optional: purge aged emails
 | 
				
			||||||
2 0 * * * /usr/local/bin/pilerpurge
 | 
					2 0 * * * /usr/local/bin/pilerpurge
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,360 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
create table if not exists `sph_counter` (
 | 
					 | 
				
			||||||
  `counter_id` int not null,
 | 
					 | 
				
			||||||
  `max_doc_id` int not null,
 | 
					 | 
				
			||||||
  primary key (`counter_id`)
 | 
					 | 
				
			||||||
);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `sph_index` (
 | 
					 | 
				
			||||||
  `id` bigint not null,
 | 
					 | 
				
			||||||
  `from` char(255) default null,
 | 
					 | 
				
			||||||
  `to` text(8192) default null,
 | 
					 | 
				
			||||||
  `fromdomain` char(255) default null,
 | 
					 | 
				
			||||||
  `todomain` text(512) default null,
 | 
					 | 
				
			||||||
  `subject` text(512) default null,
 | 
					 | 
				
			||||||
  `arrived` int unsigned not null,
 | 
					 | 
				
			||||||
  `sent` int unsigned not null,
 | 
					 | 
				
			||||||
  `body` text,
 | 
					 | 
				
			||||||
  `size` int default '0',
 | 
					 | 
				
			||||||
  `direction` int default 0,
 | 
					 | 
				
			||||||
  `customer` tinyint unsigned default 0,
 | 
					 | 
				
			||||||
  `folder` int default 0,
 | 
					 | 
				
			||||||
  `attachments` int default 0,
 | 
					 | 
				
			||||||
  `attachment_types` text(512) default null,
 | 
					 | 
				
			||||||
  primary key (`id`)
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `metadata` (
 | 
					 | 
				
			||||||
  `id` bigint unsigned not null auto_increment,
 | 
					 | 
				
			||||||
  `from` varchar(128) not null,
 | 
					 | 
				
			||||||
  `fromdomain` varchar(64) not null,
 | 
					 | 
				
			||||||
  `subject` text(512) default null,
 | 
					 | 
				
			||||||
  `spam` tinyint(1) default 0,
 | 
					 | 
				
			||||||
  `arrived` int unsigned not null,
 | 
					 | 
				
			||||||
  `sent` int unsigned not null,
 | 
					 | 
				
			||||||
  `retained` int unsigned not null,
 | 
					 | 
				
			||||||
  `deleted` tinyint(1) default 0,
 | 
					 | 
				
			||||||
  `size` int default 0,
 | 
					 | 
				
			||||||
  `hlen` int default 0,
 | 
					 | 
				
			||||||
  `direction` int default 0,
 | 
					 | 
				
			||||||
  `customer` tinyint unsigned default 0,
 | 
					 | 
				
			||||||
  `attachments` int default 0,
 | 
					 | 
				
			||||||
  `piler_id` char(36) not null,
 | 
					 | 
				
			||||||
  `message_id` varchar(128) not null,
 | 
					 | 
				
			||||||
  `reference` char(64) not null,
 | 
					 | 
				
			||||||
  `digest` char(64) not null,
 | 
					 | 
				
			||||||
  `bodydigest` char(64) not null,
 | 
					 | 
				
			||||||
  `vcode` char(64) default null,
 | 
					 | 
				
			||||||
  primary key (`id`)
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create index metadata_idx on metadata(`piler_id`);
 | 
					 | 
				
			||||||
create index metadata_idx2 on metadata(`message_id`); 
 | 
					 | 
				
			||||||
create index metadata_idx3 on metadata(`reference`); 
 | 
					 | 
				
			||||||
create index metadata_idx4 on metadata(`bodydigest`); 
 | 
					 | 
				
			||||||
create index metadata_idx5 on metadata(`deleted`); 
 | 
					 | 
				
			||||||
create index metadata_idx6 on metadata(`arrived`); 
 | 
					 | 
				
			||||||
create index metadata_idx7 on metadata(`retained`); 
 | 
					 | 
				
			||||||
create index metadata_idx8 on metadata(`customer`); 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `rcpt` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null,
 | 
					 | 
				
			||||||
   `to` varchar(128) not null,
 | 
					 | 
				
			||||||
   `todomain` varchar(64) not null,
 | 
					 | 
				
			||||||
   unique(`id`,`to`)
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create index `rcpt_idx` on `rcpt`(`id`);
 | 
					 | 
				
			||||||
create index `rcpt_idx2` on `rcpt`(`to`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
drop view if exists `v_messages`;
 | 
					 | 
				
			||||||
create view `v_messages` AS select `metadata`.`id` AS `id`,`metadata`.`piler_id` AS `piler_id`,`metadata`.`from` AS `from`,`metadata`.`fromdomain` AS `fromdomain`,`rcpt`.`to` AS `to`,`rcpt`.`todomain` AS `todomain`,`metadata`.`subject` AS `subject`, `metadata`.`size` AS `size`, `metadata`.`direction` AS `direction`, `metadata`.`sent` AS `sent`, `metadata`.`arrived` AS `arrived`, `metadata`.`digest` AS `digest`, `metadata`.`bodydigest` AS `bodydigest` from (`metadata` join `rcpt`) where (`metadata`.`id` = `rcpt`.`id`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `attachment` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null auto_increment,
 | 
					 | 
				
			||||||
   `piler_id` char(36) not null,
 | 
					 | 
				
			||||||
   `attachment_id` int not null,
 | 
					 | 
				
			||||||
   `name` varchar(128) default null,
 | 
					 | 
				
			||||||
   `type` varchar(128) default null,
 | 
					 | 
				
			||||||
   `sig` char(64) not null,
 | 
					 | 
				
			||||||
   `size` int default 0,
 | 
					 | 
				
			||||||
   `ptr` bigint unsigned default 0,
 | 
					 | 
				
			||||||
   `deleted` tinyint(1) default 0,
 | 
					 | 
				
			||||||
   primary key (`id`)
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create index `attachment_idx` on `attachment`(`piler_id`);
 | 
					 | 
				
			||||||
create index `attachment_idx2` on `attachment`(`sig`);
 | 
					 | 
				
			||||||
create index `attachment_idx3` on `attachment`(`ptr`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
drop view if exists `v_attachment`;
 | 
					 | 
				
			||||||
create view `v_attachment` AS select `id` as `i`, `piler_id`, `attachment_id`, `ptr`, (select count(*) from `attachment` where `ptr`=`i`) as `refcount` from `attachment`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `tag` (
 | 
					 | 
				
			||||||
   `_id` bigint unsigned auto_increment not null,
 | 
					 | 
				
			||||||
   `id` bigint not null,
 | 
					 | 
				
			||||||
   `uid` int not null,
 | 
					 | 
				
			||||||
   `tag` varchar(255) default null,
 | 
					 | 
				
			||||||
   unique(`id`, `uid`),
 | 
					 | 
				
			||||||
   key (`_id`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `archiving_rule` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null auto_increment,
 | 
					 | 
				
			||||||
   `from` char(128) default null,
 | 
					 | 
				
			||||||
   `to` char(255) default null,
 | 
					 | 
				
			||||||
   `subject` char(255) default null,
 | 
					 | 
				
			||||||
   `_size` char(2) default null,
 | 
					 | 
				
			||||||
   `size` int default 0,
 | 
					 | 
				
			||||||
   `attachment_type` char(128) default null,
 | 
					 | 
				
			||||||
   `_attachment_size` char(2) default null,
 | 
					 | 
				
			||||||
   `attachment_size` int default 0,
 | 
					 | 
				
			||||||
   `spam` tinyint(1) default -1,
 | 
					 | 
				
			||||||
   `days` int default 0,
 | 
					 | 
				
			||||||
   primary key (`id`),
 | 
					 | 
				
			||||||
   unique(`from`,`to`,`subject`,`_size`,`size`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`) 
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `retention_rule` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null auto_increment,
 | 
					 | 
				
			||||||
   `from` char(128) default null,
 | 
					 | 
				
			||||||
   `to` char(255) default null,
 | 
					 | 
				
			||||||
   `subject` char(255) default null,
 | 
					 | 
				
			||||||
   `_size` char(2) default null,
 | 
					 | 
				
			||||||
   `size` int default 0,
 | 
					 | 
				
			||||||
   `attachment_type` char(128) default null,
 | 
					 | 
				
			||||||
   `_attachment_size` char(2) default null,
 | 
					 | 
				
			||||||
   `attachment_size` int default 0,
 | 
					 | 
				
			||||||
   `spam` tinyint(1) default -1,
 | 
					 | 
				
			||||||
   `days` int default 0,
 | 
					 | 
				
			||||||
   primary key (`id`),
 | 
					 | 
				
			||||||
   unique(`from`,`to`,`subject`,`_size`,`size`,`attachment_type`,`_attachment_size`,`attachment_size`,`spam`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `counter` (
 | 
					 | 
				
			||||||
   `rcvd` bigint unsigned default 0,
 | 
					 | 
				
			||||||
   `virus` bigint unsigned default 0,
 | 
					 | 
				
			||||||
   `duplicate` bigint unsigned default 0,
 | 
					 | 
				
			||||||
   `ignore` bigint unsigned default 0,
 | 
					 | 
				
			||||||
   `size` bigint unsigned default 0
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
insert into `counter` values(0, 0, 0, 0, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `option` (
 | 
					 | 
				
			||||||
   `key` char(64) not null,
 | 
					 | 
				
			||||||
   `value` char(32) not null
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
insert into `option` (`key`, `value`) values('enable_purge', '1');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `search` (
 | 
					 | 
				
			||||||
   `email` char(128) not null,
 | 
					 | 
				
			||||||
   `ts` int default 0,
 | 
					 | 
				
			||||||
   `term` text(512) not null
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create index `search_idx` on `search`(`email`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `user_settings` (
 | 
					 | 
				
			||||||
   `username` char(64) not null unique,
 | 
					 | 
				
			||||||
   `pagelen` int default 20,
 | 
					 | 
				
			||||||
   `theme` char(8) default 'default',
 | 
					 | 
				
			||||||
   `lang` char(2) default NULL
 | 
					 | 
				
			||||||
);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create index `user_settings_idx` on `user_settings`(`username`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `user` (
 | 
					 | 
				
			||||||
   `uid` int unsigned not null primary key,
 | 
					 | 
				
			||||||
   `username` char(64) not null unique,
 | 
					 | 
				
			||||||
   `realname` char(64) default null,
 | 
					 | 
				
			||||||
   `samaccountname` char(64) default null,
 | 
					 | 
				
			||||||
   `password` char(128) default null,
 | 
					 | 
				
			||||||
   `domain` char(64) default null,
 | 
					 | 
				
			||||||
   `dn` char(255) default '*',
 | 
					 | 
				
			||||||
   `isadmin` tinyint default 0
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
insert into `user` (`uid`, `username`, `realname`, `samaccountname`, `password`, `isadmin`, `domain`) values (0, 'admin', 'built-in piler admin', '', '$1$PItc7d$zsUgON3JRrbdGS11t9JQW1', 1, 'local');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `email` (
 | 
					 | 
				
			||||||
   `uid` int unsigned not null,
 | 
					 | 
				
			||||||
   `email` char(128) not null primary key
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
insert into `email` (`uid`, `email`) values(0, 'admin@local');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `email_groups` (
 | 
					 | 
				
			||||||
   `uid` int unsigned not null,
 | 
					 | 
				
			||||||
   `gid` int unsigned not null,
 | 
					 | 
				
			||||||
   unique key `uid` (`uid`,`gid`),
 | 
					 | 
				
			||||||
   key `email_groups_idx` (`uid`,`gid`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `group` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null auto_increment primary key,
 | 
					 | 
				
			||||||
   `groupname` char(255) not null unique
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `group_user` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null,
 | 
					 | 
				
			||||||
   `uid` int unsigned not null,
 | 
					 | 
				
			||||||
   key `group_user_idx` (`id`),
 | 
					 | 
				
			||||||
   key `group_user_idx2` (`uid`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `group_email` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null,
 | 
					 | 
				
			||||||
   `email` char(128) not null,
 | 
					 | 
				
			||||||
   key `group_email_idx` (`id`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `domain_user` (
 | 
					 | 
				
			||||||
   `domain` char(64) not null,
 | 
					 | 
				
			||||||
   `uid` int unsigned not null,
 | 
					 | 
				
			||||||
   key `domain_user_idx` (`domain`),
 | 
					 | 
				
			||||||
   key `domain_user_idx2` (`uid`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `folder` (
 | 
					 | 
				
			||||||
   `id` int not null auto_increment,
 | 
					 | 
				
			||||||
   `parent_id` int default 0,
 | 
					 | 
				
			||||||
   `name` char(64) not null,
 | 
					 | 
				
			||||||
   unique(`parent_id`, `name`),
 | 
					 | 
				
			||||||
   primary key (`id`)
 | 
					 | 
				
			||||||
) Engine=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `folder_user` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null,
 | 
					 | 
				
			||||||
   `uid` int unsigned not null,
 | 
					 | 
				
			||||||
   key `folder_user_idx` (`id`),
 | 
					 | 
				
			||||||
   key `folder_user_idx2` (`uid`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `folder_extra` (
 | 
					 | 
				
			||||||
   `id` int unsigned not null auto_increment,
 | 
					 | 
				
			||||||
   `uid` int unsigned not null,
 | 
					 | 
				
			||||||
   `name` char(64) not null,
 | 
					 | 
				
			||||||
   unique(uid, name),
 | 
					 | 
				
			||||||
   key (`id`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `folder_message` (
 | 
					 | 
				
			||||||
   folder_id bigint not null,
 | 
					 | 
				
			||||||
   id bigint not null,
 | 
					 | 
				
			||||||
   unique(folder_id, id)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `note` (
 | 
					 | 
				
			||||||
   `_id` bigint unsigned auto_increment not null,
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null,
 | 
					 | 
				
			||||||
   `uid` int not null,
 | 
					 | 
				
			||||||
   `note` text default null,
 | 
					 | 
				
			||||||
   unique(`id`, `uid`),
 | 
					 | 
				
			||||||
   key (`_id`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `remote` (
 | 
					 | 
				
			||||||
   `remotedomain` char(64) not null primary key,
 | 
					 | 
				
			||||||
   `remotehost` char(64) not null,
 | 
					 | 
				
			||||||
   `basedn` char(255) not null,
 | 
					 | 
				
			||||||
   `binddn` char(255) not null,
 | 
					 | 
				
			||||||
   `sitedescription` char(64) default null
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `domain` (
 | 
					 | 
				
			||||||
   `domain` char(64) not null primary key,
 | 
					 | 
				
			||||||
   `mapped` char(64) not null
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
insert into `domain` (`domain`, `mapped`) values('local', 'local');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `audit` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null auto_increment,
 | 
					 | 
				
			||||||
   `ts` int not null,
 | 
					 | 
				
			||||||
   `email` varchar(128) not null,
 | 
					 | 
				
			||||||
   `action` int not null,
 | 
					 | 
				
			||||||
   `ipaddr` char(15) not null,
 | 
					 | 
				
			||||||
   `meta_id` bigint unsigned not null,
 | 
					 | 
				
			||||||
   `description` varchar(255) default null,
 | 
					 | 
				
			||||||
   `vcode` char(64) default null,
 | 
					 | 
				
			||||||
   primary key (`id`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create index `audit_idx` on `audit`(`email`);
 | 
					 | 
				
			||||||
create index `audit_idx2` on `audit`(`action`);
 | 
					 | 
				
			||||||
create index `audit_idx3` on `audit`(`ipaddr`);
 | 
					 | 
				
			||||||
create index `audit_idx4` on `audit`(`ts`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `google` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null primary key,
 | 
					 | 
				
			||||||
   `email` char(128) not null unique,
 | 
					 | 
				
			||||||
   `access_token` char(255) default null,
 | 
					 | 
				
			||||||
   `refresh_token` char(255) default null,
 | 
					 | 
				
			||||||
   `created` int default 0
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
create table if not exists `google_imap` (
 | 
					 | 
				
			||||||
   `id` bigint unsigned not null,
 | 
					 | 
				
			||||||
   `email` char(128) not null,
 | 
					 | 
				
			||||||
   `last_msg_id` bigint default 0,
 | 
					 | 
				
			||||||
   key(`email`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CREATE TABLE IF NOT EXISTS `counter_stats` (
 | 
					 | 
				
			||||||
  `id` int(11) NOT NULL AUTO_INCREMENT,
 | 
					 | 
				
			||||||
  `date` int(11) NOT NULL,
 | 
					 | 
				
			||||||
  `email` varchar(255) NOT NULL,
 | 
					 | 
				
			||||||
  `domain` varchar(255) NOT NULL,
 | 
					 | 
				
			||||||
  `sent` int(11) NOT NULL,
 | 
					 | 
				
			||||||
  `recd` int(11) NOT NULL,
 | 
					 | 
				
			||||||
  `sentsize` int(11) NOT NULL,
 | 
					 | 
				
			||||||
  `recdsize` int(11) NOT NULL,
 | 
					 | 
				
			||||||
  PRIMARY KEY (`id`),
 | 
					 | 
				
			||||||
  KEY `date` (`date`),
 | 
					 | 
				
			||||||
  KEY `email` (`email`),
 | 
					 | 
				
			||||||
  KEY `domain` (`domain`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CREATE TABLE IF NOT EXISTS `customer` (
 | 
					 | 
				
			||||||
  `id` int(11) NOT NULL AUTO_INCREMENT,
 | 
					 | 
				
			||||||
  `customername` varchar(255) NOT NULL,
 | 
					 | 
				
			||||||
  `customerdesc` text NOT NULL,
 | 
					 | 
				
			||||||
  `customerpoc` int(11) NOT NULL,
 | 
					 | 
				
			||||||
  `guid` varchar(255) NOT NULL,
 | 
					 | 
				
			||||||
  PRIMARY KEY (`id`),
 | 
					 | 
				
			||||||
  UNIQUE KEY `guid` (`guid`)
 | 
					 | 
				
			||||||
) ENGINE=InnoDB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,77 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$webuidir = "";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if(isset($_SERVER['argv'][1])) { $webuidir = $_SERVER['argv'][1]; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
require_once($webuidir . "/config.php");
 | 
					 | 
				
			||||||
require(DIR_SYSTEM . "/startup.php");
 | 
					 | 
				
			||||||
require(DIR_SYSTEM . "/ldap.php");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$trash_passwords = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$cfg = read_konfig(LDAP_IMPORT_CONFIG_FILE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
foreach ($_SERVER['argv'] as $argv) {
 | 
					 | 
				
			||||||
   if($argv == "--trash-passwords") {
 | 
					 | 
				
			||||||
      $trash_passwords = 1;
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$loader = new Loader();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$language = new Language();
 | 
					 | 
				
			||||||
Registry::set('language', $language);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if(MEMCACHED_ENABLED) {
 | 
					 | 
				
			||||||
   $memcache = new Memcache();
 | 
					 | 
				
			||||||
   foreach ($memcached_servers as $m){
 | 
					 | 
				
			||||||
      $memcache->addServer($m[0], $m[1]);
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   Registry::set('memcache', $memcache);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PREFIX);
 | 
					 | 
				
			||||||
Registry::set('db', $db);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$loader->model('user/user');
 | 
					 | 
				
			||||||
$loader->model('user/import');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$import = new ModelUserImport();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$_SESSION['username'] = 'cli-admin';
 | 
					 | 
				
			||||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$totalusers = 0;
 | 
					 | 
				
			||||||
$totalnewusers = 0;
 | 
					 | 
				
			||||||
$totaldeletedusers = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
extract($language->data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
foreach ($cfg as $ldap_params) {
 | 
					 | 
				
			||||||
   $users = $import->model_user_import->query_remote_users($ldap_params, $ldap_params['domain']);
 | 
					 | 
				
			||||||
   $rc = $import->model_user_import->fill_remote_table($ldap_params, $ldap_params['domain']);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   $totalusers += count($users);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   list($newusers, $deletedusers) = $import->model_user_import->process_users($users, $ldap_params);
 | 
					 | 
				
			||||||
   list($a1, $a2) = $import->model_user_import->process_users($users, $ldap_params);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   $totalnewusers += $newusers;
 | 
					 | 
				
			||||||
   $totaldeletedusers += $deletedusers;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   if($trash_passwords == 1) {
 | 
					 | 
				
			||||||
      $import->model_user_import->trash_password($users);
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$total_emails_in_database = $import->model_user_import->count_email_addresses();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print date(LOG_DATE_FORMAT); ?>, <?php print $totalusers; ?>/<?php print $totalnewusers; ?>/<?php print $totaldeletedusers; ?>/<?php print $total_emails_in_database; ?>
 | 
					 | 
				
			||||||
@@ -105,6 +105,8 @@ make_cron_entries() {
 | 
				
			|||||||
   echo "30   2 * * * $LIBEXECDIR/piler/indexer.main.sh" >> $CRON_TMP
 | 
					   echo "30   2 * * * $LIBEXECDIR/piler/indexer.main.sh" >> $CRON_TMP
 | 
				
			||||||
   echo "*/15 * * * * $INDEXER --quiet tag1 --rotate" >> $CRON_TMP
 | 
					   echo "*/15 * * * * $INDEXER --quiet tag1 --rotate" >> $CRON_TMP
 | 
				
			||||||
   echo "*/15 * * * * $INDEXER --quiet note1 --rotate" >> $CRON_TMP
 | 
					   echo "*/15 * * * * $INDEXER --quiet note1 --rotate" >> $CRON_TMP
 | 
				
			||||||
 | 
					   echo "30   6 * * * /usr/bin/php $LIBEXECDIR/piler/generate_stats.php $$DOCROOT" >> $CRON_TMP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   echo "### PILEREND" >> $CRON_TMP
 | 
					   echo "### PILEREND" >> $CRON_TMP
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -193,12 +195,14 @@ execute_post_install_tasks() {
 | 
				
			|||||||
   rm -f $KEYTMPFILE
 | 
					   rm -f $KEYTMPFILE
 | 
				
			||||||
   echo "Done."
 | 
					   echo "Done."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   chmod 755 $LOCALSTATEDIR/piler/stat
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   echo -n "Copying www files to $DOCROOT... "
 | 
					   echo -n "Copying www files to $DOCROOT... "
 | 
				
			||||||
   mkdir -p $DOCROOT || exit 1
 | 
					   mkdir -p $DOCROOT || exit 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   cp -R webui/* $DOCROOT
 | 
					   cp -R webui/* $DOCROOT
 | 
				
			||||||
   cp -R webui/.htaccess $DOCROOT
 | 
					   cp -R webui/.htaccess $DOCROOT
 | 
				
			||||||
   chmod 770 $DOCROOT/tmp
 | 
					   chmod 770 $DOCROOT/tmp $DOCROOT/images
 | 
				
			||||||
   chgrp $WWWGROUP $DOCROOT/tmp
 | 
					   chgrp $WWWGROUP $DOCROOT/tmp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   echo "<?php" > $DOCROOT/config-site.php
 | 
					   echo "<?php" > $DOCROOT/config-site.php
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,25 +39,26 @@ $config['SITE_DESCRIPTION'] = 'piler email archiver';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// authentication against an ldap directory (disabled by default)
 | 
					// authentication against an ldap directory (disabled by default)
 | 
				
			||||||
// with zimbra specific settings
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
$config['ENABLE_LDAP_AUTH'] = 0;
 | 
					$config['ENABLE_LDAP_AUTH'] = 0;
 | 
				
			||||||
$config['LDAP_HOST'] = 'zimbra.yourdomain.com';
 | 
					$config['LDAP_HOST'] = 'ldap.yourdomain.com';
 | 
				
			||||||
$config['LDAP_HELPER_DN'] = 'uid=zimbra,cn=admins,cn=zimbra';
 | 
					$config['LDAP_HELPER_DN'] = 'cn=....';
 | 
				
			||||||
$config['LDAP_HELPER_PASSWORD'] = 'xxxxxxx';
 | 
					$config['LDAP_HELPER_PASSWORD'] = 'xxxxxxx';
 | 
				
			||||||
$config['LDAP_MAIL_ATTR'] = 'mail';
 | 
					$config['LDAP_MAIL_ATTR'] = 'mail';
 | 
				
			||||||
$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'zimbraAccount';
 | 
					 | 
				
			||||||
$config['LDAP_BASE_DN'] = '';
 | 
					 | 
				
			||||||
$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'zimbraDistributionList';
 | 
					 | 
				
			||||||
$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'zimbraMailForwardingAddress';
 | 
					 | 
				
			||||||
$config['LDAP_AUDITOR_MEMBER_DN'] = '';
 | 
					$config['LDAP_AUDITOR_MEMBER_DN'] = '';
 | 
				
			||||||
 | 
					$config['LDAP_BASE_DN'] = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// AD specific settings
 | 
					// AD specific settings
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'user';
 | 
					$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'user';
 | 
				
			||||||
//$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'group';
 | 
					$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'group';
 | 
				
			||||||
//$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'member';
 | 
					$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'member';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// zimbra specific settings
 | 
				
			||||||
 | 
					//$config['LDAP_HELPER_DN'] = 'uid=zimbra,cn=admins,cn=zimbra';
 | 
				
			||||||
 | 
					//$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'zimbraAccount';
 | 
				
			||||||
 | 
					//$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'zimbraDistributionList';
 | 
				
			||||||
 | 
					//$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'zimbraMailForwardingAddress';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Lotus Notes specific settings for ldap authentication
 | 
					// Lotus Notes specific settings for ldap authentication
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@@ -65,16 +66,16 @@ $config['LDAP_AUDITOR_MEMBER_DN'] = '';
 | 
				
			|||||||
//$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'dominoGroup');
 | 
					//$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'dominoGroup');
 | 
				
			||||||
//$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'mail';
 | 
					//$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'mail';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
// iredmail specific settings
 | 
					// iredmail specific settings
 | 
				
			||||||
//$config['LDAP_HELPER_DN'] = 'cn=vmailadmin,dc=yourdomain,dc=com';
 | 
					//$config['LDAP_HELPER_DN'] = 'cn=vmailadmin,dc=yourdomain,dc=com';
 | 
				
			||||||
//$config['LDAP_MAIL_ATTR'] = 'mail';
 | 
					 | 
				
			||||||
//$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'mailUser';
 | 
					//$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'mailUser';
 | 
				
			||||||
//$config['LDAP_BASE_DN'] = 'o=domains,dc=yourdomain,dc=com';
 | 
					//$config['LDAP_BASE_DN'] = 'o=domains,dc=yourdomain,dc=com';
 | 
				
			||||||
//$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'mailList';
 | 
					//$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'mailList';
 | 
				
			||||||
//$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'memberOfGroup';
 | 
					//$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'memberOfGroup';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// enable single sign-on (disabled by default)
 | 
					// enable single sign-on (disabled by default)
 | 
				
			||||||
$config['ENABLE_SSO_LOGIN'] = 0;
 | 
					$config['ENABLE_SSO_LOGIN'] = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user