Hi Matthias,

Many thanks again for your advice - feedback on this

Best regards


________________________________
From: [email protected] <[email protected]> on behalf of Matthias Kneer 
<[email protected]>
Sent: Monday, March 1, 2021 9:09 PM
To: [email protected] <[email protected]>
Subject: Re: [SOGo] Restrict Web Access at SOGo from specific User - Domain

Hi,

>  We have found the solution at the below path:
>
>  /usr/lib64/GNUstep/SOGo/WebServerResources/js/Main.js

While this might work for now, I don't think that this is a good long
term solution. You will / might run into trouble once you update SOGo
since this file might be overwritten. Another issue: This won't work
dynamically if you need to allow multiple domains in the future.

I would suggest to create / modify a table view which only returns users
from the domain that should be able to login. Your view should return
following columns (documented in section "5.10. Authentication using
SQL" of the installation guide):
c_uid: will be used for authentication - it’s a username or
[email protected]
c_name: will be used to uniquely identify entries - which can be
identical to c_uid
c_password: password of the user, plain text, crypt, md5 or sha encoded
c_cn: the user’s common name
mail: the user’s email address

I don't know how your current sogo user database table looks like, so
here's just an rough example on how to create such a "filtered" view,
the view is called "sogo_view" and the souce table is called
"mail_users", this has to be adjusted to match your environment:
CREATE VIEW sogo_view AS SELECT username AS c_uid, password AS
c_password, username AS c_name, fullname AS c_cn FROM mail_users WHERE
username LIKE '%@test2.com';

After you've created that view, and granted privileges to the sogo
postgres user, you can reference it in you SOGoUserSources hash like
this:

viewURL = "postgresql://sogo:[email protected]:5432/sogo/sogo_view";

I hope this helps.

- Matthias
--
[email protected]
https://inverse.ca/sogo/lists
-- 
[email protected]
https://inverse.ca/sogo/lists

Reply via email to