Thread: Moving pgadmin4.db to a new server

Moving pgadmin4.db to a new server

From
Jan Birk
Date:
Hi,

We are running pgadmin4 v 3.4 and are migration to a new server and a new version 4.12..

We have copied the old pgadmin4.db to the new server in order to keep the users settings and passwords. Settings is working but not the passwords. We get an

"Failed to decrypt the saved password. Error: 'utf-8' codec can't decode byte 0x92 in position 0: invalid start byte"

Maybe this is related to some salt in the passwords but I am not sure.

How should we correctly migrate from one server to another ?

Best and thanks for a very good application. It's just getting better and better.

/Jan

-- 
Undervisningsministeriet
(Danish Ministry of Education)

  
Styrelsen for It og Læring
Kontor for It-drift

Vester Voldgade 123
1552 København V
Tlf: +45 41741615

Re: Moving pgadmin4.db to a new server

From
Murtuza Zabuawala
Date:
Hi, 

Yes it is throwing error due to password salt, It would be better if you follow  steps from https://www.pgadmin.org/docs/pgadmin4/4.14/import_export_servers.html for migration.


Please note that as of now there is no way of exporting pgAdmin4 settings.


-- Murtuza

On Fri, 18 Oct 2019, 21:55 Jan Birk, <jan.g.birk@gmail.com> wrote:
Hi,

We are running pgadmin4 v 3.4 and are migration to a new server and a new version 4.12..

We have copied the old pgadmin4.db to the new server in order to keep the users settings and passwords. Settings is working but not the passwords. We get an

"Failed to decrypt the saved password. Error: 'utf-8' codec can't decode byte 0x92 in position 0: invalid start byte"

Maybe this is related to some salt in the passwords but I am not sure.

How should we correctly migrate from one server to another ?

Best and thanks for a very good application. It's just getting better and better.

/Jan

-- 
Undervisningsministeriet
(Danish Ministry of Education)

  
Styrelsen for It og Læring
Kontor for It-drift

Vester Voldgade 123
1552 København V
Tlf: +45 41741615

Re: Moving pgadmin4.db to a new server

From
Jan Birk
Date:
Hi Murtuza,

Thanks. The server definitions seems to be ok only by moving the db files.
However we can't really be sure.

Is there - in the docs - a schema description for each version ? 

We have +100 users and we will not be popular if we can't migrate to another
server but will have have to ask the users to start over with settings and
passwords.

We might be able to write a tool to do this if we can find the docs. Other users
might find this useful to when they have to change servers.

Best and thanks again for the product.

/Jan

 


søn, 20 10 2019 kl. 10:43 +0530, skrev Murtuza Zabuawala:
> Hi, 
> 
> Yes it is throwing error due to password salt, It would be better if you
> follow  steps from 
> https://www.pgadmin.org/docs/pgadmin4/4.14/import_export_servers.html for
> migration.
> 
> 
> Please note that as of now there is no way of exporting pgAdmin4 settings.
> 
> 
> -- Murtuza
> 
> On Fri, 18 Oct 2019, 21:55 Jan Birk, <jan.g.birk@gmail.com> wrote:
> > Hi,
> > 
> > We are running pgadmin4 v 3.4 and are migration to a new server and a new
> > version 4.12..
> > 
> > We have copied the old pgadmin4.db to the new server in order to keep the
> > users settings and passwords. Settings is working but not the passwords. We
> > get an
> > 
> > "Failed to decrypt the saved password. Error: 'utf-8' codec can't decode
> > byte 0x92 in position 0: invalid start byte"
> > 
> > Maybe this is related to some salt in the passwords but I am not sure.
> > 
> > How should we correctly migrate from one server to another ?
> > 
> > Best and thanks for a very good application. It's just getting better and
> > better.
> > 
> > /Jan
> > 
> > -- 
> > Undervisningsministeriet
> > (Danish Ministry of Education)
> > 
> >   
> > Styrelsen for It og Læring
> > Kontor for It-drift
> > 
> > Vester Voldgade 123
> > 1552 København V
> > Tlf: +45 41741615
> > Mail: Jan.Birk@stil.dk




Re: Moving pgadmin4.db to a new server

From
Avin Kavish
Date:
https://sqlitebrowser.org/ should allow you to open the db files and inspect the schema

On Sun, Oct 20, 2019 at 11:28 AM Jan Birk <jan.g.birk@gmail.com> wrote:
Hi Murtuza,

Thanks. The server definitions seems to be ok only by moving the db files.
However we can't really be sure.

Is there - in the docs - a schema description for each version ?

We have +100 users and we will not be popular if we can't migrate to another
server but will have have to ask the users to start over with settings and
passwords.

We might be able to write a tool to do this if we can find the docs. Other users
might find this useful to when they have to change servers.

Best and thanks again for the product.

/Jan




søn, 20 10 2019 kl. 10:43 +0530, skrev Murtuza Zabuawala:
> Hi,
>
> Yes it is throwing error due to password salt, It would be better if you
> follow  steps from
> https://www.pgadmin.org/docs/pgadmin4/4.14/import_export_servers.html for
> migration.
>
>
> Please note that as of now there is no way of exporting pgAdmin4 settings.
>
>
> -- Murtuza
>
> On Fri, 18 Oct 2019, 21:55 Jan Birk, <jan.g.birk@gmail.com> wrote:
> > Hi,
> >
> > We are running pgadmin4 v 3.4 and are migration to a new server and a new
> > version 4.12..
> >
> > We have copied the old pgadmin4.db to the new server in order to keep the
> > users settings and passwords. Settings is working but not the passwords. We
> > get an
> >
> > "Failed to decrypt the saved password. Error: 'utf-8' codec can't decode
> > byte 0x92 in position 0: invalid start byte"
> >
> > Maybe this is related to some salt in the passwords but I am not sure.
> >
> > How should we correctly migrate from one server to another ?
> >
> > Best and thanks for a very good application. It's just getting better and
> > better.
> >
> > /Jan
> >
> > --
> > Undervisningsministeriet
> > (Danish Ministry of Education)
> >
> >   
> > Styrelsen for It og Læring
> > Kontor for It-drift
> >
> > Vester Voldgade 123
> > 1552 København V
> > Tlf: +45 41741615
> > Mail: Jan.Birk@stil.dk



Re: Moving pgadmin4.db to a new server

From
Aditya Toshniwal
Date:
Hi Jan,

How did you copy the .db file ?
Did you copy first and then started pgAdmin or started first and then copied.
When pgAdmin4 starts, it checks the schema version of .db file and applies the migrations till the current version.

On Sun, Oct 20, 2019, 11:40 Avin Kavish <avinkavish@gmail.com> wrote:
https://sqlitebrowser.org/ should allow you to open the db files and inspect the schema

On Sun, Oct 20, 2019 at 11:28 AM Jan Birk <jan.g.birk@gmail.com> wrote:
Hi Murtuza,

Thanks. The server definitions seems to be ok only by moving the db files.
However we can't really be sure.

Is there - in the docs - a schema description for each version ?

We have +100 users and we will not be popular if we can't migrate to another
server but will have have to ask the users to start over with settings and
passwords.

We might be able to write a tool to do this if we can find the docs. Other users
might find this useful to when they have to change servers.

Best and thanks again for the product.

/Jan




søn, 20 10 2019 kl. 10:43 +0530, skrev Murtuza Zabuawala:
> Hi,
>
> Yes it is throwing error due to password salt, It would be better if you
> follow  steps from
> https://www.pgadmin.org/docs/pgadmin4/4.14/import_export_servers.html for
> migration.
>
>
> Please note that as of now there is no way of exporting pgAdmin4 settings.
>
>
> -- Murtuza
>
> On Fri, 18 Oct 2019, 21:55 Jan Birk, <jan.g.birk@gmail.com> wrote:
> > Hi,
> >
> > We are running pgadmin4 v 3.4 and are migration to a new server and a new
> > version 4.12..
> >
> > We have copied the old pgadmin4.db to the new server in order to keep the
> > users settings and passwords. Settings is working but not the passwords. We
> > get an
> >
> > "Failed to decrypt the saved password. Error: 'utf-8' codec can't decode
> > byte 0x92 in position 0: invalid start byte"
> >
> > Maybe this is related to some salt in the passwords but I am not sure.
> >
> > How should we correctly migrate from one server to another ?
> >
> > Best and thanks for a very good application. It's just getting better and
> > better.
> >
> > /Jan
> >
> > --
> > Undervisningsministeriet
> > (Danish Ministry of Education)
> >
> >   
> > Styrelsen for It og Læring
> > Kontor for It-drift
> >
> > Vester Voldgade 123
> > 1552 København V
> > Tlf: +45 41741615
> > Mail: Jan.Birk@stil.dk



Re: Moving pgadmin4.db to a new server

From
Jan Birk
Date:
Hi and thanks for your efforts and time

søn, 20 10 2019 kl. 11:45 +0530, skrev Aditya Toshniwal:
> How did you copy the .db file ?
> Did you copy first and then started pgAdmin or started first and then copied.
> When pgAdmin4 starts, it checks the schema version of .db file and applies the
> migrations till the current version.


We did copy and then started. That's explain why the schema *seems* to be ok :-)

We haven't moved the production site yet. But every thing in out test looks ok
expect the passwords.

Not knowing python (just grep) it seems that the SALT is auto generated in
config-database?? 

../migrations/versions/xxxxxx_.py
..

114     current_salt = getattr(
115         config, 'SECURITY_PASSWORD_SALT',
base64.urlsafe_b64encode(
116             os.urandom(32)
117         ).decode()
118
     )
..

Could it be a workaround to re-initialize (re-install) pgadmin having
current_salt equals the old one ???

Best

Jan 




Re: Moving pgadmin4.db to a new server

From
Aditya Toshniwal
Date:
Hi Jan,

Try this,
1) Remove all the existing session data. For that, shut down the server, go to sessions directory just beside the db file and remove all the files in it.
2) Go to browser and clean all the cache.
3) Start pgAdmin4 and open a new window.
Let us know if this works.

On Sun, Oct 20, 2019 at 12:51 PM Jan Birk <jan.g.birk@gmail.com> wrote:
Hi and thanks for your efforts and time

søn, 20 10 2019 kl. 11:45 +0530, skrev Aditya Toshniwal:
> How did you copy the .db file ?
> Did you copy first and then started pgAdmin or started first and then copied.
> When pgAdmin4 starts, it checks the schema version of .db file and applies the
> migrations till the current version.


We did copy and then started. That's explain why the schema *seems* to be ok :-)

We haven't moved the production site yet. But every thing in out test looks ok
expect the passwords.

Not knowing python (just grep) it seems that the SALT is auto generated in
config-database??

../migrations/versions/xxxxxx_.py
..

114     current_salt = getattr(
115         config, 'SECURITY_PASSWORD_SALT',
base64.urlsafe_b64encode(
116             os.urandom(32)
117         ).decode()
118
     )
..

Could it be a workaround to re-initialize (re-install) pgadmin having
current_salt equals the old one ???

Best

Jan



--
Thanks and Regards,
Aditya Toshniwal
Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"

Re: Moving pgadmin4.db to a new server

From
Jan Birk
Date:
Hi Aditya

Maybe I am not clear on the objective:

We have to migrate the PGadmin away from server1 running OEL 7 to a new server2 running Ubuntu 18.04

In that process we must keep the users (+100) settings and password. We are - however - able to keep the settings by just moving the db file from server1 to server2.

But the passwords are salted different on the new server2 and therefor all the users will have to re-enter ther passwords. Most of them has proberly forgot the passwords.

So how do I migrate from one server to another keeping settings (that part works) and passwords (this is not working).

I think that more and more will need that functionality (changing the host running pgadmin) as times goes by. 

Sadly I do not know python but it seems that pgadmin maybe could be re-initialized using the old SALT by setting SECURITY_PASSWORD_SALT or something .. ? :-)


Best and thanks again for a very good product.

/Jan




tir, 22 10 2019 kl. 10:59 +0530, skrev Aditya Toshniwal:
Hi Jan,

Try this,
1) Remove all the existing session data. For that, shut down the server, go to sessions directory just beside the db file and remove all the files in it.
2) Go to browser and clean all the cache.
3) Start pgAdmin4 and open a new window.
Let us know if this works.

On Sun, Oct 20, 2019 at 12:51 PM Jan Birk <jan.g.birk@gmail.com> wrote:
Hi and thanks for your efforts and time

søn, 20 10 2019 kl. 11:45 +0530, skrev Aditya Toshniwal:
> How did you copy the .db file ?
> Did you copy first and then started pgAdmin or started first and then copied.
> When pgAdmin4 starts, it checks the schema version of .db file and applies the
> migrations till the current version.


We did copy and then started. That's explain why the schema *seems* to be ok :-)

We haven't moved the production site yet. But every thing in out test looks ok
expect the passwords.

Not knowing python (just grep) it seems that the SALT is auto generated in
config-database??

../migrations/versions/xxxxxx_.py
..

114     current_salt = getattr(
115         config, 'SECURITY_PASSWORD_SALT',
base64.urlsafe_b64encode(
116             os.urandom(32)
117         ).decode()
118
     )
..

Could it be a workaround to re-initialize (re-install) pgadmin having
current_salt equals the old one ???

Best

Jan