Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Email domain check for admin user causes problem with automated installs

Open Sing-Li opened this issue 10 years ago • 14 comments

Currently, an email address is validated by the system during registration (by validating the domain portion).

If DNS is not available, is alternative implementation, or firewalled - the call fails and we consider the domain invalid. Admin user cannot be created.

This is also complicated by a regex bug #2841 that exists within the current release 0.26.0

It is possible to turn off this option. But it currently defaults to ON - which makes it impossible to create an admin under some situations.

Recommended to make validation default to OFF.

This affects both manual registrations and automated install (admin email set via ENV VARs).

Sing-Li avatar Apr 14 '16 21:04 Sing-Li

Set admin email set via ENV VARs is not affected anymore.

engelgabriel avatar Apr 14 '16 23:04 engelgabriel

You can set this Accounts_UseDNSDomainCheck config to false via ENV VARs on your initial setup if you are sure your server is blocked from outside world.

engelgabriel avatar Apr 14 '16 23:04 engelgabriel

It is possible to define the Env-VAR in the docker-compose file or it is only for manual installations without docker?

TheReal1604 avatar Apr 15 '16 08:04 TheReal1604

AFAIK you can set ANY config of Rocket.Chat with ENV VAR. Juts use the same name as their _id on the settings collection. Also, it will only work on the initial setup, they will be ignored if they already have a value in the settings collection.

engelgabriel avatar Apr 15 '16 12:04 engelgabriel

@engelgabriel how to do it correct on first setup? Tried it like this:

mongo:
  image: mongo
# volumes:
#    - ./data/runtime/db:/data/db
#    - ./data/dump:/dump
  command: mongod --smallfiles --oplogSize 128

rocketchat:
  image: rocketchat/rocket.chat:latest
# volumes:
#    - ./uploads:/app/uploads
  environment:
    - PORT=3000
    - ROOT_URL=http://yourhost:3000
    - MONGO_URL=mongodb://mongo:27017/rocketchat
    - Accounts_UseDNSDomainCheck=false
  links:
    - mongo:mongo
  ports:
    - 3000:3000

After recreating the docker containers it seems that this is not working. Or did i need a new mongodb container, too?

TheReal1604 avatar Apr 15 '16 12:04 TheReal1604

That should work, but only on a fresh install.

engelgabriel avatar Apr 15 '16 12:04 engelgabriel

Fresh install means delete all docker container with

 docker stop rocketchat_rocketchat_1
 docker stop rocketchat_mongo_1
 docker rm rocketchat_rocketchat_1
 docker rm rocketchat_mongo_1

.. and recreate with docker-compose up -d ?

TheReal1604 avatar Apr 15 '16 12:04 TheReal1604

I guess, since you are not using volumes, yes.

engelgabriel avatar Apr 15 '16 12:04 engelgabriel

You can change it directly on the DB using the following:

db.rocketchat_settings.update({'_id':'Accounts_UseDNSDomainCheck'}, {$set: { 'value':false }})

engelgabriel avatar Apr 27 '16 04:04 engelgabriel

Hi @engelgabriel . i'm quite new in this development. where could i find the code that you have mentioned above? db.rocketchat_settings.update({'_id':'Accounts_UseDNSDomainCheck'}, {$set: { 'value':false }}) thanks in advance.

salmonblade avatar Jun 21 '16 17:06 salmonblade

ohh nevermind. found it, its actually for mongo. silly me. thanks for the help!

salmonblade avatar Jun 21 '16 19:06 salmonblade

Sorry for the delay @salmonblade I am happy you found it :)

engelgabriel avatar Jun 21 '16 19:06 engelgabriel

Hello, changing the option directly in the database doesn't work for me. Also, it wasn't clear how exactly to run the command, so here are the steps (when running rockchat via docker):

  1. docker ps to list running docker containers
  2. $ docker exec -it rocketchat_mongo_1 /bin/bash (replace rocketchat_mongo_1 with the name of your mongo docker instance) to get a bash terminal within the container
  3. # ./usr/bin/mongo get into the mongo command line
  4. show dbs to list databases, db to show current database, use rocketchat to switch to rocketchat db (not sure if this is a required step)
  5. db.rocketchat_settings.update({'_id':'Accounts_UseDNSDomainCheck'}, {$set: { 'value':false }}) to update the setting as described above... the response I get is WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 0 })

So, hopefully I'm doing something incorrectly with executing the command, but whatever the case, I'm still getting "Invalid Domain" errors when trying to add users, making it impossible to add users. Does anyone have any suggestions?

sebastientaggart avatar Aug 22 '17 17:08 sebastientaggart

I have changed everything, I have disabled dns and domain check, disabled blacklist, took all measures without success to solve this problem !

Elfanar avatar Mar 04 '19 13:03 Elfanar