sncatupdate

How to restrict access ?

It's easy. For example, restrict access to sncatupdate.cgi

  • Apache's Basic Authentication
/usr/local/apache/bin/htpasswd -c /usr/local/apache/conf/passwd sncat
  • Limit access to sncatupdate.cgi - add to httpd.conf
<LocationMatch "sncatupdate.cgi">
AuthType Basic
AuthName "Update SN catalogue"
AuthUserFile /usr/local/apache/conf/passwd
Require user sncat
</LocationMatch>
  • Restart apache
  • Create role 'sncat' for PostgreSQL (specify password NULL)
createuser -SDRI -e -P sncat
  • Grant rw access for use sncat
grant all on sn.galaxies to sncat;
grant all on sn.sn to sncat;
grant all on sn.map to sncat;

In sncatupdate.cgi use $ENV{REMOTE_USER} и $ENV{REMOTE_ADDR} to setup connection to PostgreSQL.

my $dbh = DBI->connect($DSN,$ENV{REMOTE_USER}, 'NULL');