Use peer-authorized postgresql connections where applicable

Using password and tcp to connect to a postgres database on a local machine is in the best case a bit inefficient and in the worst case very insecure. This patch tries to use peer authentication where feasible.