cybertrust-bridge 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ include README.md
2
+ recursive-include docs *.md
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: cybertrust-bridge
3
+ Version: 0.1.0
4
+ Summary: CyberTrust Bridge — the mail-carrier side of the Wazuh Bridge: receives the Android app's chained posture events inside PRoot/Termux and feeds them to your own Wazuh agent.
5
+ Author: Signal True
6
+ Project-URL: Documentation, https://pypi.org/project/cybertrust-bridge/
7
+ Keywords: wazuh,android,security,siem,cybertrust,proot,termux
8
+ Classifier: Intended Audience :: System Administrators
9
+ Classifier: Topic :: System :: Monitoring
10
+ Classifier: Topic :: System :: Logging
11
+ Classifier: Environment :: Console
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+
17
+ # cybertrust-bridge
18
+
19
+ **The mail-carrier side of CyberTrust Bridge.**
20
+
21
+ Wazuh has no official Android agent. The CyberTrust Bridge Android app is
22
+ the *eyes* (it observes the phone's posture in the real Android system);
23
+ this package is the *mail carrier* that runs inside PRoot/Termux next to a
24
+ standard Wazuh agent: it receives the app's events, verifies their SHA-256
25
+ hash chain, writes them to the bridge journal, and generates the Wazuh
26
+ *logcollector* snippet that makes the agent deliver the journal to **your**
27
+ Wazuh manager. Nothing goes anywhere else.
28
+
29
+ ## Install
30
+
31
+ ```sh
32
+ pip install cybertrust-bridge
33
+ ```
34
+
35
+ ## Quickstart
36
+
37
+ ```sh
38
+ # 1. Receive the app's events (localhost UDP) into the bridge journal
39
+ cybertrust-bridge recevoir --voie udp --port 5514 --journal /root/bridge/journal.jsonl
40
+
41
+ # 2. Generate the logcollector snippet for /var/ossec/etc/ossec.conf
42
+ cybertrust-bridge configurer-agent --journal /root/bridge/journal.jsonl
43
+
44
+ # 3. Check the bridge at any time (chain, last heartbeat, "pont muet")
45
+ cybertrust-bridge statut --journal /root/bridge/journal.jsonl
46
+
47
+ # 4. Self-bench of the channel contract (100 events, chain verified)
48
+ cybertrust-bridge banc --voie fichier
49
+ ```
50
+
51
+ ## The contract
52
+
53
+ One JSON object per line: `ts`, `type`, `seq` (monotone), `data`, and
54
+ `prev` = truncated SHA-256 of the previous line. Closed event catalogue
55
+ (`bridge.heartbeat`, `posture.snapshot`, `app.installed`, `device.metrics`,
56
+ `app.crash`, `app.anr`, `bugreport.ingested`, …), 4 KB max per line,
57
+ bounded rotating journal. The same contract is implemented by the Android
58
+ app — the contract is the product.
59
+
60
+ **Full guide** (why, installation step by step, verification,
61
+ troubleshooting, limits and privacy): see `docs/GUIDE.md`
62
+ (Français : `docs/GUIDE.fr.md` ; 中文 : `docs/GUIDE.zh-Hans.md`).
63
+
64
+ Standard library only. No dependency, no telemetry, no cloud.
@@ -0,0 +1,48 @@
1
+ # cybertrust-bridge
2
+
3
+ **The mail-carrier side of CyberTrust Bridge.**
4
+
5
+ Wazuh has no official Android agent. The CyberTrust Bridge Android app is
6
+ the *eyes* (it observes the phone's posture in the real Android system);
7
+ this package is the *mail carrier* that runs inside PRoot/Termux next to a
8
+ standard Wazuh agent: it receives the app's events, verifies their SHA-256
9
+ hash chain, writes them to the bridge journal, and generates the Wazuh
10
+ *logcollector* snippet that makes the agent deliver the journal to **your**
11
+ Wazuh manager. Nothing goes anywhere else.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ pip install cybertrust-bridge
17
+ ```
18
+
19
+ ## Quickstart
20
+
21
+ ```sh
22
+ # 1. Receive the app's events (localhost UDP) into the bridge journal
23
+ cybertrust-bridge recevoir --voie udp --port 5514 --journal /root/bridge/journal.jsonl
24
+
25
+ # 2. Generate the logcollector snippet for /var/ossec/etc/ossec.conf
26
+ cybertrust-bridge configurer-agent --journal /root/bridge/journal.jsonl
27
+
28
+ # 3. Check the bridge at any time (chain, last heartbeat, "pont muet")
29
+ cybertrust-bridge statut --journal /root/bridge/journal.jsonl
30
+
31
+ # 4. Self-bench of the channel contract (100 events, chain verified)
32
+ cybertrust-bridge banc --voie fichier
33
+ ```
34
+
35
+ ## The contract
36
+
37
+ One JSON object per line: `ts`, `type`, `seq` (monotone), `data`, and
38
+ `prev` = truncated SHA-256 of the previous line. Closed event catalogue
39
+ (`bridge.heartbeat`, `posture.snapshot`, `app.installed`, `device.metrics`,
40
+ `app.crash`, `app.anr`, `bugreport.ingested`, …), 4 KB max per line,
41
+ bounded rotating journal. The same contract is implemented by the Android
42
+ app — the contract is the product.
43
+
44
+ **Full guide** (why, installation step by step, verification,
45
+ troubleshooting, limits and privacy): see `docs/GUIDE.md`
46
+ (Français : `docs/GUIDE.fr.md` ; 中文 : `docs/GUIDE.zh-Hans.md`).
47
+
48
+ Standard library only. No dependency, no telemetry, no cloud.
@@ -0,0 +1,276 @@
1
+ # CyberTrust Bridge — Guide complet
2
+
3
+ *Une seule source, deux surfaces : ce guide est livré dans le paquet Python
4
+ `cybertrust-bridge` et dans l'application Android CyberTrust Bridge (section
5
+ Guide du rotor). Hors captures d'écran, le texte est identique.*
6
+
7
+ ---
8
+
9
+ ## 1. Pourquoi ça existe
10
+
11
+ Wazuh est une plateforme de sécurité open source puissante (un manager qui
12
+ collecte journaux et alertes de vos machines), mais **Wazuh ne publie aucun
13
+ agent officiel pour Android**. Votre téléphone est donc invisible pour votre
14
+ manager Wazuh.
15
+
16
+ Un contournement fréquent consiste à installer l'agent Linux Wazuh dans
17
+ **PRoot** (un environnement Linux en espace utilisateur, habituellement via
18
+ Termux). Cet agent fonctionne — mais il ne voit que son propre bac à sable :
19
+ le petit système Linux à l'intérieur de PRoot. Il ne voit pas le vrai
20
+ téléphone : ni la version d'Android ou le niveau de correctif de sécurité,
21
+ ni les applications installées ou supprimées, ni les réglages qui comptent
22
+ pour la sécurité. Et Android peut le tuer en silence pour économiser la
23
+ batterie.
24
+
25
+ CyberTrust Bridge corrige cela avec trois rôles, chacun ne faisant que son
26
+ travail :
27
+
28
+ - **L'application Android, ce sont les yeux.** Elle vit dans le vrai système
29
+ Android et observe la *posture* du téléphone (version du système, niveau de
30
+ correctif, installations/suppressions d'applications, réglages de sécurité
31
+ choisis, son propre battement de cœur).
32
+ - **Le pont est un journal local.** L'application écrit des événements en
33
+ lignes JSON, chaque ligne chaînée à la précédente par un hachage SHA-256 :
34
+ une ligne manquante ou modifiée se détecte. Sur le transport vivant, chaque
35
+ ligne est aussi envoyée en local (UDP 127.0.0.1) au récepteur ci-dessous.
36
+ - **L'agent Wazuh est le facteur.** Le récepteur `cybertrust-bridge`, qui
37
+ tourne dans PRoot, rassemble les lignes de l'application dans le fichier
38
+ journal, et l'agent Wazuh ordinaire — par son *logcollector* standard —
39
+ ramasse le journal et le livre à **votre** manager Wazuh, sous sa propre
40
+ identité enrôlée.
41
+
42
+ Rien n'est envoyé ailleurs. Il n'y a ni nuage CyberTrust, ni serveur tiers,
43
+ ni télémétrie sur vous : la seule destination est le manager Wazuh auprès
44
+ duquel **vous** avez enrôlé l'agent.
45
+
46
+ ## 2. Comment ça marche, en mots simples
47
+
48
+ ```
49
+ Application CyberTrust Bridge Termux / PRoot (Debian) Votre serveur
50
+ ┌──────────────────┐ UDP ┌────────────────────────┐ protocole ┌─────────┐
51
+ │ posture du │ 127.0.0.1 │ cybertrust-bridge │ de l'agent│ Wazuh │
52
+ │ téléphone, │ ────────► │ recevoir → journal │ ────────► │ manager │
53
+ │ événements JSON │ :5514 │ logcollector de l'agent│ │ │
54
+ └──────────────────┘ └────────────────────────┘ └─────────┘
55
+ les yeux le facteur votre tour
56
+ ```
57
+
58
+ Types d'événements que l'application peut émettre (catalogue fermé — rien
59
+ d'autre n'existe) : `bridge.heartbeat` (toutes les 15 minutes),
60
+ `posture.snapshot` (au démarrage, puis chaque jour), `posture.change`,
61
+ `app.installed`, `app.removed`, `app.updated`, `app.permissions`,
62
+ `security.setting`, `network.change` (les identifiants réseau sont hachés,
63
+ jamais en clair), `device.boot`, `bridge.selftest` et `bugreport.ingested`
64
+ (voir §5). Chaque ligne porte un horodatage, un numéro de séquence monotone
65
+ et le hachage de la ligne précédente.
66
+
67
+ L'application rapporte aussi des **métriques d'appareil** — des nombres
68
+ brefs, aucune donnée personnelle :
69
+
70
+ - `device.metrics` — émis avec le battement de cœur, au moins une fois par
71
+ heure : RAM totale et disponible plus le drapeau de mémoire basse du
72
+ système, stockage total et libre du volume de données, niveau / température
73
+ / santé de la batterie, et temps de fonctionnement de l'appareil.
74
+ - `device.pressure` — seulement quand quelque chose change : pression
75
+ mémoire système (demandes de libération au niveau « running low » ou pire),
76
+ stockage bas, et retour à la normale.
77
+ - `app.crash` — un plantage de **l'application Bridge elle-même** : avant de
78
+ mourir, l'application écrit un événement avec le type d'exception et une
79
+ empreinte SHA-256 tronquée de la pile (jamais la pile complète, jamais de
80
+ données d'usager). Au démarrage suivant, elle émet `bridge.recovered` avec
81
+ le nombre de plantages en attente de rapport.
82
+ - `app.anr` — l'application Bridge elle-même ne répond plus (« Application
83
+ Not Responding ») : un fil watchdog surveille le battement du fil
84
+ principal ; si le fil principal reste bloqué plus de 5 secondes, le
85
+ watchdog — qui écrit depuis son propre fil, jamais depuis le fil bloqué —
86
+ consigne la durée du blocage et une empreinte SHA-256 tronquée de la pile
87
+ du fil principal (jamais la pile complète).
88
+
89
+ ## 3. Installation, dans l'ordre
90
+
91
+ Faites les étapes dans cet ordre. Les valeurs d'exemple sont marquées comme
92
+ telles — remplacez-les par les vôtres. Ne copiez **jamais** les adresses ou
93
+ les noms de l'installation de quelqu'un d'autre.
94
+
95
+ ### Étape A — Installer Termux via F-Droid
96
+
97
+ Installez **F-Droid** (depuis f-droid.org), puis installez **Termux** depuis
98
+ F-Droid.
99
+
100
+ > N'utilisez **pas** la version Play Store de Termux : elle est désuète et
101
+ > n'est plus maintenue. La version F-Droid est celle qui fonctionne.
102
+
103
+ ### Étape B — Installer Python et PRoot-Distro dans Termux
104
+
105
+ Ouvrez Termux et lancez :
106
+
107
+ ```sh
108
+ pkg update
109
+ pkg install python proot-distro
110
+ proot-distro install debian
111
+ ```
112
+
113
+ (`debian` est l'exemple de ce guide ; une autre distribution convient aussi,
114
+ tant que le paquet d'agent Wazuh existe pour elle.) Entrez dans la
115
+ distribution :
116
+
117
+ ```sh
118
+ proot-distro login debian
119
+ ```
120
+
121
+ Toutes les étapes suivantes se font **dans** cette session PRoot, sauf
122
+ mention contraire.
123
+
124
+ ### Étape C — Installer et enrôler l'agent Wazuh (dans PRoot)
125
+
126
+ Installez l'agent Wazuh depuis le dépôt officiel Wazuh (Debian, arm64) :
127
+
128
+ ```sh
129
+ apt-get update && apt-get install -y curl gnupg
130
+ curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import
131
+ chmod 644 /usr/share/keyrings/wazuh.gpg
132
+ echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" > /etc/apt/sources.list.d/wazuh.list
133
+ apt-get update
134
+ ```
135
+
136
+ Enrôlez l'agent auprès de **votre** manager. Remplacez l'adresse d'exemple
137
+ `192.168.1.10` par l'adresse de votre manager, et `my-phone` par le nom
138
+ d'agent que vous voulez voir dans votre console :
139
+
140
+ ```sh
141
+ WAZUH_MANAGER="192.168.1.10" WAZUH_AGENT_NAME="my-phone" apt-get install -y wazuh-agent
142
+ ```
143
+
144
+ Si votre manager exige une clé ou un mot de passe d'enrôlement, suivez la
145
+ procédure d'enrôlement de votre propre manager — l'agent est un agent Wazuh
146
+ tout à fait standard ; Bridge ne change rien à l'enrôlement. Démarrez-le :
147
+
148
+ ```sh
149
+ /var/ossec/bin/wazuh-control start
150
+ ```
151
+
152
+ (PRoot n'a pas systemd ; `wazuh-control` est la voie.)
153
+
154
+ ### Étape D — Installer le récepteur Bridge (dans PRoot)
155
+
156
+ ```sh
157
+ pip install cybertrust-bridge
158
+ ```
159
+
160
+ ### Étape E — Lancer le récepteur et brancher l'agent sur le journal
161
+
162
+ Choisissez un chemin de journal dans PRoot, par exemple
163
+ `/root/bridge/journal.jsonl` (créez d'abord le dossier :
164
+ `mkdir -p /root/bridge`).
165
+
166
+ Démarrez le récepteur — il écoute en UDP local et ajoute chaque ligne
167
+ vérifiée au journal :
168
+
169
+ ```sh
170
+ cybertrust-bridge recevoir --voie udp --port 5514 --journal /root/bridge/journal.jsonl
171
+ ```
172
+
173
+ Laissez-le tourner (par exemple dans une session Termux dédiée). Générez
174
+ ensuite le snippet logcollector qui dit à l'agent Wazuh de suivre ce
175
+ journal :
176
+
177
+ ```sh
178
+ cybertrust-bridge configurer-agent --journal /root/bridge/journal.jsonl
179
+ ```
180
+
181
+ Copiez le bloc `<localfile>` imprimé dans la configuration de l'agent,
182
+ `/var/ossec/etc/ossec.conf`, à l'intérieur de la section `<ossec_config>`.
183
+
184
+ ### Étape F — Redémarrer l'agent
185
+
186
+ ```sh
187
+ /var/ossec/bin/wazuh-control restart
188
+ ```
189
+
190
+ ### Étape G — Installer l'application Android
191
+
192
+ Installez l'application **CyberTrust Bridge** sur le téléphone, ouvrez-la et
193
+ démarrez le service Bridge depuis la page d'accueil. Au besoin, exemptez
194
+ **Termux** et l'application **CyberTrust Bridge** de l'optimisation de
195
+ batterie (Réglages Android → Applications → Accès spécial → Optimisation de
196
+ la batterie) pour qu'Android ne les tue pas en silence — voir Dépannage.
197
+
198
+ ## 4. Vérification
199
+
200
+ 1. Dans l'application, ouvrez la section **Journal** et touchez **Selftest**.
201
+ L'application écrit un événement `bridge.selftest`.
202
+ 2. En moins d'une minute, cet événement doit voyager : application →
203
+ récepteur (regardez sa sortie) → fichier journal → agent → votre manager.
204
+ Dans votre tableau de bord Wazuh, cherchez `bridge.selftest` dans les
205
+ archives/alertes de l'agent.
206
+ 3. L'application émet aussi un `bridge.heartbeat` toutes les 15 minutes. Si
207
+ les battements cessent pendant plus de 45 minutes, traitez-le comme une
208
+ alerte en soi — le silence signifie que quelque chose est mort (voir
209
+ ci-dessous). Côté PRoot,
210
+ `cybertrust-bridge statut --journal /root/bridge/journal.jsonl` montre le
211
+ dernier numéro de séquence, la validité de la chaîne et l'âge du dernier
212
+ battement.
213
+
214
+ **Si rien n'arrive, vérifiez dans cet ordre :**
215
+
216
+ - **Le récepteur tourne-t-il encore ?** Les sessions Termux meurent quand
217
+ Android tue Termux. Rouvrez Termux, rentrez dans PRoot, relancez
218
+ `recevoir`. Exemptez Termux de l'optimisation de batterie.
219
+ - **L'agent tourne-t-il ?** `/var/ossec/bin/wazuh-control status`.
220
+ Redémarrez-le au besoin.
221
+ - **Le chemin de journal est-il le même partout ?** Le chemin donné à
222
+ `recevoir --journal`, celui du snippet `<localfile>` dans `ossec.conf` et
223
+ celui que vous vérifiez avec `statut` doivent être identiques, caractère
224
+ pour caractère.
225
+ - **Le service de l'application tourne-t-il ?** L'application montre l'état
226
+ de son service sur sa page d'accueil ; son journal local (section Journal)
227
+ continue de grandir même si le transport est tombé — les événements sont
228
+ chaînés, donc les trous sont visibles, jamais silencieux.
229
+
230
+ ## 5. Rapports de bogue (module optionnel)
231
+
232
+ Un **rapport de bogue** Android (le zip généré par le système : dumpsys,
233
+ logcat, journaux noyau) est la radiographie la plus profonde qu'Android
234
+ offre sans root, et il révèle parfois de vraies failles de sécurité. Dans la
235
+ section **Bug Report** de l'application, vous pouvez partager un rapport de
236
+ bogue **vers** l'application Bridge (générez-le depuis les Options
237
+ développeur ou le menu d'alimentation, puis partagez-le vers CyberTrust
238
+ Bridge). L'application conserve le zip **sur le téléphone seulement**, le
239
+ hache (SHA-256) et émet un seul événement `bugreport.ingested` portant le
240
+ hachage, la taille et la source — **le rapport brut ne transite jamais par
241
+ le pont et ne quitte jamais le téléphone.** Les constats de sécurité
242
+ distillés, tirés d'une analyse locale, viendront dans une version
243
+ ultérieure ; la v0.1 ingère et donne un reçu, elle ne prétend pas analyser.
244
+
245
+ ## 6. Limites et vie privée
246
+
247
+ - **Aucun root, jamais.** Le Bridge fonctionne entièrement dans le modèle de
248
+ permissions normal d'Android. Si une version future demande root, ce n'est
249
+ pas ce produit.
250
+ - **La posture, pas le contenu.** L'application observe la posture du
251
+ système et le cycle de vie des applications. Elle ne lit ni les données
252
+ des autres applications, ni les messages, ni les fichiers, ni ce que vous
253
+ tapez.
254
+ - **Les rapports de bogue restent sur le téléphone** (voir §5). Les exporter
255
+ est toujours votre geste explicite, jamais automatique.
256
+ - **Une seule destination :** votre propre manager Wazuh, via votre propre
257
+ agent enrôlé. Aucun tiers ne reçoit quoi que ce soit.
258
+ - **Limites honnêtes :** pas de capture réseau, pas de logcat système
259
+ complet, et Android peut quand même suspendre le travail d'arrière-plan —
260
+ le battement de cœur existe précisément pour que ce silence soit visible
261
+ au lieu d'être caché.
262
+ - **Les plantages de qui ?** En mode standard, le Bridge rapporte **ses
263
+ propres** plantages, les signaux de pression système et les métriques
264
+ d'appareil — rien de plus. Les plantages détaillés des **autres**
265
+ applications ne sont visibles que par le module Bug Report (tombstones,
266
+ §5) ou en mode propriétaire d'appareil (device owner). Même chose pour les
267
+ ANR (« l'application ne répond pas ») : le Bridge détecte **ses propres**
268
+ ANR avec son watchdog ; les traces ANR des autres applications ne vivent
269
+ que dans les rapports de bogue (§5). Le Bridge ne prétend pas à une
270
+ visibilité qu'il n'a pas.
271
+
272
+ ---
273
+
274
+ *CyberTrust Bridge v0.1 — Signal True / CyberTrust. Le contrat est le
275
+ produit : mêmes événements, même chaîne de hachage, même catalogue fermé sur
276
+ les deux surfaces (ce paquet et l'application Android).*
@@ -0,0 +1,255 @@
1
+ # CyberTrust Bridge — Complete Guide
2
+
3
+ *One source, two surfaces: this guide is shipped inside the `cybertrust-bridge`
4
+ Python package and inside the CyberTrust Bridge Android app (Guide section of
5
+ the rotor). Screenshots aside, the text is identical.*
6
+
7
+ ---
8
+
9
+ ## 1. Why this exists
10
+
11
+ Wazuh is a powerful open-source security platform (a manager that collects
12
+ logs and alerts from your machines), but **Wazuh publishes no official agent
13
+ for Android**. Your phone is therefore invisible to your Wazuh manager.
14
+
15
+ A common workaround is to install the Linux Wazuh agent inside **PRoot** (a
16
+ user-space Linux environment, usually run through Termux). That agent works —
17
+ but it only sees its own sandbox: the little Linux system inside PRoot. It
18
+ cannot see the real phone: not the Android version or security patch level,
19
+ not which apps get installed or removed, not the device settings that matter
20
+ for security. And Android may silently kill it to save battery.
21
+
22
+ CyberTrust Bridge fixes this with three roles, each doing only its own job:
23
+
24
+ - **The Android app is the eyes.** It lives in the real Android system and
25
+ observes the phone's *posture* (system version, patch level, app install /
26
+ removal events, selected security settings, its own heartbeat).
27
+ - **The bridge is a local journal.** The app writes events as JSON lines,
28
+ each line chained to the previous one with a SHA-256 hash, so a missing or
29
+ edited line is detectable. On the live transport, each line is also sent
30
+ over localhost (UDP 127.0.0.1) to the receiver below.
31
+ - **The Wazuh agent is the mail carrier.** The `cybertrust-bridge` receiver
32
+ running inside PRoot collects the app's lines into the journal file, and
33
+ the ordinary Wazuh agent — through its standard *logcollector* — picks the
34
+ journal up and delivers it to **your** Wazuh manager, under the agent's own
35
+ enrolled identity.
36
+
37
+ Nothing is sent anywhere else. There is no CyberTrust cloud, no third-party
38
+ server, no telemetry about you: the only destination is the Wazuh manager
39
+ **you** enrolled the agent with.
40
+
41
+ ## 2. How it works, in plain words
42
+
43
+ ```
44
+ CyberTrust Bridge app Termux / PRoot (Debian) Your server
45
+ ┌──────────────────┐ UDP ┌────────────────────────┐ agent ┌─────────┐
46
+ │ posture of the │ 127.0.0.1 │ cybertrust-bridge │ protocol │ Wazuh │
47
+ │ phone, events as │ ────────► │ recevoir → journal │ ────────► │ manager │
48
+ │ chained JSON │ :5514 │ Wazuh agent logcollector│ │ │
49
+ └──────────────────┘ └────────────────────────┘ └─────────┘
50
+ the eyes the mail carrier your tower
51
+ ```
52
+
53
+ Event types the app may emit (a closed catalogue — nothing else exists):
54
+ `bridge.heartbeat` (every 15 minutes), `posture.snapshot` (at start, then
55
+ daily), `posture.change`, `app.installed`, `app.removed`, `app.updated`,
56
+ `app.permissions`, `security.setting`, `network.change` (network identifiers
57
+ are hashed, never in clear text), `device.boot`, `bridge.selftest`, and
58
+ `bugreport.ingested` (see §5). Every line carries a timestamp, a monotone
59
+ sequence number, and the hash of the previous line.
60
+
61
+ The app also reports **device metrics** — brief numbers, no personal data:
62
+
63
+ - `device.metrics` — emitted with the heartbeat, at least once an hour:
64
+ total and available RAM plus the system low-memory flag, total and free
65
+ storage on the data volume, battery level / temperature / health, and the
66
+ device uptime.
67
+ - `device.pressure` — only when something changes: system memory pressure
68
+ (trim requests at "running low" level or worse), low storage, and the
69
+ return to normal.
70
+ - `app.crash` — a crash of **the Bridge app itself**: before dying, the app
71
+ writes one event with the exception type and a truncated SHA-256
72
+ fingerprint of the stack trace (never the full stack, never user data).
73
+ On the next start it emits `bridge.recovered` with the number of crashes
74
+ that were waiting to be reported.
75
+ - `app.anr` — the Bridge app itself stopped responding ("Application Not
76
+ Responding"): a watchdog thread watches the main thread's heartbeat; if
77
+ the main thread stays blocked for more than 5 seconds, the watchdog —
78
+ writing from its own thread, never from the blocked one — records the
79
+ block duration and a truncated SHA-256 fingerprint of the main thread's
80
+ stack (never the full stack).
81
+
82
+ ## 3. Installation, in order
83
+
84
+ Do the steps in this order. Example values are marked as examples — replace
85
+ them with your own. **Never** copy addresses or names from anyone else's
86
+ setup.
87
+
88
+ ### Step A — Install Termux from F-Droid
89
+
90
+ Install **F-Droid** (from f-droid.org), then install **Termux** from F-Droid.
91
+
92
+ > Do **not** use the Play Store version of Termux: it is outdated and no
93
+ > longer maintained. The F-Droid build is the working one.
94
+
95
+ ### Step B — Install Python and PRoot-Distro in Termux
96
+
97
+ Open Termux and run:
98
+
99
+ ```sh
100
+ pkg update
101
+ pkg install python proot-distro
102
+ proot-distro install debian
103
+ ```
104
+
105
+ (`debian` is the example used in this guide; another distribution works too,
106
+ as long as the Wazuh agent package exists for it.) Enter the distribution:
107
+
108
+ ```sh
109
+ proot-distro login debian
110
+ ```
111
+
112
+ All following steps happen **inside** this PRoot session, unless stated
113
+ otherwise.
114
+
115
+ ### Step C — Install and enrol the Wazuh agent (inside PRoot)
116
+
117
+ Install the Wazuh agent from the official Wazuh repository (Debian, arm64):
118
+
119
+ ```sh
120
+ apt-get update && apt-get install -y curl gnupg
121
+ curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import
122
+ chmod 644 /usr/share/keyrings/wazuh.gpg
123
+ echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" > /etc/apt/sources.list.d/wazuh.list
124
+ apt-get update
125
+ ```
126
+
127
+ Enrol the agent with **your** manager. Replace the example address
128
+ `192.168.1.10` with your manager's address, and `my-phone` with the agent
129
+ name you want to see in your console:
130
+
131
+ ```sh
132
+ WAZUH_MANAGER="192.168.1.10" WAZUH_AGENT_NAME="my-phone" apt-get install -y wazuh-agent
133
+ ```
134
+
135
+ If your manager requires an enrolment key or a password, follow your own
136
+ manager's enrolment procedure — the agent is a completely standard Wazuh
137
+ agent; Bridge changes nothing about enrolment. Start it:
138
+
139
+ ```sh
140
+ /var/ossec/bin/wazuh-control start
141
+ ```
142
+
143
+ (PRoot has no systemd; `wazuh-control` is the way.)
144
+
145
+ ### Step D — Install the Bridge receiver (inside PRoot)
146
+
147
+ ```sh
148
+ pip install cybertrust-bridge
149
+ ```
150
+
151
+ ### Step E — Run the receiver, and connect the agent to the journal
152
+
153
+ Pick a journal path inside PRoot, for example `/root/bridge/journal.jsonl`
154
+ (create the folder first: `mkdir -p /root/bridge`).
155
+
156
+ Start the receiver — it listens on localhost UDP and appends every verified
157
+ line to the journal:
158
+
159
+ ```sh
160
+ cybertrust-bridge recevoir --voie udp --port 5514 --journal /root/bridge/journal.jsonl
161
+ ```
162
+
163
+ Leave it running (for example in a dedicated Termux session). Then generate
164
+ the logcollector snippet that tells the Wazuh agent to follow that journal:
165
+
166
+ ```sh
167
+ cybertrust-bridge configurer-agent --journal /root/bridge/journal.jsonl
168
+ ```
169
+
170
+ Copy the printed `<localfile>` block into the agent's configuration,
171
+ `/var/ossec/etc/ossec.conf`, inside the `<ossec_config>` section.
172
+
173
+ ### Step F — Restart the agent
174
+
175
+ ```sh
176
+ /var/ossec/bin/wazuh-control restart
177
+ ```
178
+
179
+ ### Step G — Install the Android app
180
+
181
+ Install the **CyberTrust Bridge** app on the phone, open it, and start the
182
+ Bridge service from the landing page. Optionally exempt both **Termux** and
183
+ the **CyberTrust Bridge** app from battery optimization (Android Settings →
184
+ Apps → Special access → Battery optimization) so Android does not kill them
185
+ silently — see Troubleshooting.
186
+
187
+ ## 4. Verification
188
+
189
+ 1. In the app, open the **Journal** section and tap **Selftest**. The app
190
+ writes a `bridge.selftest` event.
191
+ 2. Within a minute, that event should travel: app → receiver (watch its
192
+ output) → journal file → agent → your manager. In your Wazuh dashboard,
193
+ search the agent's archives/alerts for `bridge.selftest`.
194
+ 3. The app also emits a `bridge.heartbeat` every 15 minutes. If heartbeats
195
+ stop for more than 45 minutes, treat it as an alert in itself — the
196
+ silence means something died (see below). On the PRoot side,
197
+ `cybertrust-bridge statut --journal /root/bridge/journal.jsonl` shows the
198
+ last sequence number, chain validity, and the age of the last heartbeat.
199
+
200
+ **If nothing arrives, check in this order:**
201
+
202
+ - **Is the receiver still running?** Termux sessions die when Android kills
203
+ Termux. Reopen Termux, re-enter PRoot, relaunch `recevoir`. Exempt Termux
204
+ from battery optimization.
205
+ - **Is the agent running?** `/var/ossec/bin/wazuh-control status`. Restart
206
+ it if needed.
207
+ - **Is the journal path the same everywhere?** The path given to `recevoir
208
+ --journal`, the path in the `<localfile>` snippet in `ossec.conf`, and the
209
+ path you check with `statut` must be identical, character for character.
210
+ - **Is the app service running?** The app shows its service state on the
211
+ landing page; its local journal (Journal section) keeps growing even if
212
+ the transport is down — events are chained, so gaps are visible, never
213
+ silent.
214
+
215
+ ## 5. Bug reports (optional module)
216
+
217
+ An Android **bug report** (the system-generated zip: dumpsys, logcat, kernel
218
+ logs) is the deepest X-ray Android offers without root, and it sometimes
219
+ reveals real security findings. In the app's **Bug Report** section you can
220
+ share a bug report **to** the Bridge app (generate it from Developer options
221
+ or the power menu, then share it to CyberTrust Bridge). The app stores the
222
+ zip **on the phone only**, hashes it (SHA-256), and emits a single
223
+ `bugreport.ingested` event carrying the hash, the size, and the source —
224
+ **the raw report never transits the bridge and never leaves the phone.**
225
+ Distilled security findings derived from local analysis are a later version;
226
+ v0.1 ingests and receipts, it does not pretend to analyse.
227
+
228
+ ## 6. Limits and privacy
229
+
230
+ - **No root, ever.** The Bridge works entirely inside Android's normal
231
+ permission model. If a future version ever asks for root, it is not this
232
+ product.
233
+ - **Posture, not content.** The app observes system posture and app
234
+ lifecycle events. It does not read other apps' data, messages, files, or
235
+ anything you type.
236
+ - **Bug reports stay on the phone** (see §5). Exporting one is always your
237
+ explicit gesture, never automatic.
238
+ - **One destination only:** your own Wazuh manager, through your own
239
+ enrolled agent. No third party receives anything.
240
+ - **Honest limits:** no packet capture, no full system logcat, and Android
241
+ can still suspend background work — the heartbeat exists precisely so that
242
+ such silence is visible instead of hidden.
243
+ - **Whose crashes?** In standard mode the Bridge reports **its own**
244
+ crashes, system pressure signals, and device metrics — nothing more.
245
+ Detailed crashes of **other** apps are only visible through the Bug Report
246
+ module (tombstones, §5) or in device-owner mode. The same goes for ANRs
247
+ ("app not responding"): the Bridge detects **its own** ANRs with its
248
+ watchdog; other apps' ANR traces live only inside bug reports (§5). The
249
+ Bridge does not pretend to a visibility it does not have.
250
+
251
+ ---
252
+
253
+ *CyberTrust Bridge v0.1 — Signal True / CyberTrust. The contract is the
254
+ product: same events, same hash chain, same closed catalogue on both
255
+ surfaces (this package and the Android app).*