Skip to content

Commit

Permalink
related to idaholab#38, whitelist test connection
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Mar 1, 2021
1 parent f89bc04 commit 28ff966
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ http {
# we'll also pluck the low-hanging fruit of restricting to
# beats (Go-http-client, see https://github.com/elastic/beats/issues/21975)
# and moloch-capture user agents.
if ($http_user_agent !~* ^(arkime|beats|elastic|go-http-client|htpdate|logstash)) {
if ($http_user_agent !~* ^(arkime|beats|elastic|go-http-client|hedgehog|htpdate|logstash)) {
return 403;
}

Expand Down
6 changes: 3 additions & 3 deletions shared/bin/sensorcommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def text_from_html(body):

###################################################################################################
# test a connection to an HTTP/HTTPS server
def test_connection(protocol="http", host="127.0.0.1", port=80, uri="", username=None, password=None, ssl_verify="full"):
def test_connection(protocol="http", host="127.0.0.1", port=80, uri="", username=None, password=None, ssl_verify="full", user_agent="hedgehog"):
status = 400
message = "Connection error"
output = []
Expand All @@ -149,9 +149,9 @@ def test_connection(protocol="http", host="127.0.0.1", port=80, uri="", username
if c:
try:
if username and password:
c.request('GET', f'/{uri}', headers={ 'Authorization' : 'Basic %s' % b64encode(f"{username}:{password}".encode()).decode("ascii") })
c.request('GET', f'/{uri}', headers={ 'User-agent': user_agent, 'Authorization' : 'Basic %s' % b64encode(f"{username}:{password}".encode()).decode("ascii") })
else:
c.request('GET', f'/{uri}')
c.request('GET', f'/{uri}', headers={ 'User-agent': user_agent })
res = c.getresponse()
status = res.status
message = res.reason
Expand Down

0 comments on commit 28ff966

Please sign in to comment.