first commit

This commit is contained in:
denis
2024-09-23 15:10:59 +02:00
commit df147630e5
21 changed files with 2270 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
set -x
#doesn't currently work using variables
cacert = 'server-certs/ca.crt'
cakey = 'server-certs/ca.key'
dir="client-certs"
echo "Creating Client Key"
openssl genrsa -out client.key 2048
echo "Creating certificate request"
openssl req -new -out client.csr -key client.key
echo "Signing client certificate with CA key"
echo "The CA key File must be in the server-certs folder"
openssl x509 -req -in client.csr -CA server-certs/ca.crt -CAkey server-certs/ca.key -CAcreateserial -out client.crt -days 3650
if [ -d $dir ];then
echo "directory Exists"
else
mkdir $dir
fi
mv client.* $dir
+39
View File
@@ -0,0 +1,39 @@
dir="server-certs"
FILE="v3.ext"
echo "Creating CA key The passkey is important so remember it"
openssl genrsa -des3 -out ca.key 2048
echo "Created CA Certificate 10 years expiry"
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt
echo "Creating Server key"
openssl genrsa -out server.key 2048
echo "Creating Server certificate"
openssl req -new -out server.csr -key server.key
echo "Signing Server certificate Server certificate"
echo "Common Name should be the FQDN or IP address of the server"
echo "It is what you would use to ping the server"
if [ -f "$FILE" ];then
echo "$FILE exists"
break
else
echo "You need an external file called $FILE to continue"
fi
echo "Press enter to continue"
read var1
if [ ! -f "$FILE" ];then
exit 1
fi
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 3650 -extfile $FILE
echo "copying files to certs subdirectory"
if [ -d $dir ]
then
echo "directory Exists"
else
mkdir $dir
fi
mv *.crt $dir
mv *.key $dir
mv *.csr $dir
mv *.srl $dir
+4
View File
@@ -0,0 +1,4 @@
authorityKeyIdentifier = keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
rm -rf .venv
python3 -m venv .venv
source $(pwd)/.venv/bin/activate
echo "Activate virtual environment .venv"
echo "PIP path: $(command -v pip)"
pip install -U pip wheel setuptools
pip install -r $1
+12
View File
@@ -0,0 +1,12 @@
[program:solarmax]
directory = /home/opiwin/solarmax/solarmax
command=/home/opiwin/solarmax/solarmax/solarmaxd.py
user=opiwin
group=opiwin
stopasgroup=true
stopsignal=SIGINT
autostart=true
autorestart=true
redirect_stderr=true
redirect_stdout=true
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
if [ $EUID -ne 0 ]; then
echo "Lancer en root: # $0" 1>&2
exit 1
fi
apt update
#apt upgrade
apt install build-essential binutils supervisor
# supervisor http access
if [ ! -e "/etc/supervisor/supervisord.conf.old" ]; then
cp /etc/supervisor/supervisord.conf /etc/supervisor/supervisord.conf.old
cat >> /etc/supervisor/supervisord.conf << EOF
[inet_http_server]
port = *:9001
username = root
password = toor
EOF
fi
apt install python3-dev python3-pip python3-venv
#python3-paho-mqtt python3-pyaml
+2
View File
@@ -0,0 +1,2 @@
pyyaml
paho-mqtt==1.6.1