Skip to content

Commit

Permalink
Update docs (#15)
Browse files Browse the repository at this point in the history
* Update index.md

Capitalise SSH where appropriate
Update Contribute link

* Remove $ from commands

Updated to follow the style guide.
See: https://docs.ubuntu.com/styleguide/en/#code-examples-in-documentation

* Update getting-started.md

Capitalisation (SSH, Juju)
Changes for conciseness 
Replaced a & with "and" 
Setting --> set, cleaning --> clean

* Capitalise Juju and SSH

* pin pydantic 2.8.2

* Revert "pin pydantic 2.8.2"

This reverts commit 79c7fba.

* add rust

* add CVE-2024-34156 to .trivyignore

---------

Co-authored-by: Christopher Bartz <[email protected]>
  • Loading branch information
erinecon and cbartz authored Sep 17, 2024
1 parent b5a8c3d commit 458b2ab
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
CVE-2024-24790
CVE-2023-45288
# False positive: https://github.com/canonical/pebble/issues/498
CVE-2024-34156
14 changes: 14 additions & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ bases:
run-on:
- name: ubuntu
channel: "22.04"

parts:
charm:
build-packages:
- build-essential
- python3-dev
- pkg-config
- libffi-dev
- libssl-dev
build-snaps:
- rustup
override-build: |
rustup default stable
craftctl default
2 changes: 1 addition & 1 deletion docs/explanation/port-number.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Port number

The port 10022 has been chosen as port 22 is already used by juju for ssh access.
The port 10022 has been chosen as port 22 is already used by Juju for SSH access.
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ them to collaborate, provide technical support, or demonstrate commands and proc
real-time.

This charm provides the tmate-ssh-server service, which is paired with the tmate client to provide
a self-hosted ssh relay server.
a self-hosted SSH relay server.

For DevOps and SRE teams, this charm will make operating self hosted tmate-ssh-server simple and
straightforward through Juju's clean interface. Allowing machine relations to the
Expand All @@ -24,7 +24,7 @@ warmly welcomes community projects, contributions, suggestions, fixes and constr
- [Code of conduct](https://ubuntu.com/community/code-of-conduct)
- [Get support](https://discourse.charmhub.io/)
- [Join our online chat](https://matrix.to/#/#charmhub-charmdev:ubuntu.com)
- [Contribute](Contribute)
- [Contribute](https://github.com/canonical/tmate-ssh-server-operator/blob/main/CONTRIBUTING.md)

Thinking about using the tmate-ssh-server Operator for your next project?
[Get in touch](https://matrix.to/#/#charmhub-charmdev:ubuntu.com)!
Expand Down
60 changes: 30 additions & 30 deletions docs/tutorial/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@ controller type.
To see how to bootstrap your Juju installation with LXD, please refer to the documentation
on LXD [installation](https://juju.is/docs/juju/lxd).

### Setting up the tutorial model
### Set up the tutorial model

To easily clean up the resources and to separate your workload from the contents of this tutorial,
it is recommended to set up a new model with the following command.
set up a new model with the following command.

```
$ juju add-model tmate-tutorial
juju add-model tmate-tutorial
```

### Deploy the tmate-ssh-server charm

Use the following command to deploy the tmate-ssh-server charm.

```
$ juju deploy tmate-ssh-server
juju deploy tmate-ssh-server
```

### Get the tmate configuration contents

To get the contents of `.tmate.conf` file to register a tmate client, use the `get-server-config`
action to retrieve the configuration details. Save the output contents into `.tmate.conf` file for
later use.
To register a tmate client, we need a file containing the configuration details.
Use the `get-server-config` action to retrieve the details, and save the output contents
into `.tmate.conf` for later use.

```
$ juju run tmate-ssh-server/0 get-server-config | grep -E set | sed 's/^[[:space:]]*//' > .tmate.conf
juju run tmate-ssh-server/0 get-server-config | grep -E set | sed 's/^[[:space:]]*//' > .tmate.conf
```

The output of .tmate.conf file generated from the command above will look something like the following:
The output of .tmate.conf file generated from the previous command will look something like the following:
```
$ cat .tmate.conf
set -g tmate-server-host <tmate-ssh-server-unit-ip>
set -g tmate-server-port 10022
set -g tmate-server-rsa-fingerprint <rsa-fingerprint>
Expand All @@ -59,41 +59,37 @@ set -g tmate-server-ed25519-fingerprint <ed25519-fingerprint>
To imitate a tmate client, we can add a machine on Juju and install tmate.

```
$ juju add-machine
created machine 1
$ juju ssh 1 -- "sudo apt update && sudo apt install -y tmate"
juju add-machine
juju ssh 1 -- "sudo apt update && sudo apt install -y tmate"
```

Copy the .tmate.conf file retrieved from the
[Get the tmate configuration contents](#get-the-tmate-configuration-contents) above to the client
Copy the .tmate.conf file we previously created to the client
machine.

Then, register the public key of the current machine (use `ssh-keygen` to generate key files if
none exist yet).

```
$ juju scp .tmate.conf 1:~/.tmate.conf
$ juju ssh 1 -- "echo $(~/.ssh/id_rsa.pub) >> ~/.ssh/authorized_keys"
juju scp .tmate.conf 1:~/.tmate.conf
juju ssh 1 -- "echo $(~/.ssh/id_rsa.pub) >> ~/.ssh/authorized_keys"
```

Start the tmate client & get the ssh command.
Start the tmate client and get the SSH command.
```
# start a new tmate session
$ juju ssh 1 -- "tmate -a ~/.ssh/authorized_keys -S /tmp/tmate.sock new-session -d"
juju ssh 1 -- "tmate -a ~/.ssh/authorized_keys -S /tmp/tmate.sock new-session -d"
# wait until the tmate session is ready
$ juju ssh 1 -- "tmate -S /tmp/tmate.sock wait tmate-ready"
juju ssh 1 -- "tmate -S /tmp/tmate.sock wait tmate-ready"
# print tmate ssh details
$ juju ssh 1 -- "tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'"
ssh -p10022 <user>@0.0.0.0
juju ssh 1 -- "tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'"
# output looks something like ssh -p10022 <user>@0.0.0.0
```

### SSH into the tmate terminal

Use `juju status` command to find out the unit ip address.
Run `juju status` command to find out the unit IP address.

```
$ juju status
Model Controller Cloud/Region Version SLA Timestamp
tmate-tutorial localhost localhost/localhost 3.1.6 unsupported <timestamp>
Expand All @@ -112,8 +108,12 @@ Then use the ssh command output from the previous step and replace `0.0.0.0` add
IP of tmate-ssh-server unit.

```
$ ssh <user>@<unit-ip>
ssh <user>@<unit-ip>
```

The output will look something like the following:

```
Tip: if you wish to use tmate only for remote access, run: tmate -F
To see the following messages again, run in a tmate session: tmate show-messages
Press <q> or <ctrl-c> to continue
Expand All @@ -125,13 +125,13 @@ ssh session: ssh -p10022 <user>@<unit-ip>
```


### Cleaning up the environment
### Clean up the environment

Congratulations! You have successfully finished the tmate-ssh-server tutorial. You can now remove
the `.tmate.conf` file and the juju model environment that you’ve created using the following
the `.tmate.conf` file and the Juju model environment that you’ve created using the following
command.

```
$ rm .tmate.conf
$ juju destroy-model tmate-tutorial -y
rm .tmate.conf
juju destroy-model tmate-tutorial -y
```

0 comments on commit 458b2ab

Please sign in to comment.