Skip to content

certs path

certs path #33

Workflow file for this run

name: Test Build and Call With Fake Register
on: [push]
jobs:
fakeRegister:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y openssl
- name: Install Python Dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install requests
- name: Docker Build
run: |
docker-compose build
- name: Create Dummy Certificates
run: |
mkdir -p ./certs
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out ./certs/local-ca.key
openssl req -x509 -new -nodes -key ./certs/local-ca.key -sha256 -days 3650 -out ./certs/local-ca.pem -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com"
openssl req -x509 -new -nodes -key ./certs/local-ca.key -sha256 -days 3650 -out ./certs/factory_ca.pem -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com"
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out ./certs/server.key
openssl req -new -key ./certs/server.key -out ./certs/server.csr -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com"
openssl x509 -req -in ./certs/server.csr -CA ./certs/local-ca.pem -CAkey ./certs/local-ca.key -CAcreateserial -out ./certs/tls-crt -days 365 -sha256
rm -rf ./certs/server.key
rm -rf ./certs/server.csr
chmod +r ./certs/*
ls -la ./certs
- name: Run Docker Compose Up
run: |
docker-compose up --force-recreate --detach
sleep 10
- name: Execute Script
run: |
python3 fake-lmp-device-register --registration-url "http://localhost:80/sign" --factory fake-test-sample
- name: Check relative /var/sota directory and pkey.pem file
run: |
if [[ -d "var/sota" && -f "var/sota/pkey.pem" ]]; then
echo "Relative /var/sota directory exists and pkey.pem is present"
else
echo "Relative /var/sota directory or pkey.pem is missing"
exit 1
fi
ls -la var/sota/
- name: Output Docker Compose Logs
if: always()
run: |
echo "Docker Compose Logs:"
docker-compose logs
- name: Shutdown Docker Compose
if: always()
run: |
docker-compose ps
docker-compose down