2

I've created a project in node.js to store and fetch credentials from cyberark conjur (using its REST-API) But to test the application I'm stumbling to setup conjur server.

  • Problem is server is running fine within docker container, but how to access it outside(host machine) (port mapping is not working)

  • Or is there any conjur server hosted on Internet for public usage

All I want is to test API calls

1 Answers1

2

As of writing this, the Conjur Node.js API is not currently actively being supported. Here are some suggestions for testing the API's.

Can I see the command you're using to start docker/docker-compose file?

Method 1

If you're using the setup from the Conjur Quickstart Guide, your docker-compose.yml file should look something like:

...
conjur:
    image: cyberark/conjur
    container_name: conjur_server
    command: server
    environment:
      DATABASE_URL: postgres://postgres@database/postgres
      CONJUR_DATA_KEY:
      CONJUR_AUTHENTICATORS:
    depends_on:
    - database
    restart: on-failure

  proxy:
    image: nginx:1.13.6-alpine
    container_name: nginx_proxy
    ports:
      - "8443:443"
    volumes:
      - ./conf/:/etc/nginx/conf.d/:ro
      - ./conf/tls/:/etc/nginx/tls/:ro
    depends_on:
    - conjur
    - openssl
    restart: on-failure
...

This means Conjur is running behind an NGINX proxy to handle the SSL and does not have a port exposed to outside the Docker network it is running on. With this setup you can access the Conjur Server on https://localhost:8443 on your local machine.

Note: You will need the SSL cert located in ./conf/tls/. Since this is a demo environment, these are made readily available for testing like this.

Method 2

If you do not care about security and are just purely testing the REST API endpoints, you could always cut out the SSL and just modify the docker-compose.yml to expose the Conjur server's port to your local machine like this:

...
conjur:
    image: cyberark/conjur
    container_name: conjur_server
    command: server
    environment:
      DATABASE_URL: postgres://postgres@database/postgres
      CONJUR_DATA_KEY:
      CONJUR_AUTHENTICATORS:
    ports:
      - "8080:80"
    depends_on:
    - database
    restart: on-failure

Now you'll be able to talk to the Conjur Server on your local machine through http://localhost:8080.

For more info: Networking in Docker Compose docs

Jerque
  • 21
  • 3