0x0FB0 / pulsar

Network footprint scanner platform. Discover domains and run your custom checks periodically.
https://0x0fb0.github.io/pulsar/
Apache License 2.0
404 stars 84 forks source link

django.db.utils.IntegrityError #55

Closed asilhansahin closed 3 years ago

asilhansahin commented 3 years ago

Hello , i have a problem with " Adding Django admin user..." this place. When i was trying to start docker-compose, i get this error ;

root@osint:# docker-compose up --force-recreate
Creating network "pulsar_default" with the default driver
Creating sandbox ... done
Creating db      ... done
Creating queue   ... done
Creating web     ... done
Attaching to sandbox, db, queue, web
queue      | WARNING: no logs are available with the 'none' log driver
sandbox    | Starting OpenBSD Secure Shell server: sshd.
db         | 2021-03-30 12:45:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.18-1debian9 started.
db         | 2021-03-30 12:45:17+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db         | 2021-03-30 12:45:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.18-1debian9 started.
db         | 2021-03-30T12:45:17.778139Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 1
web        |
web        | [+] Waiting for MySQL server...
web        |
db         | 2021-03-30T12:45:21.254431Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
web        |
web        | [+] Waiting for RabbitMQ server...
web        |
db         | 2021-03-30T12:45:21.482448Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
db         | 2021-03-30T12:45:21.686722Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
web        |
web        | [+] Generating certificates...
web        |
web        | Generating a RSA private key
web        | ......................++++
web        | ....................................................................++++
web        | writing new private key to '/etc/ssl/server.key'
web        | -----
web        | Generating a RSA private key
web        | .............................................................................................................................................++++
web        | .......................................++++
web        | writing new private key to '/etc/ssl/pulsar.key'
web        | -----
web        |
web        | [+] Setting up SSH tunnel...
web        |
web        |
web        | [+] Applying database migrations...
web        |
web        | Migrations for 'pulsar':
web        |   pulsar/migrations/0001_initial.py
web        |     - Create model PortalUser
web        |     - Create model AssetInstance
web        |     - Create model CollaborationGroup
web        |     - Create model CVEEntry
web        |     - Create model DomainInstance
web        |     - Create model HandMadePlugin
web        |     - Create model IPv4AddrInstance
web        |     - Create model ScanPolicy
web        |     - Create model ScanTask
web        |     - Create model ServiceInstance
web        |     - Create model CVE
web        |     - Create model VulnInstance
web        |     - Create model TLDInstance
web        |     - Create model ScanInstance
web        |     - Add field last_task to ipv4addrinstance
web        |     - Add field last_task to domaininstance
web        | Operations to perform:
web        |   Apply all migrations: admin, auth, authtoken, contenttypes, django_celery_beat, django_celery_results, pulsar, sessions, social_django
web        | Running migrations:
web        |   No migrations to apply.
web        |
web        | [+] Adding Django admin user...
web        |
web        | Traceback (most recent call last):
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
web        |     return self.cursor.execute(sql, params)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
web        |     return self.cursor.execute(query, args)
web        |   File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 209, in execute
web        |     res = self._query(query)
web        |   File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 315, in _query
web        |     db.query(q)
web        |   File "/usr/local/lib/python3.8/site-packages/MySQLdb/connections.py", line 231, in query
web        |     _mysql.connection.query(self, query)
web        | MySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry 'admin' for key 'username'")
web        |
web        | The above exception was the direct cause of the following exception:
web        |
web        | Traceback (most recent call last):
web        |   File "manage.py", line 22, in <module>
web        |     main()
web        |   File "manage.py", line 18, in main
web        |     execute_from_command_line(sys.argv)
web        |   File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
web        |     utility.execute()
web        |   File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
web        |     self.fetch_command(subcommand).run_from_argv(self.argv)
web        |   File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
web        |     self.execute(*args, **cmd_options)
web        |   File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
web        |     output = self.handle(*args, **options)
web        |   File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/shell.py", line 93, in handle
web        |     exec(sys.stdin.read())
web        |   File "<string>", line 1, in <module>
web        |   File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/models.py", line 157, in create_superuser
web        |     return self._create_user(username, email, password, **extra_fields)
web        |   File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/models.py", line 140, in _create_user
web        |     user.save(using=self._db)
web        |   File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 67, in save
web        |     super().save(*args, **kwargs)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 753, in save
web        |     self.save_base(using=using, force_insert=force_insert,
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 790, in save_base
web        |     updated = self._save_table(
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 895, in _save_table
web        |     results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 933, in _do_insert
web        |     return manager._insert(
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
web        |     return getattr(self.get_queryset(), name)(*args, **kwargs)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1254, in _insert
web        |     return query.get_compiler(using=using).execute_sql(returning_fields)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql
web        |     cursor.execute(sql, params)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
web        |     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
web        |     return executor(sql, params, many, context)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
web        |     return self.cursor.execute(sql, params)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
web        |     raise dj_exc_value.with_traceback(traceback) from exc_value
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
web        |     return self.cursor.execute(sql, params)
web        |   File "/usr/local/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
web        |     return self.cursor.execute(query, args)
web        |   File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 209, in execute
web        |     res = self._query(query)
web        |   File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 315, in _query
web        |     db.query(q)
web        |   File "/usr/local/lib/python3.8/site-packages/MySQLdb/connections.py", line 231, in query
web        |     _mysql.connection.query(self, query)
web        | django.db.utils.IntegrityError: (1062, "Duplicate entry 'admin' for key 'username'")
web        |
web        | [+] Starting Celery workers...
web        |
web        |
web        | [+] Verifying database migrations...
web        |
web        | No changes detected
web        | Operations to perform:
web        |   Apply all migrations: admin, auth, authtoken, contenttypes, django_celery_beat, django_celery_results, pulsar, sessions, social_django
web        | Running migrations:
web        |   No migrations to apply.
web        |
web        | [+] Collecting static files...
web        |
web        |
web        | 165 static files copied to '/portal/staticfiles', 43 unmodified.
web        |
web        | [+] Starting Nginx web server...
web        |
web        | Starting nginx: nginx.
web        |
web        | [+] Starting pulsar on https://localhost:8443/
web        |
web        |     It can take a while to boot.
web        |
web        | [2021-03-30 12:46:33 +0000] [211] [INFO] Starting gunicorn 20.0.4
web        | [2021-03-30 12:46:33 +0000] [211] [INFO] Listening at: unix:/tmp/run/gunicorn.sock (211)
web        | [2021-03-30 12:46:33 +0000] [211] [INFO] Using worker: sync
web        | [2021-03-30 12:46:33 +0000] [213] [INFO] Booting worker with pid: 213
db         | mbind: Operation not permitted
db         | mbind: Operation not permitted

The operation not permitted log comes up when I start the scan

0x0FB0 commented 3 years ago

Hi @asilhansahin, you must have interrupted the installation or ran the installation script twice. The easiest solution is to just make a fresh clone and run installation script again. You can also refer to other bugs as this is a frequently rised topic.