add ca service

This commit is contained in:
Artur Gurgul 2025-08-13 07:06:53 +02:00
parent ca5d4c4b72
commit 8bbf7d31a5
10 changed files with 87 additions and 3 deletions

4
bin/admin/certbot-cert Normal file
View file

@ -0,0 +1,4 @@
#/usr/bin/env bash
certbot certonly --manual --preferred-challenges=dns -d "*.gurgul.org" -d "gurgul.org"

21
bin/admin/install-idf Normal file
View file

@ -0,0 +1,21 @@
if [ -z "$SUDO_USER" ]; then
echo "This script must be run within sudo."
exit 1
fi
# from says ~/esp
ESP=/pkg/esp
apt-get install git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
sudo -u "$SUDO_USER" bash <<EOF
mkdir -p $ESP
cd $ESP
git clone -b v5.4.1 --recursive https://github.com/espressif/esp-idf.git
cd "$ESP/esp-idf"
export IDF_TOOLS_PATH="$ESP/esp-idf/.espressif"
./install.sh esp32,esp32c2,esp32c3,esp32c5,esp32c6,esp32c61,esp32h2,esp32p4,esp32s2,esp32s3
EOF

View file

@ -0,0 +1,2 @@
export IDF_TOOLS_PATH="/pkg/esp/esp-idf/.espressif"
. /pkg/esp/esp-idf/export.sh

6
bin/services/ca/Gemfile Normal file
View file

@ -0,0 +1,6 @@
source "https://rubygems.org"
ruby ">= 3.0"
gem "roda"
gem "puma"
gem "rackup"

View file

@ -0,0 +1,26 @@
GEM
remote: https://rubygems.org/
specs:
nio4r (2.7.4)
puma (6.6.1)
nio4r (~> 2.0)
rack (3.2.0)
rackup (2.2.1)
rack (>= 3)
roda (3.95.0)
rack
PLATFORMS
arm64-darwin-24
ruby
DEPENDENCIES
puma
rackup
roda
RUBY VERSION
ruby 3.4.5p51
BUNDLED WITH
2.6.9

12
bin/services/ca/app.rb Normal file
View file

@ -0,0 +1,12 @@
require "roda"
class App < Roda
# automatically sets application/json and encodes Ruby objects
plugin :json
route do |r|
r.get "hello" do
{ message: "world" }
end
end
end

View file

@ -0,0 +1,2 @@
require_relative "app"
run App.freeze.app

0
bin/services/ca/make Executable file
View file

View file

@ -0,0 +1,9 @@
bundle exec rackup -p 9292 -o 0.0.0.0
RACK_ENV=production bundle exec rackup -p 8080 -o 0.0.0.0
curl http://0.0.0.0:9292/hello --verbose

View file

@ -17,9 +17,11 @@ subcommand = ARGV.shift&.to_sym
arg1 = ARGV[0] && ARGV[0] !~ /^-/ ? ARGV.shift : nil
arg2 = ARGV[0] && ARGV[0] !~ /^-/ ? ARGV.shift : nil
$domains = ["mediacenter.lan"]
$ips = ["192.168.0.94"]
# $domains = ["mediacenter.lan"]
# $ips = ["192.168.0.94"]
$domains = ["testing.self"]
$ips = ["127.0.0.2"]
$ips = []
### Setting up for client
$cn = $domains.first