Skip to content

Commit

Permalink
Block certain IPs from submitting jobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Sep 21, 2015
1 parent a26ca73 commit 75c4533
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/modules/frontend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ the web frontend.
is one of 'index', 'submit', 'queue', 'results', 'help', 'download'.
It should simply return if access is allowed, or throw an
:exc:`~saliweb::frontend.AccessDeniedError` exception if access is not
permitted. By default, it simply returns, allowing all access.
permitted. By default, it simply returns, allowing all access, for all
pages except the submit page, from which certain IPs are blocked.

.. method:: download_results_file(job, file)

Expand Down
5 changes: 5 additions & 0 deletions perl/saliweb/frontend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,11 @@ sub get_pdb_chains {

sub check_page_access {
my ($self, $page_name) = @_;
if ($page_name eq "submit"
&& $self->cgi->remote_addr() eq '64.54.136.144') {
throw saliweb::frontend::AccessDeniedError(
"Submission of jobs by this IP address is not allowed");
}
}

sub format_user_error {
Expand Down

0 comments on commit 75c4533

Please sign in to comment.