TykTechnologies / tyk

Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Other
9.64k stars 1.08k forks source link

Can't login to dashboard #26

Closed thibaultcha closed 9 years ago

thibaultcha commented 9 years ago

Hi,

I just installed Tyk 1.2.1 + Dashboard 0.8 (completely fresh install) and I can't login to the dashboard.

The login screen asks for a username yet I only set a first, last name and email address. Trying to login with first name prompted:

ERRO[3230] Failure in user lookup
ERRO[3230] not found

So I assumed I needed to use my email, which doesn't prompt the error. However, I did set a password for my account (and I can see the hash in Mongo) but when I try to login the logs show:

ERRO[3291] Could not EXPIRE key
ERRO[3291] ERR Client sent AUTH, but no password is set
ERRO[3291] Error trying to set value:
ERRO[3291] ERR Client sent AUTH, but no password is set
[221 ms] 301 '/login'
ERRO[3291] Error trying to get value:
ERRO[3291] ERR Client sent AUTH, but no password is set
ERRO[3291] Key not found
[4 ms] 200 '/'
[10 ms] 304 '/styles/4aaae68d.bootstrap.min.css'
[1472 μs] 304 '/images/5c8902f4.tyk.png'
[696 μs] 304 '/styles/1f2549a3.sb-admin.css'

This is my dashboard configuration:

{
    "listen_port": 9001,
    "tyk_api_config": {
        "Host": "http://localhost",
        "Port": "9000",
        "Secret": "352d20ee67be67f6340b4c0605b044b7"
    },
    "mongo_url": "mongodb://localhost/tyk_analytics",
    "page_size": 10,
    "admin_secret": "12345",
    "redis_port": 6379,
    "redis_host": "localhost",
    "redis_password": "test",
    "force_api_defaults": true,
    "notify_on_change": true,
    "license_owner": "Your Name"
}

This is my Tyk configuration:

{  
  "listen_port":9000,
  "secret":"352d20ee67be67f6340b4c0605b044b7",
  "template_path":"/etc/tyk/templates",
  "use_db_app_configs":true,
  "app_path":"/etc/tyk/apps/",
  "storage":{  
    "type":"redis",
    "host":"localhost",
    "port":6379,
    "username":"",
    "password":"",
    "database":0
  },
  "enable_analytics":true,
  "analytics_config":{  
    "type":"mongo",
    "csv_dir":"/tmp",
    "mongo_url":"mongodb://localhost/tyk_analytics",
    "mongo_db_name":"tyk_analytics",
    "mongo_collection":"tyk_analytics",
    "purge_delay":10,
    "ignored_ips":[  

    ]
  }
}

I see no error when starting one or the other. Could you advise? Thanks

lonelycode commented 9 years ago

Hi,

The tyk_analytics config file has the redis password set, which means it will be trying to authenticate the session when it creates it.

To fix this, set a password in redis.conf (http://redis.io/topics/security), restart the redis process, then update both tyk.conf and tyk_analytics.conf to use the new password.

It's a known bug with the dashboard, it expects a secured redis DB while tyk doesn't, we'll be fixing this soon :-/

Let me know how it goes, Martin

lonelycode commented 9 years ago

I should mention your email address is the login username, not first or last name... will make that clearer in the UI, nice catch :-)

sonicaghi commented 9 years ago

we're already playing with it ;)

thibaultcha commented 9 years ago

Alright, got it working, thanks! Good stuff

thibaultcha commented 9 years ago

Oh wait, maybe I should have left that open for the redis issue?