mirror of
https://github.com/cypht-org/cypht.git
synced 2026-04-25 04:56:03 +03:00
[GH-ISSUE #813] Allow database authentication using pg_service.conf #486
Labels
No labels
2fa
I18N
PGP
Security
Security
account
advanced_search
advanced_search
announcement
api_login
authentication
awaiting feedback
blocker
bug
bug
bug
calendar
config
contacts
core
core
devops
docker
docs
duplicate
dynamic_login
enhancement
epic
feature
feeds
framework
github
github
gmail_contacts
good first issue
help wanted
history
history
imap
imap_folders
inline_message
installation
keyboard_shortcuts
keyboard_shortcuts
ldap_contacts
mobile
need-ssh-access
new module set
nux
pop3
profiles
pull-request
question
refactor
release
research
saved_searches
smtp
strategic
tags
tests
themes
website
wordpress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cypht#486
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ivanov17 on GitHub (Oct 30, 2023).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/813
Originally assigned to: @Shadow243 on GitHub.
🚀 Feature
Hello! Unfortunately, it is currently not possible to authenticate to a PostgreSQL database using the credentials stored in the pg_service.conf file. However, this is a more secure method than storing credentials in the application configuration, even if it is not located at the root of the web server.
As far as I can see, the application currently requires storing database credentials in the application configuration.
github.com/cypht-org/cypht@3579a081b5/lib/db.php (L18)This leads to the fact that despite a successful IMAP login, I can't to login to application.
At the same time, on the Cypht login page I see the message
Invalid username or password, which is incorrect because the IMAP server logs indicate the opposite.Design, Layout, Architecture
I think making the
db_user,db_pass,db_nameanddb_hostparameters optional would be sufficient. Or maybe the application should try to connect to the database without using any parameters, and only if there is no connection should it try to use the credentials from the configuration.Thank you.
@ivanov17 commented on GitHub (Oct 31, 2023):
I'm not familiar with PHP at all, so I can't suggest a working patch. But I remember that
fluxbbforum application was able to connect to the database without any application-side configuration at all. That was great.Unfortunately,
fluxbbdid not use thephp-pdomodule, it usedphp-pgsql,php-mysqli, etc. But at first glance there is nothing special here: https://github.com/fluxbb/fluxbb/blob/master/include/dblayer/pgsql.php#L41-L76 (code is GPL-licensed). Hopefully the same principle will work for PDO.@marclaporte commented on GitHub (Nov 4, 2023):
@ivanov17 Thank you for the report. AFAIK, PostgreSQL is not currently used by the most active Cypht developers so I don't expect a quick resolution. But I'll tag with "help wanted" so the right person can step up.
@ivanov17 commented on GitHub (Nov 4, 2023):
@marclaporte Thank you. Maybe there is some workaround for now to not store passwords in the INI file? Unfortunately, I couldn't find any information about using environment variables to pass Cypht configuration variables. Please tell me, is this possible?
And another question, does the INI file support variable substitution?
@marclaporte commented on GitHub (Nov 4, 2023):
"Persistent data stored between logins is encrypted with a key derived from your clear text password, which is obviously not stored anywhere"
Reference: https://cypht.org/security.html
@ivanov17 commented on GitHub (Nov 4, 2023):
@marclaporte Thanks for the link, but in this case I mean that the database credentials, including passwords, are stored in
hm3.inifile.In my setup, all containerized web applications read the standard
PGSERVICEenvironment variable and then take the database connection information from thepg_service.conffile. For now, with the exception of Cypht.I can easily add other environment variables for the application servers, but would like to avoid storing credentials in the configuration file, which in my case is stored in a Git repository.
That's why I ask about environment variables 🙂
@marclaporte commented on GitHub (Nov 4, 2023):
@Shadow243 Can you look into environment variables ?
In Tiki Manager, we use https://packagist.org/packages/symfony/dotenv as per https://gitlab.com/tikiwiki/tiki-manager/-/blob/master/composer.json#L24 and I'd like to add support to Tiki as well. It would make sense for Cypht, Tiki and Tiki Manager to harmonize on a solution.
Thanks!
@marclaporte commented on GitHub (Dec 16, 2023):
@ivanov17 Please test the newly added environment variables :-)