jsuto / piler

Email archiving application
https://www.mailpiler.org/
Other
51 stars 8 forks source link

Crarify that php-memcached and not php-memcahe is needed #85

Closed dilyanpalauzov closed 2 months ago

dilyanpalauzov commented 2 months ago

At https://www.mailpiler.org/installation/ is said that these are needed:

PHP has two bindings to memcache. One is called Memcache, the other is called Memcached - with d at the end. And here really is meant that package with d at the end

dilyanpalauzov commented 2 months ago

Apart from this, the system logs for customer.php:122 that Memcached:add() expects 3 parameters, but 4 are given.

jsuto commented 2 months ago

You need the Memcached php plugin.

jsuto commented 2 months ago

The issue is solved on the master branch.

dilyanpalauzov commented 2 months ago

I do not understand what you mean. At https://www.mailpiler.org/installation/ the text is not correct for version Piler 1.4.5.

jsuto commented 2 months ago

I'll fix the text. Any other issue?

jsuto commented 2 months ago

Fixed the docs.

dilyanpalauzov commented 2 months ago

My reading is that on the master branch Memcached::add() receives 3, not 4 parameters.

Any other issue?

Thanks for asking!

In Piler 1.4.5 when I do Advanced Search, enter as start 2024-07-10, as end 2024-07-13 (tomorrow) and click on OK, the system logs

Jul 12 19:08:04 934bd4e1d8e9 piler-webui[26860]: sphinx query: 'SELECT id FROM piler1 WHERE   sent >= 1720562400  AND sent <= 1720907999  AND      MATCH(' ( (@sender ) | (@rcpt ) ) ') ORDER BY `sent` DESC LIMIT 0,20 OPTION max_matches=5000' in 0.04 s, 0 hits, 0 total found

thus 0 hits. But the table is not empty:

$ echo "select * from piler1;" | mysql --host 127.0.0.1 -P 9306 piler         
id  arrived sent    size    direction   folder  attachments
1   1720793059  1720793058  375 0   0   0

How can I fix the query to return the only archived item?

jsuto commented 2 months ago

It seems that the gui doesn't assign any email address for you. What do you see on the user settings page?

dilyanpalauzov commented 2 months ago

Thanks for the hint with the own email address under settings! After adjusting the LDAP configuration, under Settings, I see my own email address, and that I am member of no group. In the previous Piler installation, define('BUILD', '2014-01-29 858‘);, the own email address is also not shown, but searches do work. Why is it significant for Piler to see the email address of the current user? All users should see in my use case all emails.

jsuto commented 2 months ago

Lots of bugs to fix.

Why is it significant for Piler to see the email address of the current user? All users should see in my use case all emails.

Piler shows only the user's own emails, and to do that it needs to know the email addresses of the user. IN your case, however, you may grant all users to be auditors, so everyone can see any emails. Btw. I wonder, what use case would require that?

The redirects

They are fine on the master branch

The RT settings

I thought, it was obvious to keep the RT settings in sync with manticore config, piler.conf and config-site.php.

Systemd install path

It's your call and the install script's call to put these systemd files to the appropriate location.

dilyanpalauzov commented 2 months ago

Piler shows only the user's own emails, and to do that it needs to know the email addresses of the user. IN your case, however, you may grant all users to be auditors, so everyone can see any emails. Btw. I wonder, what use case would require that?

Some servers send emails to the customers, and copies of the emails are stored in Piler. Customer support needs access to all emails and no body else needs access there. So all users should be able to find all emails.

The redirects

They are fine on the master branch

The first three matches below from the master branch do not look fine for me:

% git grep "Location:"|grep -v SITE_URL                               master
webui/controller/folder/edit.php:         Header("Location: folders.php");
webui/controller/folder/list.php:         Header("Location: folders.php");
webui/controller/folder/list.php:         Header("Location: folders.php");
webui/controller/health/health.php:            header("Location: " . HEALTH_URL);
webui/controller/login/google.php:         header('Location: ' . GOOGLE_REDIRECT_URL);
webui/controller/message/view.php:         header("Location: " . $_SERVER['HTTP_REFERER']);
webui/google-api/auth/apiOAuth.php:    header("Location: $authorizeRedirect");
webui/google-api/auth/apiOAuth2.php:    header('Location: ' . $authUrl);

The RT settings

I thought, it was obvious to keep the RT settings in sync with manticore config, piler.conf and config-site.php.

Yes, it is kind of implicit. But the current default configuration is neither fer RT, nor fer non-RT, as it has $config['RT‘] = 1 but misses define('RT', 1);. I think best would be to change $config['RT'] = 0 in the provided template, and update the documentation for RT to set there $config['RT']=1.

Systemd install path

It's your call and the install script's call to put these systemd files to the appropriate location.

Why isn't the install target just removed, or set to do nothing? The current install-behaviour definitely has no added value compared to not doing anything.

jsuto commented 2 months ago

I've just done a PR to fix the missing redirects: https://github.com/jsuto/piler/pull/88

The RT settings are consistent on the master branch

Also, I'd rather keep the install target for the systemd stuff. Not everyone installs from the source, I also ship some packages, and the systemd files wouldn't be available otherwise.

dilyanpalauzov commented 2 months ago

The systemd .service files will be available for the users not installing from source, depending on how that files are shipped over intermediary to the users. I do not see how installing .service files to a place not read by systemd, ensures that these files are delivered to users, not installing from source.

For LDAP login, does setting ENABLE_AUDIT=0 and RESTRICTED_AUDITOR=0 permit all users to read all emails?

Commit 1ebd49956a8aeb787f6832d4a43d21d40ab442d2 removes the variable ENABLE_REMOTE_IMAGES from webui/model/search/message.php. Can this variable be removed also from config.php.in, as I do not see any place, where it is used?

Why are $config['SMTP_DOMAIN‘], $config['FROM_DOMAIN'], $config['ADMIN_EMAIL‘], $config['SITE_URL‘] and $config['DB_PASSWORD‘] = 'MYSQL_PASSWORD‘ present both in config.php.in and config-site.php.in? Honestly, I do not understand which file is for what and why a single file is not sufficient.

Is the $config['SMARTHOST] smart host resolved by looking the MX record, or the A record? I mean, if I have two servers for redundancy and I want to enter one host name as smart host, do I have to create subdomain sh.example.org with two MX records, resolving to each host, or do I have to create that subdomain with just two A records?

jsuto commented 2 months ago

Let's skip the systemd stuff, I keep it as it is for the moment.

For LDAP login, does setting ENABLE_AUDIT=0 and RESTRICTED_AUDITOR=0 permit all users to read all emails?

No

Can this variable be removed also from config.php.in

Done

I do not understand which file is for what and why a single file is not sufficient.

/var/piler/www/config.php ships the default values. You should not change this file, because an upgrade would overwrite your changes. Instead put your site specific settings to config-site.php.

Is the $config['SMARTHOST] smart host resolved by looking the MX record, or the A record?

The A record. If you have 2 hosts, then either use Round-Robin or you may deploy an MTA to the archive running on a high port, eg. 127.0.0.1:2525, and specify it as the smarthost. Then configure the MTA to use whatever smarthosts you have.

Btw. since these stuff has nothing to do with the original issue, please create a new one for further topics.

dilyanpalauzov commented 1 month ago

The RT settings are consistent on the master branch

build/piler.conf contaiins rtindex=0, while the default for missing rtindex is =1.

jsuto commented 1 month ago

Right, I've fixed it in fe6a0b9f

dilyanpalauzov commented 1 month ago

As git grep -n memcached_enable returns only build/piler.conf:14:memcached_enable=0, that is: it is not mentioned anywhere else, does memcached_enable do anything?

dilyanpalauzov commented 1 month ago

Ahm, does use_antivrus do anything?

 git grep -n use_antivirus
build/piler.conf:35:use_antivirus=0
src/cfg.c:109:   { "use_antivirus", "integer", (void*) int_parser, offsetof(struct config, use_antivirus), "1", sizeof(int)},
src/cfg.h:35:   int use_antivirus;
dilyanpalauzov commented 1 month ago

d505fd10c2bbc71a5d824 has partially removed use_antivirus:

#ifdef HAVE_ANTIVIRUS
   if(sctx->cfg->use_antivirus == 1){
      sctx->sdata->rav = do_av_check(sctx->sdata, &virusinfo[0], sctx->data, sctx->cfg);
   }
#endif
jsuto commented 1 month ago

Removed both unused variable.