Git Product home page Git Product logo

bhr-site's People

Contributors

amerck avatar breakfastdub avatar dependabot[bot] avatar gjmf avatar grigorescu avatar jdugan1024 avatar justinazoff avatar kayavila avatar samoehlert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bhr-site's Issues

Error when unblocking a previously whitelisted IP

I received this from a do_unblock in the browser, for an IP that had been previously whitelisted. Removing the whitelist entry allowed the do_unblock action from the browser to proceed.

Environment:

Request Method: POST
Request URL: https://[hostname]/bhr/do_unblock

Django Version: 1.7.4
Python Version: 2.7.10
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'rest_framework',
 'rest_framework.authtoken',
 'django_forms_bootstrap',
 'bhr')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback:
File "/opt/app/rtbh/venv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/app/rtbh/venv/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)
File "/opt/app/rtbh/venv/lib/python2.7/site-packages/django/views/generic/base.py" in view
  69.             return self.dispatch(request, *args, **kwargs)
File "/opt/app/rtbh/venv/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  87.         return handler(request, *args, **kwargs)
File "/opt/app/rtbh/venv/lib/python2.7/site-packages/django/views/generic/edit.py" in post
  173.             return self.form_valid(form)
File "/opt/app/rtbh/bhr/browser_views.py" in form_valid
  66.             b.unblock_now(self.request.user, why)
File "/opt/app/rtbh/bhr/models.py" in unblock_now
  184.         self.save()
File "/opt/app/rtbh/bhr/models.py" in save
  143.                 raise WhitelistError(wle.why)

Exception Type: WhitelistError at /bhr/do_unblock
Exception Value: [redacted]

Improve performance of forced_unblock index

I replaced the index on forced_unblock with

create index bhr_block_forced_unblocked_true on bhr_block ( forced_unblock) where forced_unblock=true;

Which should accomplish the same thing but save 10% of the size of the DB and speed things up a bit.

It looks like this can't be specified in models.py, but I can use

migrations.RunSQL('create index bhr_block_forced_unblocked_true on bhr_block ( forced_unblock) where forced_unblock=true')

In a migration to add the better performing index.

main nav links don't properly set active classes

Need to use something like this for each link

<li role="presentation" {% if request.resolver_match.url_name == 'home' %}class="active"{% endif %}>
    <a href="{% url 'home' %}">Home</a>
</li>

or write/find a helper that does that for me.

PendingBlockManager can be slow with many current blocks

I feel like I optimized this query a while ago to make it fast when there were many pending blocks, but now it seems that it is slow when there are a large number of current blocks.

The custom query that block_queue runs is still fast, so PendingBlockManager probably just needs to be made to ran a similar query.

Error with starting docker-compose

When I run:
docker-compose run --rm web python manage.py migrate

I get this error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 83, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__
    self.build_graph()
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 210, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 126, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Also when I clone repo and run docker-compose I get error from psql. I repair it with:

    db:
      image: postgres
      environment:
        POSTGRES_DB: bhr
        POSTGRES_HOST_AUTH_METHOD: trust

Make list views filterable

Right now there is the query view that is for historical data, but there needs to be a way to hit the current list view and filter by cidr/source/etc.

I added the /bhrlist/source view but I think that should be removed and /list itself should accept source,cidr,who,reason,etc filter params.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.