Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quack creates db & users with localhost NOT using IP Address #240

Open
bobbeck55 opened this issue Feb 21, 2023 · 7 comments
Open

Quack creates db & users with localhost NOT using IP Address #240

bobbeck55 opened this issue Feb 21, 2023 · 7 comments

Comments

@bobbeck55
Copy link

Describe the bug
When I point my browser to "locahost:80" I can login to quack
and create db and users BUT if I point my browser to the ipaddr:80 I can't. Quack attempts
to login but gets "kicked out" by something. This happens when
my browser is internal to my VM and when it is run on my host machine.

Also - I would like to persist the db and users I create. How?
I have attached the quack startup log, docker-compose.yml, and quack.properties files.

@azee
Copy link
Collaborator

azee commented Feb 22, 2023

@bobbeck55 , you don't need to add port 80 explicitly in the url - your browser (or CURL) will use 80 as a default value.

auth.domain property - https://github.com/greatbit/quack/blob/master/api/src/main/resources/quack.properties#L17 - in your local config file should match the domain exactly.

In your case it will be
auth.domain= ipaddr

QuAck will work with one domain ONLY. It will be either your ip addres (or a DNS domain/CNAME), or Localhost. You can't use both at the same time.

When QuAck is trying to authenticate a user, it gets a session id cookie from the request. Cookies are tightly coupled with domains. QuAck searches for cookies related to domain specified in the "auth.domain" property. Which means there might be only one domain for the service.

@azee
Copy link
Collaborator

azee commented Feb 22, 2023

Could you please share your quack.properties (you can omit private data such as service paths and credentials), command you are using to run the app and docker-compose.yaml if you are using docker compose.

In that case I'll be able to identify what is not working faster.

@azee
Copy link
Collaborator

azee commented Feb 22, 2023

Please feel free to contact me directly via e-mail - info@greatbit.com.au
I'll provide my whatsapp/telegram/skype/discord contacts to speed things up

@bobbeck55
Copy link
Author

cmd:
docker-compose -f docker-compose.yml up

version: '2'
services:
quack:
image: greatbit/quack
ports:
- "80:80"
links:
- mongod:mongod
depends_on:
- mongod
environment:
WAIT_HOSTS: mongod:27017
volumes:
- quack:/home/bob/quack_db

mongod:
container_name: "mongod"
image: mongo:4.2
expose:
- "27017"
ports:
- "27017:27017"

volumes:
quack:
driver: local

#Database
mongo.replicaSet=mongod:27017
mongo.dbname=test
mongo.username=
mongo.password=
mongo.uri=
#Authentication
whoru.auth.provider=ru.greatbit.whoru.auth.providers.StubAuthProvider
whoru.session.provider=ru.greatbit.whoru.auth.providers.HazelcastSessionProvider
stub.login=someuser
stub.password=somepassword
auth.domain=192.168.56.102
auth.session.ttl=6000000
auth.admin.login=root
auth.admin.password=rootpass
auth.admin.token=abc
auth.admin.logins=azee,zyxel560k@mail.ru
#Hazelcast
entity.lock.ttl.min=5
hazelcast.group.name=dev
hazelcast.group.password=dev-pass
hazelcast.ttl.sec=1209600
hazelcast.port=5903
hazelcast.port.rest=5904
hazelcast.port.auto.increment=true
hazelcast.members=127.0.0.1
hazelcast.interface=127.0.0.1
hazelcast.backup.count=1
hazelcast.prefer.ipv4.stack=true
hazelcast.aws.enabled=false
hazelcast.tcpip.enabled=true
storage.provider=com.testquack.storage.MongoStorage
quack.tracker=com.testquack.tracker.DummyTracker
aws.cognito.access.key=CHANGEME
aws.cognito.secret.key=CHANGEME
aws.cognito.region=us-east-1
aws.cognito.oauth.endpoint=
aws.cognito.client.id=CHANGEME
aws.cognito.redirect.url=
cognito-auth-provider=
cognito.login.url=

@azee
Copy link
Collaborator

azee commented Feb 22, 2023

  1. Try changing
    whoru.auth.provider=ru.greatbit.whoru.auth.providers.StubAuthProvider
    to
    whoru.auth.provider=com.testquack.api.security.DbAuthProvider

StubAuthProvider was created for testing and local development purposes and it just allows to authenticate an admin from config

  1. According to the config - you should be able to login when accessing quack using http://192.168.56.102 (no port needed)
  2. If that doesn't work - please check your volume mapping is correct
    if your local config is located here: /home/bob/quack_db/quack.properties
    then your volume mapping in docker compose should be like
    volumes:
    • ~/home/bob/quack_db:/etc/quack

It seems that you are using default config. Thats why you can only access it via localhost as it is a default auth domain.
Correct volume mapping should fix it.

@bobbeck55
Copy link
Author

bobbeck55 commented Feb 22, 2023 via email

@azee
Copy link
Collaborator

azee commented Feb 22, 2023

@bobbeck55 Lats try narrowing down the problem
Try setting
whoru.session.provider=ru.greatbit.whoru.auth.providers.InmemSessionProvider
instead of HazelcastProvider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants