agroal / pgagroal

High-performance connection pool for PostgreSQL
https://agroal.github.io/pgagroal/
BSD 3-Clause "New" or "Revised" License
667 stars 59 forks source link

Allow `pgagroal-admin` to specify where to store the master key password file #419

Open fluca1978 opened 3 months ago

fluca1978 commented 3 months ago

When pgagroal-admin is invoked to generate a master key, i.e., with the master-key command, it generates the file into $HOME/.pgagroal/master,key, and such location is not configurable. Users could require to store the private pgagroal stuff into another location, for example `~/.config~.

There is therefore the need for pgagroal-admin to have a command line option for the master-key command to specifiy where to put (and hence, read from) the master key file.

jesperpedersen commented 3 months ago

The management TLS files are also loaded from there...

fluca1978 commented 3 months ago

@palak-chaturvedi is working on this

palak-chaturvedi commented 3 months ago

v001-Adding_File_Name.patch I worked on this and made the changes. I just wanted to know if there is a specific code formatter that I have to run?

palak-chaturvedi commented 3 months ago

@fluca1978 @jesperpedersen https://github.com/palak-chaturvedi/pgagroal/tree/addingFileName

This a branch in my github.

fluca1978 commented 3 months ago

@palak-chaturvedi you should create a pull request for this, please. In the meantime, I took a look at the patch, and while the work is nice, this cannot be imported. The "master.key" file name is used in different places around the code, for example in security.c. Therefore, I would rather not change the filename as you did, but change the directory where to store the file named 'master.key'. At glance, the way to go could be to modify pgagroal_get_home to be able to detect if a different location rather than ~/.pgagroal has to be used.

palak-chaturvedi commented 3 months ago

Ok I will Can I store the required location in a variable or we need an argument for it? @fluca1978

fluca1978 commented 3 months ago

Ok I will Can I store the required location in a variable or we need an argument for it? @fluca1978

You are free to propose the solution you think is the best, and can also improve it later after a review. One optimal approach, but longer, could be to introduce a configuration tunable for the location to where store the files.

But let's go with calm and see your idea first.

palak-chaturvedi commented 3 months ago

created a pull request. @fluca1978 https://github.com/agroal/pgagroal/pull/430