Re: fcntl(SETLK) [was Re: 2nd update on TOAST]

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: fcntl(SETLK) [was Re: 2nd update on TOAST]
Дата
Msg-id Pine.LNX.4.21.0007071848050.587-100000@localhost.localdomain
обсуждение исходный текст
Ответ на fcntl(SETLK) [was Re: 2nd update on TOAST]  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: fcntl(SETLK) [was Re: 2nd update on TOAST]  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane writes:

> However, I think it would be a really bad idea to keep the lock files
> in /tmp --- that's way too open to accidental removals, not to mention
> deliberate denial-of-service attacks.  They need to be in a more secure
> directory; but where?  See the past discussions summarized in the
> TODO.detail file.

Quoth the file system standard:

`sharedstatedir'    The directory for installing architecture-independent data files    which the programs modify while
theyrun.  This should normally be    `/usr/local/com', but write it as `$(prefix)/com'.  (If you are    using Autoconf,
writeit as `@sharedstatedir@'.)
 

The problem with this approach is making that directory writeable by the
server account. Solutions:

1) Making the postmaster executable as root but later drop root  privileges. (This looks to be the cleanest solution,
butit is  probably a security problem waiting to happen.)
 

2) Making initdb executable as root but with some --user switch. Have it  create a subdirectory of $sharedstatedir
writableby the server  account, possibly with sticky bit and whatnot. Use `su' to invoke  `postgres'.
 
  This approach might be convenient also in terms of creating the data  directory.

3) Making "initialize lock file area" a separate initialization step,  possibly encapsulated into a shell script.


Btw., what would happen if we did start a second postmaster at the same
TCP port? Or more interestingly, what happens if some completely different
program already runs at that port? How do we protect against that? This
has something to do with SO_REUSEADDR, but I don't understand those things
too well.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Type formatting and oidvectortypes
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Lessons learned on how to build 7.0.2 on AIX 4.x