Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

How to play Quake2 with Conjur

Have you checked out how we secured a Node.js port of Quake2 using Nginx and Conjur and you want to give it a try yourself?

Here's how to do it.

Install the Conjur CLI

First, install the Conjur CLI. You'll need this to login to Conjur.

(optional) Install Docker

The easiest way to run the forwarder proxy is Docker. You can also run it using the Node.js command line if you prefer; we'll only describe the Docker method here, the source code for the proxy is https://github.com/conjurdemos/WebQuake/tree/master/Proxy if you want to skip Docker and use Node.js directly.

Get a Conjur account

Next, request a login to the Conjur server which is powering the Quake2 demo. To get a login, join us in our public HipChat room, we will have some developers in there pretty much all the time.

Once you have your username and password, login to Conjur like this:

$ conjur authn login
Enter your username to log into Conjur: alice
Please enter your password (it will not be echoed): *********
Logged in

$ conjur authn whoami
{"account":"conjur-demo","username":"alice"}

Run the authentication proxy

The secure WebQuake requires all HTTP requests to have an Authorization header with a Conjur-issued bearer token.

You make this happen by running a local proxy, and directing all requests to WebQuake through the proxy. When you logged in in the previous step, your login credentials (username and API key) are written to ~/.netrc. This is where they will be found by the authentication proxy.

Run the proxy like this:

$ docker run \
  -p 8090:80 \
  -v $HOME/.netrc:/etc/conjur.identity \
  conjurdemos/webquake_proxy \
  http://webquake.joyent.itd.conjur.net:85

This command is doing the following things:

  • -p 8090:80 Exposing container port 80 as local machine port 8090
  • -v $HOME/.netrc:/etc/conjur.identity Providing your .netrc file to the container as /etc/conjur.identity
  • conjurdemos/webquake_proxy Running this image, which will be pulled from DockerHub
  • http://webquake.joyent.itd.conjur.net:85 Proxying requests to this remote hostname and port (Note It's not HTTPS (yet))

Load the game

Now that you've got the local proxy running, open your browser to http://webquake.joyent.itd.conjur.net. The game will load and start to play in demo mode.

Connect to Multiplayer mode

Press the Esc key to enter the options screen, then choose Multiplayer. The hostname and port depends on whether you are running native Docker or boot2docker.

Native Docker (Linux)

localhost:8090

Boot2Docker (Mac / Windows)

You need to find out the boot2docker IP address:

$ boot2docker ip
192.168.59.103 <-- Your IP will most likely be different

Then use that IP address along with port 8090 to connect:

192.168.59.103:8090

Profit!

The game will pause to connect to the multiplayer server, then you'll spawn with the basic shotgun weapon. You're in!

PS A mouse is recommended, it's pretty hard to play with just a keyboard and track pad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.