---
# System prepended metadata

title: Kamar Remote Access

---

# `KAMAR` Remote Access

## One-off Settings

All the following settings only need to be done once on a computer. If you have
done these steps, you can go straight to the [`KAMAR` connection section](https://hackmd.io/1XFBe56JRjmtAKCbvN8FPQ#KAMAR-Connection).

### Software Installation

1. Make sure your Windows is [up-to-date](https://support.microsoft.com/en-us/windows/keep-your-pc-up-to-date-de79813c-7919-5fed-080f-0871c7bd9bde).
1. Install [`cloudflared`](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/#windows)
   1. Open a [Command Prompt](https://www.digitalcitizen.life/open-cmd/).
   1. Type in `winget install --id Cloudflare.cloudflared` and enter. Follow
      the instructions and grant permission.
   1. Close the command prompt after installation.
1. Install `PuTTY`
   - The easiest way is to install it from [Microsoft Store](https://apps.microsoft.com/detail/xpfnzksklbp7rj)
   - If you don't have Microsoft Store, you can download it from their [official website](https://putty.org/).
1. Install Chrome extension [`SwitchyOmega`](https://chromewebstore.google.com/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif), if you use Chrome-based browsers (such as Chrome, Edge or Brave). Let me know if you are not using one of those browsers.

### Encryption Key Pair Generation

1. Open the app called `PuTTYgen` which should be under `C:\Program Files\PuTTY` by default.

![Icon](https://hackmd.io/_uploads/HybpwGk6T.png)

1. Select `EdDSA` under "*Parameters*". Then "**Generate**".

1. Follow the onscreen instructions to move your mouse to produce some
   randomness for the key generation process.

1. You can leave "*Key passphrase*" empty for simplicity. If you do provide a
   passphrase, make sure you will remember it.

1. Hit "**Save private key**": choose a location to save the private key. It will also
   ask for a filename ended with `.ppk`. I'll assume you naming it as
   `ed25519.ppk`

1. Copy the public key and ***send*** it to me. You should be able to find it under
   "*Public key for pasting into OpenSSH authorized_keys file:*". It should start
   with "*ssh-ed25519*" and end with the date you generated the pair. This
   public key will be store on the little computer for user authentication purpose -
   this is how I grant you access to the box and hence to the school network.

1. You may close `PuTTY Key Generator`

### Setting up a `PuTTY` session

1. Open `PuTTY`. Again, it should be in `C:\Program Files\PuTTY`.

1. Under *Category* navigate to *Connection* >> *SSH* >> *Tunnels*: *Source port* to fill in `5050`; select
   `Dynamic`; click **Add**.

   ![Dynamic](https://hackmd.io/_uploads/B107WRkTT.png)

   After adding, you should see `D5050` under *Forwarded ports*.

1. Under *Category* navigate to *Connection* >> *Proxy*: in *"Command to send to proxy (for some types)"* fill
   in `cloudflared.exe access ssh --hostname %host` and select `Local` as the
   *Proxy type*.

   ![Cloudflare](https://hackmd.io/_uploads/Sy5mVX1pp.png)

1. Under *Category* go to *Connection* >> *SSH* check `Don't start a shell or command at all`. ![](https://hackmd.io/_uploads/H18wCG16T.png)

1. Go back to *Category*'s top option *Session*. Enter `xieu@mars.kumkee.net` as
   the *Host Name*. Name the session as `mars` for example under *Saved
   Sessions* and click **Save**

   ![session](https://hackmd.io/_uploads/SJC_-Cya6.png)

1. You may now close the *`PuTTY` Configuration* window.

### Setting up `SwitchyOmega`

1. In your Chrome open the options setting of extension `Proxy SwitchyOmega`.

   ![](https://hackmd.io/_uploads/r1u6_JgTp.png)
   ![Options](https://hackmd.io/_uploads/SyVROyeT6.png)

1. In the options page under profiles, change the *Protocol* to `SOCKS5`, server
   to `localhost` and *Port* to `5050`. Then **Apply Changes**.

   ![Proxy](https://hackmd.io/_uploads/H1oht1lT6.png)

1. Go to *auto switch* under the same options page. Delete the first row by
   hitting the rubbish bin.
   In the remaining row, type in `kamar.macleans.school.nz` in the *Condition Details*
   column. Then **Apply Changes**.

   ![Auto](https://hackmd.io/_uploads/Hk0-cyxp6.png)

1. Close the options tab of `Proxy SwitchyOmega`.

1. Click the `Proxy SwitchyOmega` Chrome extension icon again and then select
   **auto switch**.

   ![Switch](https://hackmd.io/_uploads/S1b_51g66.png)

### Conclusion of One-off Settings

This concludes the preparation we need to establish a `KAMAR` connection. All
these will only have to be done once. Here below is a
summary of what we have done. Feel free to flow the link and visit a particular
section again.

1. [Software installation](https://hackmd.io/1XFBe56JRjmtAKCbvN8FPQ?view#Software-Installation)
1. [Encryption key pair generation](https://hackmd.io/1XFBe56JRjmtAKCbvN8FPQ?view#Encryption-Key-Pair-Generation)
1. [Setting up a `PuTTY` session](https://hackmd.io/1XFBe56JRjmtAKCbvN8FPQ?view#Setting-up-a-PuTTY-session)
1. [Setting up `Proxy SwitchyOmega`](https://hackmd.io/1XFBe56JRjmtAKCbvN8FPQ?view#Setting-up-SwitchyOmega)

## `KAMAR` Connection

### Loading the Private Key to `PuTTY`

1. Open `Pageant` (should be in the same folder - `C:\Program Files\PuTTY`). The
   `Pageant` icon will appear in the system tray.

   ![Pageant](https://hackmd.io/_uploads/ryVrQ0kpT.png)

1. Right-click the `Pageant` icon and then click **Add Key**. Navigate to the `.ppk`
   file you generated before.

1. The public key associated with the private key need to be uploaded to the little
   server for the whole thing to work. That is why you need to send the public
   key to me after you have generated the pair.

1. Right-click the `Pageant` icon again and then **View Keys** to confirm your
   key has been added. You may close the *`Pageant` Key List* window afterward.

### Running a `PuTTY` Session

1. Right-click the `Pageant` icon >> *Saved Sessions* >> **`mars`** (or whatever
   name you gave to the session we set up before)

1. If you see something like

   ```
    Using username "xieu".
    Authenticating with public key "eddsa-key-20240301" from agent

   ```

   you have successfully connected to the school network.

1. If it asks you for a password, that means you didn't load the private key or
   the public key has not uploaded to the server.

### `KAMAR`, Finally

Now you have done all the hard work, just simply open your Chrome and enter
[`kamar.macleans.school.nz`](https://kamar.macleans.school.nz). The familiar user
interface should be now right in front of you.

Please feel free to comment on any of the sessions and let me know if you have
any problems.
