The 4bit project is a personal api meant to be invoked by various trusted local network devices for monitoring and reporting their status.
For getting started, certificates can be generated using the generate_certs.sh script, which will generate a Certificate Authority(CA), one client, and one server certificate. The latter two will be signed by the CA. This script uses certstrap to help generate those certificates.
The following is an example for invoking the script,
scripts/generate_certs.sh \ --ca 4bitCA \ # Arbitrary Certificate Authority name. --server localhost \ # Arbitrary Server name. --client client1 # Arbitrary Client name.
There are a couple of ways to start running the server binary. Within a docker container and without.
There’s already a docker-compose.yaml file, which includes a template for the basic environment variables. The environment variable names depend on what the generated certificate names were set to.
After modifying the environment variables to to the appropriate values, running the following start a server listening on localhost:3000,
docker-compose up ... 4bit_api_server | 2022/05/29 18:58:10 Listening on 0.0.0.0:3000.
On Host Machine
Running the server on a host machine is pretty simple. After generating the
required certificates, build the server binary by running the build.sh
script. This will build the binary under the
After the latter two are complete, run the following with respect certificate names chosen and the binary name built,
build/SERVER_BIN_NAME \ --caCrt certs/4bitCA.crt \ --caCrl certs/4bitCA.crl \ --srvCrt certs/localhost.crt \ --srvKey certs/localhost.key \ --host 0.0.0.0