Hosting git

30 points

Since setting up your own servers for things is demonstrably fine, let's go for it with git.

It's simple as always: set up an SSH-accessible git server, create an empty repository there for us and let us push some stuff to it.

Once the server is up and running, configured according to what you got from the problem endpoint, hit the /_/git endpoint (see below, under pulling the trigger) to trigger a push. You'll need to pass in the hostname of the server we should push to. We'll grab a tube of glue, prepend the username, append the path and we'll try calling that number.

We won't push much - just a simple solution.txt file with the secret key inside. Pass that to the solution endpoint and grab some sweet points.

Getting the problem set

GET /challenges/hosting_git/problem?access_token=...

Problem JSON structure is simple:

  • ssh_key: the SSH key our server will use to authorize over at your server
  • username: the username we want to use when connecting
  • repo_path: the repository path we want to use
  • push_token: the token you'll use to trigger a push
Pulling the trigger

To trigger the push, POST a JSON to /_/git/$push_token with a single key inside:

  • repo_host: the host we should connect to

Proper values are foo.example.com, git.nasa.gov and so on. The final repo URL we try connecting to is usually something like hack@<repo_host>:folly/woot.git (here for username = hack and repo_path = folly/woot.git).

Once the request is received, we'll start a push. The request blocks until the push has completed.

Submitting a solution

POST /challenges/hosting_git/solve?access_token=...

Your solution should be a JSON with a single key inside:

  • secret: the secret you found in solution.txt

Background

It's sort of fun and brings you one step closer to undestanding how brutally simple git hosting is.


——
You too can support h^ by buying me a coffee. Cheers!
Also, I'd love to hear from you. Whatever you got, drop me an email. My h^ profile is here.