PostDock icon indicating copy to clipboard operation
PostDock copied to clipboard

recovery can't work as described because of ssh keys issue

Open agaldemas opened this issue 7 years ago • 3 comments

Hello,

I discover while trying recovery process (step 4), described in doc/RECOVERY.md, that the ssh connection from barman container can't work as written, because the ssh keys are not properly deployed for the root user, so the command "ssh pgmaster" ask for a password. to fix this issue, I modified /src/ssh/entrypoint.sh to add 2 lines:

cp -r  /home/postgres/.ssh /root/.
chmod 755 /root/.ssh/*

after the line: cat /home/postgres/.ssh/id_rsa.pub >> /home/postgres/.ssh/authorized_keys and to be able to connect to pgmaster I use in remote-ssh-command ssh -i /home/postgres/.ssh/id_rsa pgmaster to be able to use the barman recover command.

the step 5 doesn't work: psql -U monkey_user monkey_db -c "SELECT * from t" => you should tell to test on an existing table, or specify it's a table created during barman-simple-backup test ! psql -U postgres -c "SELECT pg_xlog_replay_resume()" => this is not ok when using postgres 10, the function have changed name: psql -U postgres -c "SELECT pg_wal_replay_resume()

Hope this will help

agaldemas avatar Oct 08 '18 15:10 agaldemas

As far as I remember the keys are for postgres user which is used by barman

https://github.com/paunin/PostDock/blob/982fbd1af1e80be2107a8d46c3f5a530cc392dc9/src/ssh/entrypoint.sh#L5 https://github.com/paunin/PostDock/blob/982fbd1af1e80be2107a8d46c3f5a530cc392dc9/src/barman/configs/barman.conf#L2

Did you change the user for barman?

S3RK avatar Oct 15 '18 07:10 S3RK

No, but when you connect to container you are "root", so the barman command given in RECOVERY.md doesn't work because of the ssh command "ssh pgmaster" ! I've tried "su - postgres" but still no way to connect with "ssh pgmaster" asking for password, the only solution if found was to copy keys stuff for root user and adjust the permissions.

agaldemas avatar Oct 15 '18 08:10 agaldemas

Ssh issue was resolved by fixing HOME directory See the test

paunin avatar Apr 27 '19 05:04 paunin