Build script update, ssh and signign keys

This commit is contained in:
Giulio 2020-05-22 18:10:12 +02:00
parent b08fa47aeb
commit 6f99b444a6
2 changed files with 40 additions and 24 deletions

View File

@ -5,17 +5,33 @@
echo "[+] Starting build script..." echo "[+] Starting build script..."
mkdir -p target/overlay/var/www/html mkdir -p target/overlay/var/www/html
echo "[+] Cloning buildroot" echo "[+] Cloning buildroot"
git clone https://github.com/buildroot/buildroot.git target/buildroot git clone https://github.com/buildroot/buildroot.git target/buildroot
echo "[+] Building the keygen"
mkdir -p conf/usr/sbin
gcc -lm -static -o conf/usr/sbin/cfgbin keygen/keygen.c
strip conf/usr/sbin/cfgbin
echo "[+] Adding customization files" echo "[+] Adding customization files"
cp -R buildroot/* target/buildroot # copy buildroot configs cp -R buildroot/* target/buildroot # copy buildroot configs
cp -R conf/* target/overlay # copy target system config files cp -R conf/* target/overlay # copy target system config files
cp -R webpanel/* target/overlay/var/www/html # copy the webpanel cp -R webpanel/* target/overlay/var/www/html # copy the webpanel
cp -R update/* target/overlay #copy the update script and certificate cp -R update/* target/overlay #copy the update script and certificate
echo "[+] Building the keygen"
mkdir -p target/overlay/usr/sbin
gcc -lm -static -o target/overlay/usr/sbin/cfgbin keygen/keygen.c
strip target/overlay/usr/sbin/cfgbin
echo "[+] Generating Update Key"
mkdir -p target/keys
openssl genrsa -out target/keys/signingkey.pem 2048
openssl rsa -in target/keys/signingkey.pem -outform PEM -pubout -out target/keys/signingpub.pem
cp target/keys/signingpub.pem target/overlay/pub.pem
echo "[+] Generating Monitoring SSH Key"
ssh-keygen -t ecdsa -f target/keys/sshkey -q -N ""
mkdir -p target/overlay/root/.ssh
cp target/keys/sshkey target/overlay/root/.ssh/authorized_keys
chmod -R 600 target/overlay/root/.ssh/
echo "[+] Building the image" echo "[+] Building the image"
N=`grep -c '^processor' /proc/cpuinfo` N=`grep -c '^processor' /proc/cpuinfo`
cd target/buildroot cd target/buildroot

View File

@ -7,8 +7,8 @@ case "$1" in
test -f /etc/serial || exit 0 test -f /etc/serial || exit 0
test -f /etc/ssid || exit 0 test -f /etc/ssid || exit 0
test -f /etc/wpa || exit 0 test -f /etc/wpa || exit 0
$SSID=`cat /etc/ssid` SSID=`cat /etc/ssid`
$WPA=`cat /etc/wpa` WPA=`cat /etc/wpa`
sed -i "s/{{SSID}}/$SSID/g" /etc/hostapd.conf sed -i "s/{{SSID}}/$SSID/g" /etc/hostapd.conf
sed -i "s/{{WPA}}/$WPA/g" /etc/hostapd.conf sed -i "s/{{WPA}}/$WPA/g" /etc/hostapd.conf
;; ;;