bunny2fmc 1.0.5__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.
- bunny2fmc-1.0.5/LICENSE +21 -0
- bunny2fmc-1.0.5/PKG-INFO +385 -0
- bunny2fmc-1.0.5/README.md +353 -0
- bunny2fmc-1.0.5/bunny2fmc/__init__.py +6 -0
- bunny2fmc-1.0.5/bunny2fmc/cli.py +287 -0
- bunny2fmc-1.0.5/bunny2fmc/config.py +128 -0
- bunny2fmc-1.0.5/bunny2fmc/sync_engine.py +137 -0
- bunny2fmc-1.0.5/bunny2fmc.egg-info/PKG-INFO +385 -0
- bunny2fmc-1.0.5/bunny2fmc.egg-info/SOURCES.txt +13 -0
- bunny2fmc-1.0.5/bunny2fmc.egg-info/dependency_links.txt +1 -0
- bunny2fmc-1.0.5/bunny2fmc.egg-info/entry_points.txt +2 -0
- bunny2fmc-1.0.5/bunny2fmc.egg-info/requires.txt +9 -0
- bunny2fmc-1.0.5/bunny2fmc.egg-info/top_level.txt +1 -0
- bunny2fmc-1.0.5/pyproject.toml +40 -0
- bunny2fmc-1.0.5/setup.cfg +4 -0
bunny2fmc-1.0.5/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kasper Elsborg -Wingmen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
bunny2fmc-1.0.5/PKG-INFO
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bunny2fmc
|
|
3
|
+
Version: 1.0.5
|
|
4
|
+
Summary: Sync BunnyCDN edge IPs to Cisco FMC Dynamic Objects with secure credential management and scheduling
|
|
5
|
+
Author: Kasper Elsborg -Wingmen
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/wingmen/bunny-sync-fmc
|
|
8
|
+
Project-URL: Repository, https://github.com/wingmen/bunny-sync-fmc
|
|
9
|
+
Keywords: bunny,fmc,cisco,edge-server,dynamic-object
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Topic :: System :: Networking :: Firewalls
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: wingpy>=0.3.0
|
|
24
|
+
Requires-Dist: requests>=2.25.0
|
|
25
|
+
Requires-Dist: python-dotenv>=0.19.0
|
|
26
|
+
Requires-Dist: keyring>=23.0.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
30
|
+
Requires-Dist: flake8>=4.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# 🐰 bunny2fmc
|
|
34
|
+
|
|
35
|
+
Synkroniserer BunnyCDN edge server IP-adresser til en Cisco FMC Dynamic Object med sikker credential-gempling og automatisk scheduling.
|
|
36
|
+
|
|
37
|
+
## Hvad gør scriptet?
|
|
38
|
+
|
|
39
|
+
1. Henter aktuelle IPv4 (og evt. IPv6) adresser fra BunnyCDN's API
|
|
40
|
+
2. Opretter/finder Dynamic Object på FMC
|
|
41
|
+
3. Sammenligner nuværende mappings med Bunny's liste
|
|
42
|
+
4. Tilføjer nye og fjerner forældede IP'er
|
|
43
|
+
5. Ingen deploy nødvendig - Dynamic Objects opdateres on-the-fly
|
|
44
|
+
6. **Sikker gempling**: Credentials gemmesto i OS Keyring (Windows Credential Manager / Linux Secret Service)
|
|
45
|
+
7. **Automatisk scheduling**: Konfigurer interval ved første setup, køres via cron
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
### Fra source (local pip install)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Clone eller cd til repository
|
|
55
|
+
cd /path/to/Bunny_Sync_FMC
|
|
56
|
+
|
|
57
|
+
# Installer som development package
|
|
58
|
+
pip install -e .
|
|
59
|
+
|
|
60
|
+
# Eller installer normalt
|
|
61
|
+
pip install .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Verificer installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
bunny2fmc --help
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Initial Setup
|
|
73
|
+
|
|
74
|
+
Kør først setup for at konfigurere credentials og sync interval:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bunny2fmc --setup
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Du bliver spurgt om:
|
|
81
|
+
- **FMC Base URL**: f.eks. `https://192.168.3.122`
|
|
82
|
+
- **FMC Username**: Dit FMC login
|
|
83
|
+
- **FMC Password**: Dit FMC password (gemmes sikkert i OS Keyring)
|
|
84
|
+
- **Dynamic Object Name**: f.eks. `BunnyCDN_Dynamic`
|
|
85
|
+
- **Include IPv6**: Ja/Nej
|
|
86
|
+
- **Sync Interval**: Minutter mellem kørsler (f.eks. 15)
|
|
87
|
+
|
|
88
|
+
Alle credentials gemmesto **sikkert** i dit operativsystems native credential manager.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Daglig Brug
|
|
93
|
+
|
|
94
|
+
### Kør sync nu
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
bunny2fmc
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
eller eksplicit:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
bunny2fmc --run
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Vis aktuel konfiguration
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
bunny2fmc --show-config
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Genopsæt configuration
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
bunny2fmc --setup
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Slet gemte credentials
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
bunny2fmc --clear-config
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Automatisk Scheduling med Cron
|
|
127
|
+
|
|
128
|
+
Konfigurér cron job til at køre scriptet automatisk. Intervallet du angav ved setup bruges som reference.
|
|
129
|
+
|
|
130
|
+
### Eksempel: 15 minutters interval
|
|
131
|
+
|
|
132
|
+
Hvis du satte interval til 15 minutter ved setup, tilføj til crontab:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
crontab -e
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```cron
|
|
139
|
+
*/15 * * * * bunny2fmc --run >> ~/.local/share/bunny2fmc/logs/cron.log 2>&1
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Andre intervals
|
|
143
|
+
|
|
144
|
+
**Hvert 5. minut:**
|
|
145
|
+
```cron
|
|
146
|
+
*/5 * * * * bunny2fmc --run >> ~/.local/share/bunny2fmc/logs/cron.log 2>&1
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Hver time:**
|
|
150
|
+
```cron
|
|
151
|
+
0 * * * * bunny2fmc --run >> ~/.local/share/bunny2fmc/logs/cron.log 2>&1
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Hver 6. time:**
|
|
155
|
+
```cron
|
|
156
|
+
0 */6 * * * bunny2fmc --run >> ~/.local/share/bunny2fmc/logs/cron.log 2>&1
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Dagligt kl. 03:00:**
|
|
160
|
+
```cron
|
|
161
|
+
0 3 * * * bunny2fmc --run >> ~/.local/share/bunny2fmc/logs/cron.log 2>&1
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
> Note: Intervallet du angav ved `bunny2fmc --setup` er din reference. Sæt cron-intervallet til at matche eller være hyppigere.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Logging
|
|
169
|
+
|
|
170
|
+
Alle kørsler logges til:
|
|
171
|
+
```
|
|
172
|
+
~/.local/share/bunny2fmc/logs/bunny2fmc.log
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Logfilerne roteres automatisk når de når 10 MB (max 5 backups gemmes).
|
|
176
|
+
|
|
177
|
+
### Tjek logs
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Seneste log
|
|
181
|
+
tail -f ~/.local/share/bunny2fmc/logs/bunny2fmc.log
|
|
182
|
+
|
|
183
|
+
# Se hele loghistorie
|
|
184
|
+
ls -lh ~/.local/share/bunny2fmc/logs/
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Sikkerhed
|
|
190
|
+
|
|
191
|
+
### Credential Gempling
|
|
192
|
+
|
|
193
|
+
- **Credentials gemmesto IKKE i plain text**
|
|
194
|
+
- Bruger dit operativsystems native secure storage:
|
|
195
|
+
- Windows: Windows Credential Manager
|
|
196
|
+
- Linux: Secret Service (D-Bus)
|
|
197
|
+
- macOS: Keychain
|
|
198
|
+
|
|
199
|
+
- **Passwords er aldrig tilgængelige** via config-filer eller command-line
|
|
200
|
+
|
|
201
|
+
### Best Practices
|
|
202
|
+
|
|
203
|
+
1. **Brug en dedikeret FMC bruger** med minimal adgang (kun Dynamic Objects)
|
|
204
|
+
2. **Tjek logs regelmæssigt** for fejl eller uventet adfærd
|
|
205
|
+
3. **Test med `--setup` først** før du sætter op i production
|
|
206
|
+
4. **Gem dine scripts i `/opt` eller `/usr/local`** for production use
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## FMC Konfiguration
|
|
211
|
+
|
|
212
|
+
### Oprettelse af Dynamic Object i firewall-regler
|
|
213
|
+
|
|
214
|
+
Scriptet opretter automatisk et Dynamic Object (f.eks. `BunnyCDN_Dynamic`) på FMC. For at det har effekt, skal du **manuelt oprette en firewall-regel** der bruger dette objekt:
|
|
215
|
+
|
|
216
|
+
1. **Log ind på FMC** → Policies → Access Control
|
|
217
|
+
2. **Opret/rediger en Access Control Policy**
|
|
218
|
+
3. **Tilføj en ny regel:**
|
|
219
|
+
- **Source/Destination**: Vælg "Dynamic Objects" → `BunnyCDN_Dynamic`
|
|
220
|
+
- **Action**: Allow/Trust (afhængig af dit behov)
|
|
221
|
+
- **Logging**: Aktiver efter behov
|
|
222
|
+
4. **Deploy** policyen til dine firewalls
|
|
223
|
+
|
|
224
|
+
> Vigtigt: Dynamic Objects opdateres automatisk uden deploy, men selve **firewall-reglen skal deployes** første gang den oprettes.
|
|
225
|
+
|
|
226
|
+
### Eksempel use case
|
|
227
|
+
|
|
228
|
+
Tillad trafik fra BunnyCDN edge servere til dine webservere:
|
|
229
|
+
```
|
|
230
|
+
Source: Dynamic Object "BunnyCDN_Dynamic"
|
|
231
|
+
Destination: Webserver network
|
|
232
|
+
Action: Allow
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Krav
|
|
238
|
+
|
|
239
|
+
- Python 3.8+
|
|
240
|
+
- Linux server (eller Windows/macOS for testing)
|
|
241
|
+
- Netværksadgang til FMC og BunnyCDN API
|
|
242
|
+
- FMC bruger med rettigheder til at oprette/redigere Dynamic Objects
|
|
243
|
+
- `keyring` Python package (installeres automatisk)
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Troubleshooting
|
|
248
|
+
|
|
249
|
+
### "No stored credentials found"
|
|
250
|
+
|
|
251
|
+
Løsning: Kør `bunny2fmc --setup` først
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
bunny2fmc --setup
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Credentials gemmes ikke i keyring
|
|
258
|
+
|
|
259
|
+
Kontroller at din Linux server har `Secret Service` installeret:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Debian/Ubuntu
|
|
263
|
+
sudo apt-get install gnome-keyring
|
|
264
|
+
|
|
265
|
+
# RHEL/CentOS
|
|
266
|
+
sudo yum install gnome-keyring
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Cron job kører ikke
|
|
270
|
+
|
|
271
|
+
Kontroller:
|
|
272
|
+
1. Crontab er korrekt: `crontab -l`
|
|
273
|
+
2. Cron daemon kører: `systemctl status cron` (eller `crond` på CentOS)
|
|
274
|
+
3. Se cron logs: `grep CRON /var/log/syslog` eller `journalctl -u cron`
|
|
275
|
+
|
|
276
|
+
### Sync fejl
|
|
277
|
+
|
|
278
|
+
Se logfilen for detaljer:
|
|
279
|
+
```bash
|
|
280
|
+
tail -50 ~/.local/share/bunny2fmc/logs/bunny2fmc.log
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Development
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Clone repo
|
|
289
|
+
git clone <repo-url>
|
|
290
|
+
cd Bunny_Sync_FMC
|
|
291
|
+
|
|
292
|
+
# Opret venv
|
|
293
|
+
python3 -m venv .venv
|
|
294
|
+
source .venv/bin/activate
|
|
295
|
+
|
|
296
|
+
# Installer dependencies
|
|
297
|
+
pip install -e ".[dev]"
|
|
298
|
+
|
|
299
|
+
# Kør tests
|
|
300
|
+
pytest
|
|
301
|
+
|
|
302
|
+
# Lint
|
|
303
|
+
flake8 bunny2fmc/
|
|
304
|
+
black bunny2fmc/
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Legacy Scripts
|
|
310
|
+
|
|
311
|
+
De gamle scripts er stadig tilgængelige:
|
|
312
|
+
- `bunny_to_FMC.py` - Environment-based version
|
|
313
|
+
- `bunny_to_FMC-interaktiv.py` - Interactive version
|
|
314
|
+
|
|
315
|
+
Brug `bunny2fmc` CLI-toolet for nye deployments.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Distribution Strategy
|
|
320
|
+
|
|
321
|
+
### Repository Struktur
|
|
322
|
+
|
|
323
|
+
- **Privat GitHub** (`https://github.com/IronKeyVault/Bunny_Sync_FMC`):
|
|
324
|
+
- Source of truth for alt udvikling
|
|
325
|
+
- Indeholder hele kodebase (gamle scripts, notes, configs)
|
|
326
|
+
- Kun for interne team medlemmer
|
|
327
|
+
|
|
328
|
+
- **PyPI** (`https://pypi.org/project/bunny2fmc`):
|
|
329
|
+
- Public distribution punkt
|
|
330
|
+
- Alle brugere kan installere med: `pip install bunny2fmc`
|
|
331
|
+
- Synkroniseret fra privat repo
|
|
332
|
+
|
|
333
|
+
### Release Workflow
|
|
334
|
+
|
|
335
|
+
Når du er klar til at udgive en ny version:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
./release.sh
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Scriptet vil:
|
|
342
|
+
1. Spørge for nyt versionsnummer (f.eks. 1.0.2)
|
|
343
|
+
2. Opdatere `pyproject.toml` og `bunny2fmc/__init__.py`
|
|
344
|
+
3. Committe og pushe til GitHub
|
|
345
|
+
4. Bygge pakken
|
|
346
|
+
5. Uploade til PyPI
|
|
347
|
+
|
|
348
|
+
**Eksempel:**
|
|
349
|
+
```
|
|
350
|
+
./release.sh
|
|
351
|
+
Enter new version (e.g., 1.0.2): 1.0.2
|
|
352
|
+
✓ Release v1.0.2 complete
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Hvornår kan jeg slette den gamle public repo?
|
|
358
|
+
|
|
359
|
+
Du kan slette `https://github.com/IronKeyVault/bunny2fmc` når:
|
|
360
|
+
|
|
361
|
+
1. ✅ **PyPI har den seneste version**
|
|
362
|
+
- Verificer på https://pypi.org/project/bunny2fmc/
|
|
363
|
+
- Alle nye releases går direkte til PyPI via `release.sh`
|
|
364
|
+
|
|
365
|
+
2. ✅ **Ingen users refererer til det**
|
|
366
|
+
- Hvis andre har installeringer fra Git URL, skal de updateres til:
|
|
367
|
+
- `pip install bunny2fmc` (fra PyPI i stedet)
|
|
368
|
+
|
|
369
|
+
3. ✅ **Du er sikker på at PyPI er det eneste public distribution point**
|
|
370
|
+
- Alt udvikling fortsætter i privat repo
|
|
371
|
+
- Releases håndteres via `./release.sh`
|
|
372
|
+
|
|
373
|
+
### Sletning
|
|
374
|
+
|
|
375
|
+
Når du er 100% sikker, kan du slette repoet:
|
|
376
|
+
|
|
377
|
+
1. Gå til https://github.com/IronKeyVault/bunny2fmc
|
|
378
|
+
2. Settings → Danger Zone → Delete Repository
|
|
379
|
+
3. Bekræft ved at skrive repo-navnet
|
|
380
|
+
|
|
381
|
+
**Efter sletning:**
|
|
382
|
+
- Alt udvikling/history ligger stadig på privat repo
|
|
383
|
+
- Alle brugere bruger PyPI (bedst praksis)
|
|
384
|
+
- Enklere repository-management
|
|
385
|
+
|