Skip to content

Commit 2f5708b

Browse files
committed
Move to remotehost via parameter
1 parent 9281df1 commit 2f5708b

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

client/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
This folder contains files needed for the client side of the autopower project:
66

77
- `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
8-
- `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.
9-
- `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.
8+
- `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.
9+
- `serverIpConfig.sh` A bash script containing configuration parameters like the domain of the autopower server. Edit this to your needs.
1010
- `config/client_config.json.example`: Example config file for the client. This contains setting parameters like the uid of an autopower device.
1111
- `config/secrets.json.example`: Example config file which contains secrets like the path to certificates for the client.
1212

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

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

23-
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.
23+
Now edit the `serverIpConfig.sh` script with the domain and IP of the autopower server.
2424

2525
### Setting up a Raspberry Pi
2626

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

4343
### Deployment on the Pi
4444

45-
**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.
45+
**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.
4646

4747
**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.
4848

client/deploy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ cp config/secrets.json.example /etc/mmclient/secrets.json
4848
# replace magic string ßß§$$$rplacePw$$$§ßß with actual password
4949
sed -i 's/ßß§$$$rplacePw$$$§ßß/'"${PGPASSWORD}"'/' /etc/mmclient/secrets.json
5050
echo "Create client certificates..."
51-
./deploy/create_client_cert.sh
51+
./deploy/create_client_cert.sh "${REMOTEHOST}"
5252
mv client.key /etc/mmclient/client.key
5353
mv client.csr /etc/mmclient/client_"${DEVICENAME}".csr
5454

client/deploy/cnConfig.sh

-3
This file was deleted.

client/deploy/create_client_cert.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

7-
source cnConfig.sh
7+
CN="${1}"
88

99
openssl genrsa -des3 -passout pass:1111 -out client.key 4096
1010
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}"

0 commit comments

Comments
 (0)