Skip to content

Automatic trusted_sources during install - #5358

Merged
Alkarex merged 11 commits into
FreshRSS:edgefrom
Alkarex:trusted_sources-install
May 2, 2023
Merged

Alkarex merged 11 commits into
FreshRSS:edgefrom
Alkarex:trusted_sources-install

Conversation

@Alkarex

@Alkarex Alkarex commented Apr 29, 2023 •

Copy link
Copy Markdown
Member

Fix #5357
Fix also the fact that http_auth was broken during install.
And make the checkCIDR() robust when using IP addresses without a range suffix (was previously generating warnings).

@CDaxi

CDaxi commented Apr 30, 2023 •

Copy link
Copy Markdown

OK:
The installation form issue is fixed.

Still an issue:
At the config.php:

  • auth_type is still set to "form"
  • trusted_sources will not contain the ip

There should be at least an information that these data has to manually changed by the admin.
The better way would be to add the input for trusted_sources at the installation process and display it only if the http_auth is selected.

Thanks for the quick response to my issue.

@Alkarex

Alkarex commented Apr 30, 2023

Copy link
Copy Markdown
Member Author

Could you please try again @CDaxi ?

Comment thread lib/lib_rss.php Resolved
Comment thread lib/lib_rss.php Resolved
@CDaxi

CDaxi commented May 2, 2023

Copy link
Copy Markdown

Installation is working fine now.
Trusted proxy with subnet /32 is automatically set - great.
But after logging out from authelia and logging in with an non existing user, I will get a 500 error.

PHP Fatal error: Uncaught TypeError: FreshRSS_user_Controller::createUser(): Argument #2 ($email) must be of type string, null given, called in /var/www/FreshRSS/app/Models/Auth.php on line 83 and defined in /var/www/FreshRSS/app/Controllers/userController.php:215\nStack trace:\n#0 /var/www/FreshRSS/app/Models/Auth.php(83): FreshRSS_user_Controller::createUser()\n#1 /var/www/FreshRSS/app/Models/Auth.php(36): FreshRSS_Auth::accessControl()\n#2 /var/www/FreshRSS/app/FreshRSS.php(75): FreshRSS_Auth::init()\n#3 /var/www/FreshRSS/app/FreshRSS.php(48): FreshRSS::initAuth()\n#4 /var/www/FreshRSS/p/i/index.php(55): FreshRSS->init()\n#5 {main}\n thrown in /var/www/FreshRSS/app/Controllers/userController.php on line 215

The user can not be created because there is null handed over at createUser at argument 2.
Authelia will provide the users E-Mail at the Header "Remote-Email" (as described here: https://www.authelia.com/integration/trusted-header-sso/introduction/).

After adding "HTTP_REMOTE_EMAIL" in config.php at "http_auth_auto_register_email_field", the user can be created.
This configuration can also not be set at the installation process.

Perhaps there can also be a check if $_SERVER['HTTP_REMOTE_EMAIL'] is present and be automatically set in the config?
The perfect solution will be a prefilled installation input for the trusted_sources and http_auth_auto_register_email_field only visible when selection http_auth at installation.

@Alkarex

Alkarex commented May 2, 2023

Copy link
Copy Markdown
Member Author

Thanks for the tests and feedback. The null exception should be fixed. The e-mail is not actually used to anything for this type of login. Could you please try again?

I would like in the current PR to only fix the (more urgent) regressions, while new features and enhancements can be done in a future one.

@CDaxi

CDaxi commented May 2, 2023 •

Copy link
Copy Markdown

Auth works now like a charm.
I agree, to get the additional configurations available at frontend at a different PR in future.

Thanks a lot for the quick response and fixes. Great job. 👏

@Alkarex
Alkarex merged commit 0a38aa7 into FreshRSS:edge May 2, 2023
@Alkarex
Alkarex deleted the trusted_sources-install branch May 2, 2023 22:37
@Alkarex

Alkarex commented May 2, 2023

Copy link
Copy Markdown
Member Author

Thanks for the feedback! Feel free to collect your ideas of improvements into a new issue, if sufficiently relevant

Alkarex added a commit to Alkarex/FreshRSS that referenced this pull request Jul 26, 2023
Alkarex added a commit that referenced this pull request Jul 30, 2023
* Rework trusted proxies
Fix #5502
Follow-up of #3226

New environment variable `TRUSTED_PROXY`: set to 0 to disable, or to a list of trusted IP ranges compatible with https://httpd.apache.org/docs/current/mod/mod_remoteip.html#remoteiptrustedproxy

New internal environment variable `CONN_REMOTE_ADDR` to remember the true IP address of the connection (e.g. last proxy), even when using mod_remoteip.

Current working setups should not observe any significant change.

* Minor whitespace

* Safer trusted sources during install
Rework of #5358
#5357

* Minor readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Installation process step 3 not possible when already integrated in traefik and authelia

3 participants