Skip to content

Commit

Permalink
Move to remotehost via parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
UsualSpec committed Jul 1, 2024
1 parent 9281df1 commit 2f5708b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
This folder contains files needed for the client side of the autopower project:

- `deploy.sh` A bash script which runs on the Raspberry Pi to setup the environment. This asks interactively for a device name and sets up all respective binaries, the database, firewall, Zabbix client for monitoring, etc
- `deploy/create_client_cert.sh` A script to generate certificates for the clients. Those need to be signed from a CA trusted by the server to allow encrypted connection.
- `serverIpConfig.sh` A bash script containing configuration parameters like the domain of the autopower server. Edit this to your needs. Also do the same to `deploy/cnConfig.sh` for the CN in the certificates.
- `deploy/create_client_cert.sh <CN>` A script to generate certificates for the clients. Those need to be signed from a CA trusted by the server to allow encrypted connection.
- `serverIpConfig.sh` A bash script containing configuration parameters like the domain of the autopower server. Edit this to your needs.
- `config/client_config.json.example`: Example config file for the client. This contains setting parameters like the uid of an autopower device.
- `config/secrets.json.example`: Example config file which contains secrets like the path to certificates for the client.

Expand All @@ -20,7 +20,7 @@ Afterwards compile the autopower client (mmclient) from this repository as descr

You can also use the precompiled binaries from [GitHub releases](https://github.com/nsg-ethz/autopower/releases).

Now edit the `serverIpConfig.sh` script with the domain and IP of the autopower server and the `deploy/cnConfig.sh` file with the CN (usually the domain) of your server.
Now edit the `serverIpConfig.sh` script with the domain and IP of the autopower server.

### Setting up a Raspberry Pi

Expand All @@ -42,7 +42,7 @@ First of all, flash an OS to the SD card of the Raspberry Pi. This project was t

### Deployment on the Pi

**Note:** This method uses a USB stick, but you can of course also copy the files via SFTP or SCP if you know the IP.
**Note:** This method uses a USB stick mounted at `/mnt`, but you can of course also copy the files via SFTP or SCP if you know the IP.

**SSH Keys:** To add a SSH key for SSH connection to the Pi (e.g. if you did not use the Raspberry Pi imager), put your SSH Key into a file called `ssh_key.pub` in the `client/deploy/` folder. This will then be added to each Pis' `authorized_keys` file.

Expand Down
2 changes: 1 addition & 1 deletion client/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cp config/secrets.json.example /etc/mmclient/secrets.json
# replace magic string ßߧ$$$rplacePw$$$§ßß with actual password
sed -i 's/ßߧ$$$rplacePw$$$§ßß/'"${PGPASSWORD}"'/' /etc/mmclient/secrets.json
echo "Create client certificates..."
./deploy/create_client_cert.sh
./deploy/create_client_cert.sh "${REMOTEHOST}"
mv client.key /etc/mmclient/client.key
mv client.csr /etc/mmclient/client_"${DEVICENAME}".csr

Expand Down
3 changes: 0 additions & 3 deletions client/deploy/cnConfig.sh

This file was deleted.

2 changes: 1 addition & 1 deletion client/deploy/create_client_cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# source: https://github.com/grpc/grpc/issues/9593

source cnConfig.sh
CN="${1}"

openssl genrsa -des3 -passout pass:1111 -out client.key 4096
openssl req -new -passin pass:1111 -key client.key -out client.csr -sha512 -subj "/C=CH/ST=Switzerland/L=Zuerich/O=ETH-Zuerich/OU=D-ITET/CN=${CN}"
Expand Down

0 comments on commit 2f5708b

Please sign in to comment.