Compare commits

...

43 Commits

Author SHA1 Message Date
f7da4a3b74 feat: use emissary 2023.10.22-stable.848.327226a
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-22 08:53:33 +00:00
f93a9cfaca feat: use emissary 2023.10.22-stable.750.fbf818e
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-22 07:54:58 +00:00
acc3c13249 feat: use emissary 2023.10.21-stable.1947.46a853a
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-21 19:52:19 +00:00
abd5cef671 feat: use emissary 2023.10.21-stable.1939.f31a63e
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-21 19:43:47 +00:00
b910fecb21 feat: use emissary 2023.10.20-stable.1539.c8a2303
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-20 15:44:02 +00:00
1ff432c20e feat: use emissary 2023.10.19-stable.2022.ced2658
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-20 09:07:04 +00:00
ae5caf88d3 feat: use emissary 2023.10.13-stable.1222.e756a60
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-13 12:27:28 +00:00
f165301856 feat: use emissary 2023.10.13-stable.1030.752f1ae
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-13 10:35:23 +00:00
50ce5a25ee feat: sentry integration
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-13 12:29:51 +02:00
b8a8c9257b fix: typo in agent config
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-10-12 23:00:35 +02:00
7608a983e6 feat: add *.itb upgrade firmware files
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-10-12 19:12:28 +02:00
28c2bf152c feat(bpi-r3): use openwrt 23.05.0-rc4
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-10-12 09:50:55 +02:00
707a8c6f30 feat: share common uci-defaults rule + add agent additional collectors
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-10-11 10:09:51 +02:00
4b5f2b63d0 feat(bpi-r3): add default firewall rules 2023-10-11 10:09:51 +02:00
ce0b211bfa feat: use emissary 2023.10.3-stable.538.9068203
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-10-03 05:43:03 +00:00
0fbae8a5ca feat: use emissary 2023.10.3-stable.410.a84fa05
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-10-03 04:14:55 +00:00
eaf60e139e feat: use emissary 2023.9.20-stable.1602.6318a8b
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-09-20 16:08:07 +00:00
c4d659a8fa feat(bpi-r3): use openwrt 23.05.0-rc3
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-30 11:36:25 -06:00
8038eb5c97 Merge pull request 'bananapi-r3' (#2) from bananapi-r3 into master
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
Reviewed-on: #2
Reviewed-by: wpetit <wpetit@cadoles.com>
2023-08-30 18:03:38 +02:00
b17355f36b docs: Corrected documentation related to Banana BPI hardware
All checks were successful
arcad/emissary-firmware/pipeline/pr-master This commit looks good
2023-08-30 16:57:01 +02:00
7bfb1982b7 ci: install python3-distutils in docker environment 2023-08-30 16:57:01 +02:00
490b5558a7 doc: refactor bpi hardware sheet 2023-08-30 16:57:01 +02:00
ce8460a277 doc: add make download-emissary-release in doc 2023-08-30 16:57:01 +02:00
7a300bdbf0 doc: create hardware-sheet for bananapi. doc use to discover hardware and install firmware on it only 2023-08-30 16:57:01 +02:00
86792b320e fix: clear default configuration by setting only requires 2023-08-30 16:57:01 +02:00
241d234ece fix: simplify firmware configuration. test => start, ssh access, emissary-agent, contact emissary server OK 2023-08-30 16:57:01 +02:00
e07c26e24d remise en état du fichier n'ayant pas besoin d'être modifié! 2023-08-30 16:57:01 +02:00
972aec6e6b feat(bpi-r3): default firmware ok. Lan ok, emissary install 2023-08-30 16:57:01 +02:00
f2d8692a4b feat: add basic bananapi r3 target 2023-08-30 16:57:01 +02:00
b0e9d61731 feat: use emissary 2023.8.25-stable.1853.3d7a094
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-08-25 18:59:44 +00:00
f0601b2028 feat: use emissary 2023.8.25-stable.1802.612f18a
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-25 18:06:34 +00:00
4edf42183f feat: use emissary 2023.8.25-stable.1652.077964c
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-25 16:59:31 +00:00
f6fd4979d8 ci: do not pull before updating emissary release version
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-25 10:59:11 -06:00
fca8010604 feat: use emissary v2023.8.25-14eecbf
Some checks failed
arcad/emissary-firmware/pipeline/head There was a failure building this commit
2023-08-25 15:36:04 +00:00
4c6226f47e feat: use emissary v2023.8.25-c51ac0a
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-25 15:14:08 +00:00
357af4b7cf feat: use emissary v2023.8.25-61ac5e8
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-25 15:05:04 +00:00
f2993c3667 feat: use emissary v2023.8.25-929394c
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-25 15:01:23 +00:00
5a3eeca071 ci: limit release to master branch
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-25 07:55:09 -06:00
4af7147a1a feat: use emissary v2023.8.25-a1ec5b8
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-08-25 13:29:53 +00:00
bec89173c1 doc: add missing command
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-08-02 06:41:25 -06:00
6f646ce7b7 doc: add firmware compilation tutorial
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-07-31 13:25:47 -06:00
9d0064ccfb feat: use emissary v2023.6.25-42d49eb
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-06-25 17:51:13 +00:00
3b981873cc feat: use emissary v2023.6.23-4217850
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-06-23 16:42:43 +00:00
26 changed files with 321 additions and 98 deletions

7
Jenkinsfile vendored
View File

@ -23,6 +23,7 @@ pipeline {
stage('Update emissary release') {
when {
branch 'master'
expression {
return params.emissaryRelease != 'latest'
}
@ -52,7 +53,6 @@ pipeline {
echo '${params.emissaryRelease}' > emissary_release.txt
git add emissary_release.txt
git commit -m "feat: use emissary ${params.emissaryRelease}"
git pull --rebase
git push origin \$(git rev-parse HEAD):${env.GIT_BRANCH}
"""
}
@ -60,7 +60,7 @@ pipeline {
}
}
stage('Build and release') {
stage('Build') {
steps {
script {
withCredentials([
@ -80,6 +80,9 @@ pipeline {
}
stage('Release') {
when {
branch 'master'
}
steps {
withCredentials([
usernamePassword([

View File

@ -15,8 +15,8 @@ BIN_DIR_NAME_SUFFIX ?=
IMAGEBUILDER_URL ?= https://downloads.openwrt.org/releases/$(OPENWRT_VERSION)/targets/$(OPENWRT_TARGET)/openwrt-imagebuilder-$(OPENWRT_VERSION)-$(OPENWRT_TARGET_DASHED).Linux-x86_64.tar.xz
IMAGEBUILDER_ARCHIVE_PATH := tmp/imagebuilder-$(OPENWRT_VERSION)-$(OPENWRT_TARGET_DASHED).tar.xz
IMAGEBUILDER_DIR_PATH := $(PWD)/imagebuilder/$(OPENWRT_VERSION)/$(OPENWRT_TARGET)
IMAGEBUILDER_ARCHIVE_PATH ?= tmp/imagebuilder-$(OPENWRT_VERSION)-$(OPENWRT_TARGET_DASHED).tar.xz
IMAGEBUILDER_DIR_PATH ?= $(PWD)/imagebuilder/$(OPENWRT_VERSION)/$(OPENWRT_TARGET)
IMAGEBUILDER_CUSTOM_PACKAGES_DIR_PATH := $(IMAGEBUILDER_DIR_PATH)/packages
IMAGEBUILDER_CUSTOM_FILES_DIR_PATH := $(IMAGEBUILDER_DIR_PATH)/files
@ -28,7 +28,7 @@ EMISSARY_ARCH ?= armv6
EMISSARY_RECONCILIATION_INTERVAL ?=
EMISSARY_SERVER_URL ?=
BASE_INSTALL ?= install-emissary-files
BASE_INSTALL ?= install-emissary-files install-common-uci-defaults install-common-additional-agent-collectors
ADDITIONAL_INSTALL ?=
ADDITIONAL_OPENWRT_PACKAGES ?=
@ -100,6 +100,7 @@ gitea-release: tools/gitea-release/bin/gitea-release.sh
\( -name '*.img.gz' \
-or -name '*.bin' \
-or -name '*.img' \
-or -name '*.itb' \
\) -exec cp {} .gitea-release/ \;
GITEA_RELEASE_PROJECT="emissary-firmware" \

View File

@ -1,7 +1,20 @@
# Documentation
## Structure du projet
```shell
doc/ # Documentation technique
install/ # Tâches Make d'installation spécifiques aux différentes cibles de construction
misc/ # Fichiers spécifiques aux différentes cibles de construction
targets/ # Tâches Make de définition des différentes cibles de construction
```
## Tutoriels
- [Premiers pas](./tutorials/first-steps.md)
- [Compiler un firmware](./tutorials/firmware-compilation.md)
- [Flasher une borne](./tutorials/device-flashing.md)
- [Flasher une borne](./tutorials/device-flashing.md)
## Fiches matériel
- [Banana Pi](./hardware/bananapi.md)

140
doc/hardware/bananapi.md Normal file
View File

@ -0,0 +1,140 @@
# BananaPi
![banana-rpi3](./../img/bpi-r3-case.jpg)
## Caractéristiques
- MediaTek MT7986(Filogic 830) Quad core ARM Cortex A53
- Wifi 6 2.4G/5GMT7976C
- 2G DDR RAM
- 8G eMMC flash
- 128MB Nand flash
- 2x 2.5GbE network port
- 1x M.2 Key B USB inerface
- 1x M.2 KEY M PCIe inerface
- 1x USB2.0 interface
- 1x Wan port (gigabit)
- 4x LAN port (gigabit)
## Installation
Par défaut, la borne est livrée sans système d'exploitation, ce qui rend impossible la procédure de flashage conventionnelle.
BPI fournit un logiciel qui permet de prendre un fichier .img et de le mettre en place sur une carte SD.
### Installation bpi-tools
Il est recommandé d'installer préalablement pv pour plus de commodité. (Disponible et validé sur Ubuntu et Manjaro)
```Shell
apt-get install pv
```
Pour installer bpi-tools sur votre machine, si vous ne pouvez pas accéder à l'URL via curl, rendez-vous sur le dépôt de bpi-tools et effectuez le processus manuellement.
```Shell
curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash
```
### Installation firmware avec emissary
Dans cet exemple, nous partirons de l'image OpenWrt avec Emissary suivante : ```openwrt-22.03.2-emissary-v2023.08.02-bec8917-bcm27xx-bcm2711-rpi-4-squashfs-factory.img```
1. Téléchargement de l'image : Téléchargez l'image depuis la [forge cadoles](https://forge.cadoles.com/arcad/emissary-firmware/releases)
Après le téléchargement, vous obtiendrez un fichier au format .gz.</br>
2. Extraction : Exécutez la commande suivante pour extraire l'image (remplacez les ```**``` par les détails spécifiques du fichier) : ```gunzip openwrt-**-emissary-***-****-**-**-rpi-4-squashfs-factory.img.gz```
3. Déplacement dans le dossier : Placez-vous dans le dossier contenant le fichier .img.
4. Connexion de la carte SD : Branchez la carte SD sur votre machine. Pour vérifier l'identification de la carte, vous pouvez utiliser la commande ```dmesg``` et examiner les dernières lignes (généralement /dev/sda).
5. Vérification du chemin d'accès : Confirmez le chemin d'accès à la carte SD (/dev/sd...).
6. Copie sur la carte SD : Lancez la copie sur la carte SD en utilisant la commande bpi-copy (remplacez le nom de l'image et le chemin d'accès à la carte SD) :
```Shell
sudo bpi-copy openwrt-22.03.2-emissary-v2023.08.02-bec8917-bcm27xx-bcm2711-rpi-4-squashfs-factory.img /dev/sda
```
Le résultat ressemblera à ceci :
```Shell
==============================================================
jeu. 03 août 2023 10:09:12 CEST
*** start COPY (blue led on ) .....
umount device: /dev/sda
umount /dev/sda1
umount /dev/sda2
==============================================================
IMGFILE=openwrt-22.03.2-emissary-v2023.08.02-bec8917-bcm27xx-bcm2711-rpi-4-squashfs-factory.img
==============================================================
img
8+1 enregistrements lus
8+1 enregistrements écrits
90475842 octets (90 MB, 86 MiB) copiés, 0,130052 s, 696 MB/s
86,3MiO 0:00:00 [ 648MiO/s] [ <=> ]
0+1381 enregistrements lus
0+1381 enregistrements écrits
*** end COPY (blue led off) .....
jeu. 03 août 2023 10:09:18 CEST
==============================================================
RUNTIME 0:6
OK!! You can remove the BOOTDISK /dev/sda now!!
```
Une fois la copie terminée, retirez la carte SD. Vous pouvez maintenant l'insérer dans le boîtier de destination.
Après avoir flashé la carte, assurez-vous que les commutateurs sont correctement positionnés (sélection du boot), insérez la carte SD et branchez la borne.
Connectez-vous à un port LAN du boîtier qui distribuera une adresse IP via DHCP. Vous pourrez ensuite utiliser SSH pour y accéder.
### OS pour banana-bpi fournit par bpi
Pour installer OpenWrt sur le BPI-R3, vous devez d'abord télécharger l'image ```bananapi_bpi-r3-sdcard.img.gz``` fourni par OpenWrt. Vous pouvez le télécharger depuis leur [page de téléchargement](https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/). Si vous ne trouvez pas le fichier directement, suivez ces indications :
1. Accédez à la page de téléchargement OpenWrt (cf image suivante).
2. Recherchez le dossier correspondant au modèle de votre matériel, dans ce cas bananapi_bpi-r3.
3. Téléchargez le fichier bananapi_bpi-r3-sdcard.img.gz.
![img](./../img/bpi-r3-download.png)
Après avoir téléchargé le fichier, vous pouvez continuer avec les étapes d'installation.
#### Flash du Firmware OpenWrt pour BPI
Suivez les étapes ci-dessous pour flasher la carte avec le firmware OpenWrt pour BPI :
1. Téléchargement de l'image : Si vous avez suivi les instructions précédentes, vous devriez avoir l'image de l'OS.
2. Extraction de l'image : Exécutez la commande suivante pour extraire l'image (remplacez les **** par les détails spécifiques du fichier) : ```gunzip bananapi_****.img.gz```
3. Placement de l'image : Placez-vous dans le dossier contenant le fichier .img.
4. Branchement de la carte SD : Branchez la carte SD sur votre machine. Pour vérifier son identification, utilisez ```dmesg``` et observez les dernières lignes (généralement sda).
5. Copie sur la carte SD : Lancez la copie sur la carte SD en utilisant la commande bpi-copy (remplacez les détails de l'image et le chemin d'accès à la carte SD) :
```Shell
sudo bpi-copy bananapi_bpi-r3-sdcard.img /dev/sda
```
Une fois la carte flashée, assurez-vous que le switch a tous ses jumpers orientés vers le haut (sélection du boot). Insérez ensuite la carte SD et branchez la borne.
Assurez-vous que votre carte réseau est configurée comme suit :
- Réseau : 192.168.1.0/24
- Passerelle : 192.168.1.1
Brancher votre câble RJ45 sur le port VLAN1, et connectez vous en ssh.(temps de boot moins de 30 secondes)
```Shell
ssh root@192.168.1.1
```
Pour la première connexion, aucun mot de passe n'est requis.
## FAQ
### Sélection du Système de Boot
Pour choisir le système de boot, il suffit de manipuler un switch composé de quatre jumpers. Par défaut, ils sont tous en position haute, ce qui configure le démarrage à partir de la carte microSD.
![schéma du switch](./../img/bpi-r3-switch.png)
### Noms des Périphériques Réseau
Par défaut, les périphériques réseau sont disposés et nommés comme suit :
![Lan](./../img/bpi-r3-lan-pic.jpg)

BIN
doc/img/bpi-r3-case.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

BIN
doc/img/bpi-r3-download.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
doc/img/bpi-r3-lan-pic.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
doc/img/bpi-r3-switch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,16 +1,94 @@
# Compiler un firmware
> TODO
## Compiler un firmware préconfiguré
L'ensemble des cibles de construction préconfigurés sont disponibles dans le répertoire `targets/`.
Par exemple:
```shell
# Exemple: construire un firmware OpenWRT
# Télécharger localement les dernières archive du projet emissary
make download-emissary-release
# Pour le routeur Linksys WRT1200AC
# Puis...
# ... pour le routeur Linksys WRT1200AC
make linksys-wrt1200ac
# Pour le routeur Linksys WRT1900AC
# ... ou pour le routeur Linksys WRT1900AC
make linksys-wrt1900ac
# Pourt le router Linksys WRT3200ACM
# ... ou pour le routeur Linksys WRT3200ACM
make linksys-wrt3200acm
```
```
## Créer une nouvelle cible de construction
Dans ce tutoriel, nous allons voir comment créer une nouvelle cible de construction pour un nouvel appareil, ici un [Banana Pi R3](https://wiki.banana-pi.org/Banana_Pi_BPI-R3).
### Créer la nouvelle tâche Make
1. Dans le répertoire `targets/`, créer le fichier `bananapi.mk`
```shell
touch targets/bananapi.mk
```
2. Éditer le fichier `targets/bananapi.mk` pour créer la nouvelle tâche Make
```makefile
# On ajoute notre nouvelle tâche "bpi-r3" en dépendance de la tâche
# principale "all"
all: bpi-r3
# On créait une nouvelle tâche "bpi-r3" permettant de construire le
# firmware pour notre BananaPi R3
bpi-r3:
$(MAKE) \
OPENWRT_VERSION="snapshot" \
IMAGEBUILDER_URL="https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-imagebuilder-mediatek-filogic.Linux-x86_64.tar.xz" \
ADDITIONAL_INSTALL="" \
OPENWRT_TARGET="mediatek/filogic" \
EMISSARY_ARCH="arm64" \
OPENWRT_PROFILE="bananapi_bpi-r3" \
build
```
**Explication des variables**
- `OPENWRT_VERSION`: Version d'OpenWRT à utiliser. _Normalement prédéfinie par le fichier `Makefile` principal mais ill est ici nécessaire de surcharger la variable car il n'existe à ce jour pas de version stable d'OpenWRT pour la BananaPi R3._
- `IMAGEBUILDER_URL`: URL à utiliser pour télécharger le "builder" OpenWRT. _Normalement prédéfinie par le fichier `Makefile` principal mais ill est ici nécessaire de surcharger la variable car il n'existe à ce jour pas de version stable d'OpenWRT pour la BananaPi R3._
- `ADDITIONAL_INSTALL`: Tâches Make d'installation supplémentaires à exécuter. Voir section suivante.
- `OPENWRT_TARGET`: "Cible" OpenWRT associée à l'appareil
- `EMISSARY_ARCH`: Architecture du binaire Emissary à déployer dans le firmware
- `OPENWRT_PROFILE`: "Profil" OpenWRT associé à l'appareil
3. Préparation.
Lancer la commande suivante pour télécharger (ou mettre à jours) les fichiers tar.gz nécessaire à la construction du firmware. Si cette commande n'a pas été exécutée au moins une fois, vous ne serez pas en mesure de construire le ou les firmwares nécessaires.
```shell
make download-emissary-release
```
4. Lancer la compilation du firmware
```shell
make bpi-r3
```
Les fichiers du firmware seront générés dans le répertoire `depot/bin/snapshot/mediatek/filogic/bananapi_bpi-r3/`
> 🛈 **Comment trouver les valeurs des variables `OPENWRT_TARGET` et `OPENWRT_PROFILE` ?**
>
> Après avoir trouvé votre appareil sur la [liste de compatibilité d'OpenWRT](https://openwrt.org/toh/start), rechercher l'URL de téléchargement du fichier du firmware, qui devrait ressembler à `https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-mediatek-filogic-bananapi_bpi-r3-sdcard.img.gz`.
>
> La valeur de `OPENWRT_TARGET` est la chaîne comprenant les 2 répertoires juste après `targets/`, ici `mediatek/filogic`.
>
> La valeur de `OPENWRT_PROFILE` est la chaîne comprise entre la cible OpenWRT et le type/extension dans le nom de fichier, ici `bananapi_bpi-r3`.
### Personnaliser votre firmware
Afin de personnaliser votre firmware, vous pouvez déclarer des nouvelles tâches Make dans le répertoire `install/` et ensuite les référencer dans la variable `ADDITIONAL_INSTALL`.
Vous pouvez prendre exemple sur le ficher `install/raspberrypi.mk` qui par exemple déploie des fichiers de configuration UCI par défaut ainsi que des scripts [`uci-defaults`](https://openwrt.org/docs/guide-developer/uci-defaults).

View File

@ -1 +1 @@
v2023.6.23-4a58847
2023.10.22-stable.848.327226a

3
install/bananapi.mk Normal file
View File

@ -0,0 +1,3 @@
install-bpi-r3-network-config:
mkdir -p files/etc/config
cp misc/bpi-r3/uci/network files/etc/config/network

6
install/common.mk Normal file
View File

@ -0,0 +1,6 @@
install-common-uci-defaults:
mkdir -p files/etc/uci-defaults
cp misc/common/uci-defaults/* files/etc/uci-defaults/
install-common-additional-agent-collectors: tools/yq/bin/yq
tools/yq/bin/yq -i '.agent.collectors += load("misc/common/agent/collectors.yml")' files/etc/emissary/agent.yml

View File

@ -31,6 +31,8 @@ install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
tools/yq/bin/yq -i '.agent.controllers.sysupgrade.firmwareVersionCommand = ["sh", "-c", "source /etc/emissary_firmware && echo \"$$FIRMWARE_VERSION\""]' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.app.dataDir = "/data/emissary/apps/data"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.app.downloadDir = "/data/emissary/apps/bundles"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.sentry.dsn = "$${EMISSARY_SENTRY_DSN}"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.sentry.environment = "$${EMISSARY_SENTRY_ENVIRONMENT}"' files/etc/emissary/agent.yml
# Copy emissary binary
mkdir -p files/usr/local/bin

View File

@ -1,7 +1,3 @@
install-rpi-network-config:
mkdir -p files/etc/config
cp misc/rpi/uci/network files/etc/config/network
install-rpi-uci-defaults:
mkdir -p files/etc/uci-defaults
cp misc/rpi/uci-defaults/* files/etc/uci-defaults/
cp misc/rpi/uci/network files/etc/config/network

24
misc/bpi-r3/uci/network Normal file
View File

@ -0,0 +1,24 @@
config interface 'lan'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
list ports 'sfp2'
option ip6assign '60'
config interface 'wan'
option type 'bridge'
list ports 'eth1'
list ports 'wan'
option proto 'dhcp'
config device
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

View File

@ -0,0 +1,9 @@
- name: network-interfaces
command: ip
args:
- addr
- show
- name: emissary-firmware
command: cat
args:
- /etc/emissary_firmware

View File

@ -2,4 +2,6 @@ package emissary
config main 'agent'
option reconciliation_interval '60'
option server_url 'https://emissary.cadol.es'
option server_url 'https://emissary.cadol.es'
option sentry_dsn ''
option sentry_environment ''

View File

@ -12,10 +12,12 @@ start_service() {
config_get emissary_reconciliation_interval agent 'reconciliation_interval' "60"
config_get emissary_server_url agent 'server_url' "https://emissary.cadol.es"
config_get emissary_sentry_dsn agent 'sentry_dsn' ""
config_get emissary_sentry_environment agent 'sentry_environment' ""
local config_file="/etc/emissary/agent.yml"
procd_open_instance emissary-agent
procd_set_param env EMISSARY_SERVER_URL="$emissary_server_url" EMISSARY_RECONCILIATION_INTERVAL="$emissary_reconciliation_interval"
procd_set_param env EMISSARY_SERVER_URL="$emissary_server_url" EMISSARY_RECONCILIATION_INTERVAL="$emissary_reconciliation_interval" EMISSARY_SENTRY_DSN="$emissary_sentry_dsn" EMISSARY_SENTRY_ENVIRONMENT="$emissary_sentry_environment"
procd_set_param command /usr/local/bin/emissary
procd_append_param command --workdir /usr/share/emissary
procd_append_param command --config "$config_file"

View File

@ -17,6 +17,12 @@ main() {
if [ ! -z "${EMISSARY_SERVER_URL}" ]; then
uci set "emissary.agent.server_url=${EMISSARY_SERVER_URL}"
fi
if [ ! -z "${EMISSARY_SENTRY_DSN}" ]; then
uci set "emissary.agent.sentry_dsn=${EMISSARY_SENTRY_DSN}"
fi
if [ ! -z "${EMISSARY_SENTRY_ENVIRONMENT}" ]; then
uci set "emissary.agent.sentry_environment=${EMISSARY_SENTRY_ENVIRONMENT}"
fi
# Commit modifications
uci commit

View File

@ -8,7 +8,7 @@ ARG https_proxy=
# Install dev environment dependencies
RUN export DEBIAN_FRONTEND=noninteractive &&\
apt-get update -y &&\
apt-get install -y --no-install-recommends curl ca-certificates build-essential wget unzip tar git jq gawk python3 rsync file
apt-get install -y --no-install-recommends curl ca-certificates build-essential wget unzip tar git jq gawk python3 rsync file python3-distutils
# Add LetsEncrypt certificates
RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash

View File

@ -1,37 +0,0 @@
#/bin/sh
set -e
main() {
# Update default firewall ruleset
uci add firewall rule
uci set firewall.@rule[-1].name='Allow SSH on WAN'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].dest_port='22'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow HTTP on WAN'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].dest_port='80'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow HTTPS on WAN'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].dest_port='443'
uci set firewall.@rule[-1].target='ACCEPT'
uci commit firewall
# Disable DNS-rebind protection
uci set dhcp.@dnsmasq[0].rebind_protection='0'
uci commit dhcp
reload_config
}
main

View File

@ -1,37 +0,0 @@
#/bin/sh
set -e
main() {
# Update default firewall ruleset
uci add firewall rule
uci set firewall.@rule[-1].name='Allow SSH on WAN'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].dest_port='22'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow HTTP on WAN'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].dest_port='80'
uci set firewall.@rule[-1].target='ACCEPT'
uci add firewall rule
uci set firewall.@rule[-1].name='Allow HTTPS on WAN'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].dest_port='443'
uci set firewall.@rule[-1].target='ACCEPT'
uci commit firewall
# Disable DNS-rebind protection
uci set dhcp.@dnsmasq[0].rebind_protection='0'
uci commit dhcp
reload_config
}
main

12
targets/bananapi.mk Normal file
View File

@ -0,0 +1,12 @@
all: bpi-r3
bpi-r3:
$(MAKE) \
OPENWRT_VERSION="23.05.0-rc4" \
IMAGEBUILDER_URL=https://downloads.openwrt.org/releases/23.05.0-rc4/targets/mediatek/filogic/openwrt-imagebuilder-23.05.0-rc4-mediatek-filogic.Linux-x86_64.tar.xz \
ADDITIONAL_INSTALL="install-bpi-r3-network-config" \
ADDITIONAL_OPENWRT_PACKAGES="block-mount kmod-fs-ext4 kmod-usb-storage kmod-usb2" \
OPENWRT_TARGET="mediatek/filogic" \
EMISSARY_ARCH="arm64" \
OPENWRT_PROFILE="bananapi_bpi-r3" \
build

View File

@ -2,7 +2,7 @@ all: x86-generic
x86-generic:
$(MAKE) \
ADDITIONAL_INSTALL="install-x86-network-config install-x86-uci-defaults" \
ADDITIONAL_INSTALL="install-x86-network-config" \
ADDITIONAL_OPENWRT_PACKAGES="dmidecode" \
OPENWRT_TARGET="x86/generic" \
EMISSARY_ARCH="386" \

View File

@ -2,7 +2,7 @@ all: rpi-4 rpi-3
rpi-4:
$(MAKE) \
ADDITIONAL_INSTALL="install-rpi-network-config install-rpi-uci-defaults" \
ADDITIONAL_INSTALL="install-rpi-network-config" \
OPENWRT_TARGET="bcm27xx/bcm2711" \
EMISSARY_ARCH="arm64" \
OPENWRT_PROFILE="rpi-4" \
@ -10,7 +10,7 @@ rpi-4:
rpi-3:
$(MAKE) \
ADDITIONAL_INSTALL="install-rpi-network-config install-rpi-uci-defaults" \
ADDITIONAL_INSTALL="install-rpi-network-config" \
OPENWRT_TARGET="bcm27xx/bcm2710" \
EMISSARY_ARCH="arm64" \
OPENWRT_PROFILE="rpi-3" \