nuxsmin / docker-syspass

Docker stuff for running sysPass on Docker
GNU General Public License v3.0
39 stars 21 forks source link

DB connection issue #49

Closed tjani10 closed 3 years ago

tjani10 commented 3 years ago

hi,

I am using the latest (3.2) syspass-docker and I can't reach the DB when I try to configure the syspass.

from the docker log I see this: syspass-app | [Wed Jan 06 16:38:37.234889 2021] [php7:notice] [pid 24] [client 10.65.193.101:53091] [EXCEPTION] [(P) SQLSTATE[HY000] [1045] Access denied for user 'sp_5ff5e78b6ba2c'@'10.1.9.197' (using password: YES)\n#0 /var/www/html/sysPass/lib/SP/Storage/Database/MySQLHandler.php(109): PDO->__construct('mysql:charset=u...', 'sp_5ff5e78b6ba2...', 'twn5!WgGp0)DDsp...', Array)\n#1 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(216): SP\Storage\Database\MySQLHandler->getConnection()\n#2 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\Storage\Database\Database->prepareQueryData(Object(SP\Storage\Database\QueryData))\n#3 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\Storage\Database\Database->doQuery(Object(SP\Storage\Database\QueryData))\n#4 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\Repositories\Config\ConfigRepository->create(Object(SP\DataModel\ConfigData))\n#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\Services\Config\ConfigService->create(Object(SP\DataModel\ConfigData))\n#6 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\Services\Install\Installer->saveMasterPassword()\n#7 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()\n#8 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))\n#9 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()\n#10 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array, Array)\n#11 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)\n#12 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)\n#13 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)\n#14 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))\n#15 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))\n#16 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')\n#17 {main}] N/A, referer: https://10.85.73.247/index.php?r=install/index

the user name is syspass for the DB. To the DB from the machine where I running the docker is reachable and I can login with this username and its password.

From the attached log, I see that the username is not same what I configure on the configuration page.

Thanks for your help! jani

3XC1T3D commented 3 years ago

See this issue, especially the part with the network setting:

https://github.com/nuxsmin/docker-syspass/issues/35

tjani10 commented 3 years ago

do you mean this part? networks: syspass_net: ipam: driver: default config:

The DB is available for the docker and I can login with this username into the DB.

here is my yaml: version: '3' services: app: container_name: syspass-app image: syspass/syspass:3.2.0 restart: always ports:

volumes: syspass-config: {} syspass-backup: {}

do you think it is ok?

thanks for your help!

3XC1T3D commented 3 years ago

Hi,

i think the problem is, that your initial grant in the mysql db for a specific docker container ip, differs from the docker ip it has now.

Therefore i fix the ip adress of the container ip. You understand?

Best Regards

tjani10 commented 3 years ago

hi, in the DB I allowed a bigger subnet for it. I have tested the mysql connection from different IPs and those are ok. I don't think that I need to configure any IP for this container. From my side I see that the application try to use different user to connect the DB. with syspass username: [2021-01-07 11:31:23] syspass.EXCEPTION: logger {"message":"(P) SQLSTATE[HY000] [1045] Access denied for user 'sp_5ff6f109a438d'@'10.1.9.197' (using password: YES) with testuser username: [2021-01-07 11:32:27] syspass.EXCEPTION: logger {"message":"(P) SQLSTATE[HY000] [1045] Access denied for user 'testuser'@'10.1.9.197' (using password: YES)

I think there are some issue in the code.

tjani10 commented 3 years ago

here is the log from the docker: root@142e2a91701c:/var/www/html# tail -f sysPass/app/config/syspass.log

[2021-01-07 13:37:52] syspass.INFO: logger {"message":"Extensions checked","caller":"SP\Core\PhpExtensionChecker::checkMandatory"}
[2021-01-07 13:37:52] syspass.INFO: logger {"message":"Saved icons cache","caller":"SP\Core\UI\Theme::saveIcons"}
[2021-01-07 13:37:52] syspass.INFO: logger {"message":"Loaded actions cache","caller":"SP\Core\Acl\Actions::loadCache"}
[2021-01-07 13:37:54] syspass.EXCEPTION: logger {"message":"Unable to connect to DB
#0 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(216): SP\Storage\Database\MySQLHandler->getConnection()
#1 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\Storage\Database\Database->prepareQueryData(Object(SP\Storage\Database\QueryData))
#2 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\Storage\Database\Database->doQuery(Object(SP\Storage\Database\QueryData))
#3 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\Repositories\Config\ConfigRepository->create(Object(SP\DataModel\ConfigData))
#4 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\Services\Config\ConfigService->create(Object(SP\DataModel\ConfigData))
#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\Services\Install\Installer->saveMasterPassword()
#6 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#7 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#8 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#9 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array,Array)
#10 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#11 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#12 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route),Object(Klein\DataCollection\RouteCollection),Array)
#13 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#14 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap->run(Object(DI\Container))
#15 /var/www/html/sysPass/index.php(28): require(String)","caller":"N/A"}
[2021-01-07 13:37:54] syspass.EXCEPTION: logger {"message":"(P) SQLSTATE[HY000] [1045] Access denied for user 'sp_5ff70eb0aed9c'@'10.1.17.155' (using password: YES)
#0 /var/www/html/sysPass/lib/SP/Storage/Database/MySQLHandler.php(109): PDO->__construct('mysql:charset=u...', 'sp_5ff70eb0aed9...', ':(r@1ZpB1EGGp0r...', Array)
#1 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(216): SP\Storage\Database\MySQLHandler->getConnection()
#2 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\Storage\Database\Database->prepareQueryData(Object(SP\Storage\Database\QueryData))
#3 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\Storage\Database\Database->doQuery(Object(SP\Storage\Database\QueryData))
#4 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\Repositories\Config\ConfigRepository->create(Object(SP\DataModel\ConfigData))
#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\Services\Config\ConfigService->create(Object(SP\DataModel\ConfigData))
#6 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\Services\Install\Installer->saveMasterPassword()
#7 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#8 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#9 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#10 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array, Array)
#11 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#12 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#13 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)
#14 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#15 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))
#16 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')
#17 {main}","caller":"N/A"}
[2021-01-07 13:37:54] syspass.EXCEPTION: logger {"message":"Unable to connect to DB
#0 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\Storage\Database\Database->prepareQueryData(Object(SP\Storage\Database\QueryData))
#1 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\Storage\Database\Database->doQuery(Object(SP\Storage\Database\QueryData))
#2 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\Repositories\Config\ConfigRepository->create(Object(SP\DataModel\ConfigData))
#3 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\Services\Config\ConfigService->create(Object(SP\DataModel\ConfigData))
#4 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\Services\Install\Installer->saveMasterPassword()
#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#6 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#7 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#8 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array,Array)
#9 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#10 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#11 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route),Object(Klein\DataCollection\RouteCollection),Array)
#12 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#13 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap->run(Object(DI\Container))
#14 /var/www/html/sysPass/index.php(28): require(String)","caller":"N/A"}
[2021-01-07 13:37:54] syspass.EXCEPTION: logger {"message":"(P) Unable to connect to DB
#0 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(216): SP\Storage\Database\MySQLHandler->getConnection()
#1 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\Storage\Database\Database->prepareQueryData(Object(SP\Storage\Database\QueryData))
#2 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\Storage\Database\Database->doQuery(Object(SP\Storage\Database\QueryData))
#3 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\Repositories\Config\ConfigRepository->create(Object(SP\DataModel\ConfigData))
#4 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\Services\Config\ConfigService->create(Object(SP\DataModel\ConfigData))
#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\Services\Install\Installer->saveMasterPassword()
#6 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#7 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#8 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#9 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array, Array)
#10 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#11 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#12 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)
#13 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#14 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))
#15 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')
#16 {main}","caller":"N/A"}
[2021-01-07 13:37:55] syspass.EXCEPTION: logger {"message":"Unable to connect to DB
#0 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\Services\Install\Installer->saveMasterPassword()
#1 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#2 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#3 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#4 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array,Array)
#5 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#6 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#7 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route),Object(Klein\DataCollection\RouteCollection),Array)
#8 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#9 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap->run(Object(DI\Container))
#10 /var/www/html/sysPass/index.php(28): require(String)","caller":"N/A"}
[2021-01-07 13:37:55] syspass.EXCEPTION: logger {"message":"(P) Unable to connect to DB
#0 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\Storage\Database\Database->prepareQueryData(Object(SP\Storage\Database\QueryData))
#1 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\Storage\Database\Database->doQuery(Object(SP\Storage\Database\QueryData))
#2 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\Repositories\Config\ConfigRepository->create(Object(SP\DataModel\ConfigData))
#3 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\Services\Config\ConfigService->create(Object(SP\DataModel\ConfigData))
#4 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\Services\Install\Installer->saveMasterPassword()
#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\Services\Install\Installer->install()
#6 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\Services\Install\Installer->run(Object(SP\Services\Install\InstallData))
#7 [internal function]: SP\Modules\Web\Controllers\InstallController->installAction()
#8 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array, Array)
#9 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#10 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure), Object(Klein\Request), Object(Klein\Response), Object(Klein\ServiceProvider), Object(Klein\App), Object(Klein\Klein), Object(Klein\DataCollection\RouteCollection), Array)
#11 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route), Object(Klein\DataCollection\RouteCollection), Array)
#12 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#13 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap::run(Object(DI\Container))
#14 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')
#15 {main}","caller":"N/A"}
tjani10 commented 3 years ago

hi,

today I tried to reconfigure the full docker but it didn't help.

here is the latest log from:

syspass-app | [Fri Jan 08 12:23:21.247350 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [INFO] [Extensions checked] SP\\Core\\PhpExtensionChecker::checkMandatory, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | [Fri Jan 08 12:23:21.249237 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [INFO] [Saved icons cache] SP\\Core\\UI\\Theme::saveIcons, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | [Fri Jan 08 12:23:21.250159 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [INFO] [Loaded actions cache] SP\\Core\\Acl\\Actions::loadCache, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | [Fri Jan 08 12:23:23.297195 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [EXCEPTION] [Unable to connect to DB\n#0 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(216): SP\\Storage\\Database\\MySQLHandler->getConnection()\n#1 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\\Storage\\Database\\Database->prepareQueryData(Object(SP\\Storage\\Database\\QueryData))\n#2 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\\Storage\\Database\\Database->doQuery(Object(SP\\Storage\\Database\\QueryData))\n#3 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\\Repositories\\Config\\ConfigRepository->create(Object(SP\\DataModel\\ConfigData))\n#4 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\\Services\\Config\\ConfigService->create(Object(SP\\DataModel\\ConfigData))\n#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\\Services\\Install\\Installer->saveMasterPassword()\n#6 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\\Services\\Install\\Installer->install()\n#7 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\\Services\\Install\\Installer->run(Object(SP\\Services\\Install\\InstallData))\n#8 [internal function]: SP\\Modules\\Web\\Controllers\\InstallController->installAction()\n#9 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array,Array)\n#10 [internal function]: SP\\Bootstrap->SP\\{closure}(Object(Klein\\Request),Object(Klein\\Response),Object(Klein\\ServiceProvider),Object(Klein\\App),Object(Klein\\Klein),Object(Klein\\DataCollection\\RouteCollection),Array)\n#11 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\\Request),Object(Klein\\Response),Object(Klein\\ServiceProvider),Object(Klein\\App),Object(Klein\\Klein),Object(Klein\\DataCollection\\RouteCollection),Array)\n#12 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\\Klein->handleRouteCallback(Object(Klein\\Route),Object(Klein\\DataCollection\\RouteCollection),Array)\n#13 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\\Klein->dispatch(Object(Klein\\Request))\n#14 /var/www/html/sysPass/lib/Base.php(75): SP\\Bootstrap->run(Object(DI\\Container))\n#15 /var/www/html/sysPass/index.php(28): require(String)] N/A, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | [Fri Jan 08 12:23:23.297294 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [EXCEPTION] [(P) SQLSTATE[HY000] [1045] Access denied for user 'sp_5ff84eb976891'@'10.1.17.83' (using password: YES)\n#0 /var/www/html/sysPass/lib/SP/Storage/Database/MySQLHandler.php(109): PDO->__construct('mysql:charset=u...', 'sp_5ff84eb97689...', '-z9$8LklCaR3qcw...', Array)\n#1 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(216): SP\\Storage\\Database\\MySQLHandler->getConnection()\n#2 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\\Storage\\Database\\Database->prepareQueryData(Object(SP\\Storage\\Database\\QueryData))\n#3 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\\Storage\\Database\\Database->doQuery(Object(SP\\Storage\\Database\\QueryData))\n#4 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\\Repositories\\Config\\ConfigRepository->create(Object(SP\\DataModel\\ConfigData))\n#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\\Services\\Config\\ConfigService->create(Object(SP\\DataModel\\ConfigData))\n#6 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\\Services\\Install\\Installer->saveMasterPassword()\n#7 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\\Services\\Install\\Installer->install()\n#8 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\\Services\\Install\\Installer->run(Object(SP\\Services\\Install\\InstallData))\n#9 [internal function]: SP\\Modules\\Web\\Controllers\\InstallController->installAction()\n#10 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array, Array)\n#11 [internal function]: SP\\Bootstrap->SP\\{closure}(Object(Klein\\Request), Object(Klein\\Response), Object(Klein\\ServiceProvider), Object(Klein\\App), Object(Klein\\Klein), Object(Klein\\DataCollection\\RouteCollection), Array)\n#12 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure), Object(Klein\\Request), Object(Klein\\Response), Object(Klein\\ServiceProvider), Object(Klein\\App), Object(Klein\\Klein), Object(Klein\\DataCollection\\RouteCollection), Array)\n#13 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\\Klein->handleRouteCallback(Object(Klein\\Route), Object(Klein\\DataCollection\\RouteCollection), Array)\n#14 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\\Klein->dispatch(Object(Klein\\Request))\n#15 /var/www/html/sysPass/lib/Base.php(75): SP\\Bootstrap::run(Object(DI\\Container))\n#16 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')\n#17 {main}] N/A, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | [Fri Jan 08 12:23:23.297459 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [EXCEPTION] [Unable to connect to DB\n#0 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\\Storage\\Database\\Database->prepareQueryData(Object(SP\\Storage\\Database\\QueryData))\n#1 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\\Storage\\Database\\Database->doQuery(Object(SP\\Storage\\Database\\QueryData))\n#2 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\\Repositories\\Config\\ConfigRepository->create(Object(SP\\DataModel\\ConfigData))\n#3 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\\Services\\Config\\ConfigService->create(Object(SP\\DataModel\\ConfigData))\n#4 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\\Services\\Install\\Installer->saveMasterPassword()\n#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\\Services\\Install\\Installer->install()\n#6 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\\Services\\Install\\Installer->run(Object(SP\\Services\\Install\\InstallData))\n#7 [internal function]: SP\\Modules\\Web\\Controllers\\InstallController->installAction()\n#8 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array,Array)\n#9 [internal function]: SP\\Bootstrap->SP\\{closure}(Object(Klein\\Request),Object(Klein\\Response),Object(Klein\\ServiceProvider),Object(Klein\\App),Object(Klein\\Klein),Object(Klein\\DataCollection\\RouteCollection),Array)\n#10 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\\Request),Object(Klein\\Response),Object(Klein\\ServiceProvider),Object(Klein\\App),Object(Klein\\Klein),Object(Klein\\DataCollection\\RouteCollection),Array)\n#11 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\\Klein->handleRouteCallback(Object(Klein\\Route),Object(Klein\\DataCollection\\RouteCollection),Array)\n#12 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\\Klein->dispatch(Object(Klein\\Request))\n#13 /var/www/html/sysPass/lib/Base.php(75): SP\\Bootstrap->run(Object(DI\\Container))\n#14 /var/www/html/sysPass/index.php(28): require(String)] N/A, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | [Fri Jan 08 12:23:23.297541 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [EXCEPTION] [(P) Unable to connect to DB\n#0 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(216): SP\\Storage\\Database\\MySQLHandler->getConnection()\n#1 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\\Storage\\Database\\Database->prepareQueryData(Object(SP\\Storage\\Database\\QueryData))\n#2 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\\Storage\\Database\\Database->doQuery(Object(SP\\Storage\\Database\\QueryData))\n#3 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\\Repositories\\Config\\ConfigRepository->create(Object(SP\\DataModel\\ConfigData))\n#4 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\\Services\\Config\\ConfigService->create(Object(SP\\DataModel\\ConfigData))\n#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\\Services\\Install\\Installer->saveMasterPassword()\n#6 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\\Services\\Install\\Installer->install()\n#7 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\\Services\\Install\\Installer->run(Object(SP\\Services\\Install\\InstallData))\n#8 [internal function]: SP\\Modules\\Web\\Controllers\\InstallController->installAction()\n#9 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array, Array)\n#10 [internal function]: SP\\Bootstrap->SP\\{closure}(Object(Klein\\Request), Object(Klein\\Response), Object(Klein\\ServiceProvider), Object(Klein\\App), Object(Klein\\Klein), Object(Klein\\DataCollection\\RouteCollection), Array)\n#11 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure), Object(Klein\\Request), Object(Klein\\Response), Object(Klein\\ServiceProvider), Object(Klein\\App), Object(Klein\\Klein), Object(Klein\\DataCollection\\RouteCollection), Array)\n#12 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\\Klein->handleRouteCallback(Object(Klein\\Route), Object(Klein\\DataCollection\\RouteCollection), Array)\n#13 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\\Klein->dispatch(Object(Klein\\Request))\n#14 /var/www/html/sysPass/lib/Base.php(75): SP\\Bootstrap::run(Object(DI\\Container))\n#15 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')\n#16 {main}] N/A, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | [Fri Jan 08 12:23:24.059691 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [EXCEPTION] [Unable to connect to DB\n#0 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\\Services\\Install\\Installer->saveMasterPassword()\n#1 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\\Services\\Install\\Installer->install()\n#2 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\\Services\\Install\\Installer->run(Object(SP\\Services\\Install\\InstallData))\n#3 [internal function]: SP\\Modules\\Web\\Controllers\\InstallController->installAction()\n#4 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array,Array)\n#5 [internal function]: SP\\Bootstrap->SP\\{closure}(Object(Klein\\Request),Object(Klein\\Response),Object(Klein\\ServiceProvider),Object(Klein\\App),Object(Klein\\Klein),Object(Klein\\DataCollection\\RouteCollection),Array)\n#6 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\\Request),Object(Klein\\Response),Object(Klein\\ServiceProvider),Object(Klein\\App),Object(Klein\\Klein),Object(Klein\\DataCollection\\RouteCollection),Array)\n#7 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\\Klein->handleRouteCallback(Object(Klein\\Route),Object(Klein\\DataCollection\\RouteCollection),Array)\n#8 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\\Klein->dispatch(Object(Klein\\Request))\n#9 /var/www/html/sysPass/lib/Base.php(75): SP\\Bootstrap->run(Object(DI\\Container))\n#10 /var/www/html/sysPass/index.php(28): require(String)] N/A, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | [Fri Jan 08 12:23:24.059800 2021] [php7:notice] [pid 599] [client 10.65.207.3:64630] [EXCEPTION] [(P) Unable to connect to DB\n#0 /var/www/html/sysPass/lib/SP/Storage/Database/Database.php(175): SP\\Storage\\Database\\Database->prepareQueryData(Object(SP\\Storage\\Database\\QueryData))\n#1 /var/www/html/sysPass/lib/SP/Repositories/Config/ConfigRepository.php(70): SP\\Storage\\Database\\Database->doQuery(Object(SP\\Storage\\Database\\QueryData))\n#2 /var/www/html/sysPass/lib/SP/Services/Config/ConfigService.php(93): SP\\Repositories\\Config\\ConfigRepository->create(Object(SP\\DataModel\\ConfigData))\n#3 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(314): SP\\Services\\Config\\ConfigService->create(Object(SP\\DataModel\\ConfigData))\n#4 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(190): SP\\Services\\Install\\Installer->saveMasterPassword()\n#5 /var/www/html/sysPass/lib/SP/Services/Install/Installer.php(99): SP\\Services\\Install\\Installer->install()\n#6 /var/www/html/sysPass/app/modules/web/Controllers/InstallController.php(94): SP\\Services\\Install\\Installer->run(Object(SP\\Services\\Install\\InstallData))\n#7 [internal function]: SP\\Modules\\Web\\Controllers\\InstallController->installAction()\n#8 /var/www/html/sysPass/lib/SP/Bootstrap.php(240): call_user_func_array(Array, Array)\n#9 [internal function]: SP\\Bootstrap->SP\\{closure}(Object(Klein\\Request), Object(Klein\\Response), Object(Klein\\ServiceProvider), Object(Klein\\App), Object(Klein\\Klein), Object(Klein\\DataCollection\\RouteCollection), Array)\n#10 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure), Object(Klein\\Request), Object(Klein\\Response), Object(Klein\\ServiceProvider), Object(Klein\\App), Object(Klein\\Klein), Object(Klein\\DataCollection\\RouteCollection), Array)\n#11 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\\Klein->handleRouteCallback(Object(Klein\\Route), Object(Klein\\DataCollection\\RouteCollection), Array)\n#12 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\\Klein->dispatch(Object(Klein\\Request))\n#13 /var/www/html/sysPass/lib/Base.php(75): SP\\Bootstrap::run(Object(DI\\Container))\n#14 /var/www/html/sysPass/index.php(28): require('/var/www/html/s...')\n#15 {main}] N/A, referer: https://10.85.73.19/index.php?r=install/index
syspass-app | 10.65.207.3 - - [08/Jan/2021:12:23:21 +0000] "POST /index.php?r=install/install HTTP/1.1" 200 989 "https://10.85.73.19/index.php?r=install/index" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"

I have configured the network parts and it didn't help to me.

tjani10 commented 3 years ago

Hi,

i think the problem is, that your initial grant in the mysql db for a specific docker container ip, differs from the docker ip it has now.

Therefore i fix the ip adress of the container ip. You understand?

Best Regards

hi,

if I configure the host mode in the syspass yml then it can't start. is it possible to use the same IP for the docker?

3XC1T3D commented 3 years ago

Hi,

what you mean with host in the yaml?

Look at this docker-compose yaml https://github.com/nuxsmin/docker-syspass/issues/35

I am using this yaml with fix docker container ip's in an docker network.

Greetz

tjani10 commented 3 years ago

Hi,

what you mean with host in the yaml?

Look at this docker-compose yaml #35

I am using this yaml with fix docker container ip's in an docker network.

Greetz

in the docker there is 172.23.0.2/16 subnet but the host using 10.85.73.232/24. When the installation running I see that the new sp_ users got the 172.23.0.2 as syspass IP. Here it should be use the 10.85.73.232 IP. as far as I know, I should use "network_mode: host" then the container uses the host IP.

3XC1T3D commented 3 years ago

Hi,

now i understand πŸ˜…

I think that's the automatism of syspass to create a user with the DB Grant on a Docker Network IP.

Why you want to use the Host bind? You can easily run syspass in a docker network and only expose the Port 443

Best regards

tjani10 commented 3 years ago

Hi,

now i understand πŸ˜…

I think that's the automatism of syspass to create a user with the DB Grant on a Docker Network IP.

Why you want to use the Host bind? You can easily run syspass in a docker network and only expose the Port 443

Best regards

after the syspass install create the sp users in the DB then these gets the container's IP. I would like to use the Host network mode to avoid the internal container IP registration in the DB. unfortunately, every installation the syspass generates another 2 new sp users. I expose the port 443 in the compose file but it looks like not enough. do you have any idea why?

@nuxsmin : how can I fix that the installation process configures the host IP in the DB for the sp_users instead of container IP?

tjani10 commented 3 years ago

anyway here is the conf:

version: '3'
services:
  app:
    container_name: syspass-app
    image: syspass/syspass:3.1.2
    restart: on-failure
    ports:
      - "80:80"
      - "443:443"
        #    links:
        #      - db
    volumes:
      - syspass-config:/var/www/html/sysPass/app/config
      - syspass-backup:/var/www/html/sysPass/app/backup
      - /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro
    environment:
      - USE_SSL=yes
        #  db:
        #    container_name: syspass-db
        #    restart: always
        #    image: mariadb:10.2
        #    environment:
        #      - MYSQL_ROOT_PASSWORD=syspass
        #    ports:
        #      - "3306"
        #    volumes:
        #      - syspass-db:/var/lib/mysql

volumes:
  syspass-config: {}
  syspass-backup: {}
  #  syspass-db: {}
3XC1T3D commented 3 years ago

Hi,

now i understand πŸ˜…

I think that's the automatism of syspass to create a user with the DB Grant on a Docker Network IP.

Why you want to use the Host bind? You can easily run syspass in a docker network and only expose the Port 443

Best regards

after the syspass install create the sp users in the DB then these gets the container's IP. I would like to use the Host network mode to avoid the internal container IP registration in the DB. unfortunately, every installation the syspass generates another 2 new sp users. I expose the port 443 in the compose file but it looks like not enough. do you have any idea why?

@nuxsmin : how can I fix that the installation process configures the host IP in the DB for the sp_users instead of container IP?

Working like a charm on my Setup. I have exposed the same Ports like you in the yaml.

If i am right, it's not supposed to start syspass in host network mode 😐

See Docs: https://syspass-doc.readthedocs.io/en/3.1/installing/docker.html

tjani10 commented 3 years ago

@nuxsmin : I got this error message when I try to connect to the DB: [2021-01-12 17:36:35] syspass.EXCEPTION: logger {"message":"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-app.syspass_default IDENTIFIED BY 'ex5eUF_o}zkGGKx;'' at line 1

tjani10 commented 3 years ago

Hi, now i understand πŸ˜… I think that's the automatism of syspass to create a user with the DB Grant on a Docker Network IP. Why you want to use the Host bind? You can easily run syspass in a docker network and only expose the Port 443 Best regards

after the syspass install create the sp users in the DB then these gets the container's IP. I would like to use the Host network mode to avoid the internal container IP registration in the DB. unfortunately, every installation the syspass generates another 2 new sp users. I expose the port 443 in the compose file but it looks like not enough. do you have any idea why? @nuxsmin : how can I fix that the installation process configures the host IP in the DB for the sp_users instead of container IP?

Working like a charm on my Setup. I have exposed the same Ports like you in the yaml.

If i am right, it's not supposed to start syspass in host network mode 😐

See Docs: https://syspass-doc.readthedocs.io/en/3.1/installing/docker.html

now the doc can't help to me. I would like to use external DB. The Db as I mentioned is reachable from this host and from the container if I install a db client for it. I tried to connect a AWS Aurora DB which one doesn't have fix IP so I am configuring a DNS name. I think it should work but from my side I can't see the issue exactly.

I tried to use the suggested maria-db as container and when I replaced the DB root password to another in the compose yml file then on the installation page the new password is not ok but with the original "syspass" password working. I think this password is in the code. @nuxsmin

nuxsmin commented 3 years ago

Hello @tjani10

sorry for the late reply...

It seems you need to check the hosting mode over (https://syspass-doc.readthedocs.io/en/3.1/installing/hostingmode.html), since you want to use your own database user.

Regards

tjani10 commented 3 years ago

@nuxsmin : Thanks, the hosting mode is working.