LINCnil / pia-back

Programme développé avec le framework RubyOnRails mettant à disposition une API RESTful à destination des outils PIA et PIA-APP. | Program developped with RubyOnRails providing a RESTful API for the PIA and PIA-APP applications.
GNU General Public License v3.0
156 stars 65 forks source link

Useraccounts, LDAP, Mailing #252

Open mpall-moz opened 5 months ago

mpall-moz commented 5 months ago

Hi,

I'm having problems to add user accounts. LDAP-Configuration isn't working, I'm not able to find a proper description about what kind of values in which form are needed - the ones I put in the config file seems not to be working. Same problem I'm having with the mailsettings - they also seems not to be working for me.

When I try to create a user account with the local admin account I created I can put in first name, sure name and email. After pressing the continue button it get grayed out and switch back to green after some while, the dialog stays there. When I press the now green continue button again this error appears:

image

Only when I close the dialog with cancel and refresh the page I can see the new user account - status is "Waiting for activation" but this never will happen without an email.

When I add a local user account the log-file (/var/www/pia-back/log/production.log) is showing me the following:

image

Both actions (LDAP-Login and email) are ending with: Completed 500 Internal Server Error in 5574ms (ActiveRecord: 4.2ms | Allocations: 5107), as to me it seems like there is a problem somewhere.

Also it would be nice when I could enter the server settings for the backend-server in the configuration for the frontend part so that the users will not have to enter them, especially when using the server installation.

Any advice?

Best regards Michael

kevin-atnos commented 5 months ago

Hi there,

Thank you for your message.

Do you receive emails from the PIA tool? (activation email) Did you follow the Wiki about the SMTP configuration? https://github.com/LINCnil/pia-back/wiki/Install-the-pia-back-application#smtp-configuration

Also, when you check the LDAP section, does everything match with your configuration? https://github.com/LINCnil/pia-back/wiki/Install-the-pia-back-application#optional-enable-ldap-mode

About the Server URL / Client ID / Client SECRET, this is something discussed with the CNIL, so we might change this at some point: https://github.com/LINCnil/pia-back/issues/238

Regards,

mpall-moz commented 5 months ago

Hi,

I'm not receiving any e-mails and of course I followed both instructions, also tried them with different values - especially for LDAP without any luck. As for the e-mail part are there any other logs I can have a look at?

Best regards Michael

syl-p commented 5 months ago

Hello @mpall-moz, Can you look at another time your SMTP settings and make attention to the enable_starttls_auto and port settings ?

https://stackoverflow.com/questions/26166032/rails-4-netreadtimeout-when-calling-actionmailer https://copyprogramming.com/howto/rails-4-net-readtimeout-when-calling-actionmailer

mpall-moz commented 5 months ago

Hi,

thanks for your input. According to Microsoft it should work with and without TLS:

image

I tried both ways without any luck. The config for the mail part is this one:

email_from: @.*** smtp_address: xxxxx.mail.protection.outlook.com smtp_port: 25 smtp_domain: abcd.ac.at

smtp_user_name: xxxx

smtp_password: xxxx

smtp_authentication: :cram_md5

smtp_enable_starttls_auto: true -> also tried false here

Kind regards Michael

mpall-moz commented 5 months ago

Seems like the problem with mailing is solved (it was a mix between configuration and network issues). The error shown in the log (completed 500 internal server error) was connected with it, now its gone and adding an user account is also possible without any issue. A more detailed log or some proper entries in the log (production.log in log-directory) would have been helpful.

The only thing thats still not working is the LDAP (Active Directory) connection.

Best regards Michael

gmsulkowice commented 2 months ago

Seems like the problem with mailing is solved (it was a mix between configuration and network issues). The error shown in the log (completed 500 internal server error) was connected with it, now its gone and adding an user account is also possible without any issue. A more detailed log or some proper entries in the log (production.log in log-directory) would have been helpful.

Hi. I think i have the same problem... Can You explain me how you reapir Your config?

I don't understand why in my log: Delivered mail 6671838a16ad4_115566b9490c7@pia.mail (5023.1ms)

My log:

I, [2024-06-18T14:54:33.766805 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Started POST "/users" for 192.168.0.42 at 2024-06-18 14:54:33 +0200 I, [2024-06-18T14:54:33.768947 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Processing by UsersController#create as / I, [2024-06-18T14:54:33.769079 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Parameters: {"user"=>{"lastname"=>"Name_last", "firstname"=>"name_first", "email"=>"adres@mail.serwer", "access_type"=>"[\"functional\",\"user\"]"}} I, [2024-06-18T14:54:34.090613 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Rendered user_mailer/uuid_created.html.erb within layouts/mailer (Duration: 0.1ms | Allocations: 41) I, [2024-06-18T14:54:34.090743 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Rendered layout layouts/mailer.html.erb (Duration: 0.3ms | Allocations: 79) I, [2024-06-18T14:54:34.090982 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Rendered user_mailer/uuid_created.text.erb within layouts/mailer (Duration: 0.1ms | Allocations: 30) I, [2024-06-18T14:54:34.091024 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Rendered layout layouts/mailer.text.erb (Duration: 0.1ms | Allocations: 68) I, [2024-06-18T14:54:39.115711 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Delivered mail 6671838a16ad4_115566b9490c7@pia.mail (5023.1ms) I, [2024-06-18T14:54:39.118015 #70998] INFO -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27] Completed 500 Internal Server Error in 5349ms (ActiveRecord: 15.3ms | Allocations: 5094) F, [2024-06-18T14:54:39.119257 #70998] FATAL -- : [db1b3458-2e73-41f3-b14f-f72c9868ca27]