Compare commits
68 Commits
15a35f2b60
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 312e4e713f | |||
| 7d5d3dc0c8 | |||
| 8167a3ffff | |||
| 3e68e96c8a | |||
| 3b9b7f8789 | |||
| 62f739344c | |||
| 9b913a48bb | |||
| c1f1b48f6b | |||
| acd7daf36f | |||
| 36ac72ec82 | |||
| 440ce4d688 | |||
| 99b400cbc1 | |||
| d78c846898 | |||
| e44480505e | |||
| 625d2fc6bf | |||
| 324c1b7735 | |||
| 4a028aab5f | |||
| 95cc7edba5 | |||
| f5802c9be3 | |||
| d77bdac13f | |||
| 40fa971f06 | |||
| 78a88900d8 | |||
| e91094e344 | |||
| d7c6577ec1 | |||
| 865449cf9c | |||
| 7a33e9e082 | |||
| 719efbd809 | |||
| 277093a761 | |||
| ea43b5cb6c | |||
| dfd31c3db2 | |||
| 68cd4009bc | |||
| 0c7d172552 | |||
| ac1123c989 | |||
| b48d2ee03d | |||
| 90869f9e17 | |||
| 1538e7c634 | |||
| 6864d29ffb | |||
| 414ee2d3d6 | |||
| 6271755289 | |||
| 2804ef2146 | |||
| 616edabf0e | |||
| 67b737ea79 | |||
| dbb8f1509c | |||
| 0ac7beeba9 | |||
| 5d481e95fd | |||
| 8ada6689ae | |||
| e2bd5746f5 | |||
| 7f54f37978 | |||
| 5ae2747835 | |||
| 23a60c6250 | |||
| 42531d6e9c | |||
| 1b3f9e8657 | |||
| 2f93b02baa | |||
| 8adbee9f1d | |||
| d8eb92319b | |||
| 9149976db4 | |||
| 3b70e1c5fb | |||
| ff9d926a68 | |||
| 0d3fd26237 | |||
| dea51f0081 | |||
| e4dcaf6991 | |||
| 479c91394c | |||
| 758f9e8405 | |||
| 0d5673b02c | |||
| 2e0a3c9e75 | |||
| 321402f9b7 | |||
| be4aa52794 | |||
| d203dc4df8 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
Backup/Sophos/APS_HH.scx
|
Backup/Sophos/APS_HH.scx
|
||||||
*.log
|
*.log
|
||||||
*.log
|
*.log
|
||||||
|
*.lock
|
||||||
|
|||||||
BIN
App/KYOCERA Net Viewer_6.7.1116.zip
Normal file
BIN
App/KYOCERA Net Viewer_6.7.1116.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
Backup/MODOK-20260224T133918Z-1-001.zip
Normal file
BIN
Backup/MODOK-20260224T133918Z-1-001.zip
Normal file
Binary file not shown.
54
Conf/LibreNMS/LibreNMS.md
Normal file
54
Conf/LibreNMS/LibreNMS.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
$.devices[*].hardware
|
||||||
|
$.devices[*].type
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"status": "ok",
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"device_id": 48,
|
||||||
|
"inserted": "2026-03-09 15:40:30",
|
||||||
|
"hostname": "10.101.0.201",
|
||||||
|
"sysName": "10.101.0.201",
|
||||||
|
"display": "NET-ZE02_(ZG)",
|
||||||
|
"ip": "10.101.0.201",
|
||||||
|
"overwrite_ip": null,
|
||||||
|
"community": null,
|
||||||
|
"authlevel": null,
|
||||||
|
"authname": null,
|
||||||
|
"authpass": null,
|
||||||
|
"authalgo": null,
|
||||||
|
"cryptopass": null,
|
||||||
|
"cryptoalgo": null,
|
||||||
|
"snmpver": "v2c",
|
||||||
|
"port": 161,
|
||||||
|
"transport": "udp",
|
||||||
|
"timeout": null,
|
||||||
|
"retries": null,
|
||||||
|
"snmp_disable": 1,
|
||||||
|
"bgpLocalAs": null,
|
||||||
|
"sysObjectID": null,
|
||||||
|
"sysDescr": null,
|
||||||
|
"sysContact": null,
|
||||||
|
"version": null,
|
||||||
|
"hardware": "",
|
||||||
|
"features": null,
|
||||||
|
"location_id": null,
|
||||||
|
"os": "ping",
|
||||||
|
"status": 1,
|
||||||
|
"status_reason": "",
|
||||||
|
"ignore": 0,
|
||||||
|
"disabled": 0,
|
||||||
|
"uptime": null,
|
||||||
|
"agent_uptime": 0,
|
||||||
|
"last_polled": "2026-03-11 14:53:50",
|
||||||
|
"last_poll_attempted": null,
|
||||||
|
"last_polled_timetaken": 1.0587911605835,
|
||||||
|
"last_discovered_timetaken": 1.3786909580231,
|
||||||
|
"last_discovered": "2026-03-11 13:00:46",
|
||||||
|
"last_ping": "2026-03-11 14:53:49",
|
||||||
|
"last_ping_timetaken": 0.76,
|
||||||
|
"purpose": null,
|
||||||
|
"type": "",
|
||||||
|
"serial": null,
|
||||||
|
"icon": null,
|
||||||
54
Conf/Switch/SNMP_Config_Guide.md
Normal file
54
Conf/Switch/SNMP_Config_Guide.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# SNMP Beállítási Útmutató (Aruba AOS-CX)
|
||||||
|
|
||||||
|
Ez az útmutató az Aruba 8360, 6300, 6100 és 6000 sorozatú (AOS-CX) switchekhez használható.
|
||||||
|
|
||||||
|
## 1. SNMP Alapbeállítások
|
||||||
|
Lépj be konfigurációs módba (`conf t`), és add ki az alábbi parancsokat:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# SNMP Közösségi név (Community) beállítása (Read-Only)
|
||||||
|
snmp-server community prtg
|
||||||
|
|
||||||
|
# Rendszerinformációk (opcionális, de ajánlott)
|
||||||
|
snmp-server system-location "Serverraum"
|
||||||
|
snmp-server system-contact "Jan Baulig"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. SNMP Engedélyezése a hálózaton (KRITIKUS)
|
||||||
|
Az AOS-CX switcheken az SNMP alapértelmezés szerint tiltva van minden hálózati szegmensben (VRF). Engedélyezni kell ott, ahol a switch IP-címe található.
|
||||||
|
|
||||||
|
**A) Ha a switch IP-je egy VLAN-on van (pl. vlan 97):**
|
||||||
|
```bash
|
||||||
|
snmp-server vrf default
|
||||||
|
```
|
||||||
|
|
||||||
|
**B) Ha a különálló Management (OOBM) portot használod:**
|
||||||
|
```bash
|
||||||
|
snmp-server vrf mgmt
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. Ellenőrző parancsok
|
||||||
|
A switchen az alábbi parancsokkal ellenőrizheted a működést:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Megmutatja az aktív community-ket
|
||||||
|
show snmp community
|
||||||
|
|
||||||
|
# Megmutatja, melyik VRF-en figyel az SNMP
|
||||||
|
show snmp vrf
|
||||||
|
|
||||||
|
# Általános SNMP állapot és statisztika
|
||||||
|
show snmp
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. LibreNMS Hozzáadás / Frissítés
|
||||||
|
Ha az eszköz már benne van a LibreNMS-ben, de csak Ping-gel:
|
||||||
|
1. Az eszköz oldalán: **Edit** -> **SNMP**.
|
||||||
|
2. **SNMP Version:** `v2c`.
|
||||||
|
3. **Community:** `prtg`.
|
||||||
|
4. **Mentés.**
|
||||||
|
5. Futtass egy kézi felfedezést a LibreNMS szerveren:
|
||||||
|
`docker exec -it librenms lnms device:discover [IP_CIM]`
|
||||||
|
|
||||||
|
# Docker force übervachung
|
||||||
|
docker exec -it librenms lnms device:discover 10.220.1.85
|
||||||
38
Conf/aps.local/postfix_main.cf.sh
Normal file
38
Conf/aps.local/postfix_main.cf.sh
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
alias_database = hash:/etc/aliases
|
||||||
|
alias_maps = hash:/etc/aliases
|
||||||
|
broken_sasl_auth_clients = yes
|
||||||
|
command_directory = /usr/bin
|
||||||
|
compatibility_level = 3.10
|
||||||
|
daemon_directory = /usr/libexec/postfix
|
||||||
|
data_directory = /var/lib/postfix
|
||||||
|
debug_peer_level = 2
|
||||||
|
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
|
||||||
|
html_directory = no
|
||||||
|
inet_interfaces = all
|
||||||
|
inet_protocols = all
|
||||||
|
mail_owner = postfix
|
||||||
|
mailq_path = /usr/bin/mailq.postfix
|
||||||
|
manpage_directory = /usr/share/man
|
||||||
|
meta_directory = /etc/postfix
|
||||||
|
mydestination = $myhostname, localhost.$mydomain, localhost
|
||||||
|
myhostname = antares-apo.local
|
||||||
|
mynetworks = 127.0.0.0/8, 10.102.9.0/24, 10.101.0.0/16, 10.102.1.0/24
|
||||||
|
newaliases_path = /usr/bin/newaliases.postfix
|
||||||
|
queue_directory = /var/spool/postfix
|
||||||
|
readme_directory = /usr/share/doc/postfix/README_FILES
|
||||||
|
relayhost = [aps-exch01.aps.local]:25
|
||||||
|
sample_directory = /usr/share/doc/postfix/samples
|
||||||
|
sendmail_path = /usr/bin/sendmail.postfix
|
||||||
|
setgid_group = postdrop
|
||||||
|
shlib_directory = /usr/lib64/postfix
|
||||||
|
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
|
||||||
|
smtp_tls_CApath = /etc/pki/tls/certs
|
||||||
|
smtp_tls_security_level = may
|
||||||
|
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
|
||||||
|
smtpd_sasl_auth_enable = yes
|
||||||
|
smtpd_sasl_local_domain = $myhostname
|
||||||
|
smtpd_sasl_security_options = noanonymous
|
||||||
|
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
|
||||||
|
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
|
||||||
|
smtpd_tls_security_level = may
|
||||||
|
unknown_local_recipient_reject_code = 550
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
# Matrix - n8n-bot - Accesstoken
|
|
||||||
syt_Ym90LW44bg_RMzxOFQllPjSPsRWAHvb_0FeoGL
|
|
||||||
=======
|
|
||||||
# bot-n8n access token
|
|
||||||
syt_Ym90LW44bg_AbviDZpPwRhLydqppDvv_2OfdD8
|
|
||||||
>>>>>>> 2e10f37 (token)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
docker run -d \
|
|
||||||
--name pihole.home.meszely.eu \
|
|
||||||
--network pihole \
|
|
||||||
--ip 10.11.3.1 \
|
|
||||||
--cap-add=NET_ADMIN \
|
|
||||||
-e TZ=Europe/Berlin \
|
|
||||||
-v /Docker/PIHOLE:/etc/pihole \
|
|
||||||
--restart unless-stopped \
|
|
||||||
pihole/pihole:latest
|
|
||||||
39
Conf/home.meszely.eu/rpi01/pihole_docker-compose.yaml
Normal file
39
Conf/home.meszely.eu/rpi01/pihole_docker-compose.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
|
||||||
|
services:
|
||||||
|
pihole:
|
||||||
|
container_name: pihole
|
||||||
|
image: pihole/pihole:latest
|
||||||
|
ports:
|
||||||
|
# DNS Ports
|
||||||
|
- "53:53/tcp"
|
||||||
|
- "53:53/udp"
|
||||||
|
# Default HTTP Port
|
||||||
|
- "80:80/tcp"
|
||||||
|
# Default HTTPs Port. FTL will generate a self-signed certificate
|
||||||
|
- "443:443/tcp"
|
||||||
|
# Uncomment the line below if you are using Pi-hole as your DHCP server
|
||||||
|
- "67:67/udp"
|
||||||
|
# Uncomment the line below if you are using Pi-hole as your NTP server
|
||||||
|
- "123:123/udp"
|
||||||
|
environment:
|
||||||
|
# Set the appropriate timezone for your location (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), e.g:
|
||||||
|
TZ: 'Europe/Berlin'
|
||||||
|
# Set a password to access the web interface. Not setting one will result in a random password being assigned
|
||||||
|
FTLCONF_webserver_api_password: 'correct horse battery staple'
|
||||||
|
# If using Docker's default `bridge` network setting the dns listening mode should be set to 'ALL'
|
||||||
|
FTLCONF_dns_listeningMode: 'ALL'
|
||||||
|
# Volumes store your data between container upgrades
|
||||||
|
volumes:
|
||||||
|
# For persisting Pi-hole's databases and common configuration file
|
||||||
|
- './etc-pihole:/etc/pihole'
|
||||||
|
# Uncomment the below if you have custom dnsmasq config files that you want to persist. Not needed for most starting fresh with Pi-hole v6. If you're upgrading from v5 you and have used this directory before, you should keep it enabled for the first v6 container start to allow for a complete migration. It can be removed afterwards. Needs environment variable FTLCONF_misc_etc_dnsmasq_d: 'true'
|
||||||
|
#- './etc-dnsmasq.d:/etc/dnsmasq.d'
|
||||||
|
cap_add:
|
||||||
|
# See https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
|
||||||
|
# Required if you are using Pi-hole as your DHCP server, else not needed
|
||||||
|
- NET_ADMIN
|
||||||
|
# Required if you are using Pi-hole as your NTP client to be able to set the host's system time
|
||||||
|
- SYS_TIME
|
||||||
|
# Optional, if Pi-hole should get some more processing time
|
||||||
|
- SYS_NICE
|
||||||
|
restart: unless-stopped
|
||||||
@@ -7,3 +7,8 @@ docker exec -it synapse register_new_matrix_user -c /data/homeserver.yaml http:/
|
|||||||
# wpanda
|
# wpanda
|
||||||
# EsT4 x9g5 C5fy mQ8N wwN3 VBTh EnqF n8un rZ4K 8Czv mYWr 7T1u
|
# EsT4 x9g5 C5fy mQ8N wwN3 VBTh EnqF n8un rZ4K 8Czv mYWr 7T1u
|
||||||
|
|
||||||
|
# pandabot
|
||||||
|
EsTP ciPf 3cWG E62g 6wWk q2vw p8Ds Dzxx KcZy xFMN cB4w y1pX
|
||||||
|
# dev key
|
||||||
|
syt_cGFuZGFib3Q_ILXWcPmRbRbqkABuLVmt_1yM7WZ
|
||||||
|
|
||||||
|
|||||||
56
Dev/APS-SFTP01/APS-SFTP01_System_Documentation_DE.md
Normal file
56
Dev/APS-SFTP01/APS-SFTP01_System_Documentation_DE.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Systemdokumentation: APS-SFTP01 Datenaustausch-Server
|
||||||
|
|
||||||
|
Dieses Dokument beschreibt die Funktionsweise, das Berechtigungssystem und die Zugriffspfade des Servers **APS-SFTP01 (10.102.1.202)**. Der Server dient zwei getrennten Importprozessen.
|
||||||
|
|
||||||
|
## 1. Systemübersicht
|
||||||
|
Der Server fungiert als zentraler Datenaustauschpunkt für die Systeme Bremen und Amondis:
|
||||||
|
1. **Bremen-Mave Import:** Empfang externer Daten über SFTP.
|
||||||
|
2. **Amondis-Mave Import:** Empfang externer Daten über SMB (Samba), und import nach Mave mit SFTP Protokolle.
|
||||||
|
|
||||||
|
## 2. Benutzer und Zugriff
|
||||||
|
┌──────────────────┬──────────────┬───────────────┬─────────────────┬─────────────────────────────┐
|
||||||
|
│ Benutzer │ Prozess │ Typ │ Shell │ Aufgabe │
|
||||||
|
├──────────────────┼──────────────┼───────────────┼─────────────────┼─────────────────────────────┤
|
||||||
|
│ mave-sftp │ Bremen-Mave │ Nur SFTP │ /sbin/nologin │ Import von Bremen-Daten │
|
||||||
|
│ mave-amondis │ Amondis-Mave │ SFTP & SMB │ /sbin/nologin │ Import von Amondis-Daten │
|
||||||
|
└──────────────────┴──────────────┴───────────────┴─────────────────┴─────────────────────────────┘
|
||||||
|
*Hinweis: Keiner der Benutzer ist für eine interaktive SSH-Anmeldung (Terminal) berechtigt.*
|
||||||
|
|
||||||
|
## 3. Verzeichnisstruktur und Berechtigungen
|
||||||
|
|
||||||
|
### Bremen-Mave Import (mave-sftp)
|
||||||
|
┌────────────────────────────────────────┬─────────────────────┬──────────────┬──────────────────────────────────┐
|
||||||
|
│ Pfad │ Besitzer │ Berechtigung │ Rolle │
|
||||||
|
├────────────────────────────────────────┼─────────────────────┼──────────────┼──────────────────────────────────┤
|
||||||
|
│ /home/mave-sftp │ root:root │ 755 │ SFTP Chroot-Gefängnis │
|
||||||
|
│ /home/mave-sftp/Schnittstellen/Bremen │ mave-sftp:mave-sftp │ 775 │ Beschreibbarer Ordner für Bremen │
|
||||||
|
└────────────────────────────────────────┴─────────────────────┴──────────────┴──────────────────────────────────┘
|
||||||
|
|
||||||
|
### Amondis-Mave Import (mave-amondis)
|
||||||
|
┌───────────────────────────────────────────────┬───────────────────────────┬──────────────┬─────────────────────────────┐
|
||||||
|
│ Pfad │ Besitzer │ Berechtigung │ Rolle │
|
||||||
|
├───────────────────────────────────────────────┼───────────────────────────┼──────────────┼─────────────────────────────┤
|
||||||
|
│ /home/mave-amondis │ root:root │ 755 │ SFTP Home (nicht schreibbar)|
|
||||||
|
│ /home/mave-amondis/Schnittstellen │ root:root │ 755 │ SFTP Chroot-Gefängnis │
|
||||||
|
│ /home/mave-amondis/Schnittstellen/Amondis/APO │ mave-amondis:mave-amondis │ 775 │ Beschreibbares Verzeichnis │
|
||||||
|
└───────────────────────────────────────────────┴───────────────────────────┴──────────────┴─────────────────────────────┘
|
||||||
|
|
||||||
|
## 4. Netzwerkzugriff
|
||||||
|
|
||||||
|
### SMB (Windows Freigabe)
|
||||||
|
* **Amondis-Pfad:** `\\10.102.1.202\mave-amondis\Schnittstellen\Amondis\APO`
|
||||||
|
* **Funktionsweise:** Samba verwendet die Einstellung `force user = mave-amondis`, um Berechtigungskonflikte zu vermeiden.
|
||||||
|
|
||||||
|
### SFTP (Secure FTP)
|
||||||
|
* **Bremen-Verbindung:** `sftp://mave-sftp@10.102.1.202` (sieht nach der Anmeldung den Ordner `mave-amondis\Schnittstellen\Bremen`).
|
||||||
|
* **Amondis-Verbindung:** `sftp://mave-amondis@10.102.1.202` (sieht nach der Anmeldung den Ordner `Amondis\APO`).
|
||||||
|
|
||||||
|
## 5. Automatische Benachrichtigungen (Monitoring)
|
||||||
|
Bei jeder erfolgreichen Anmeldung (für beide Benutzer) wird eine E-Mail-Benachrichtigung an den Administrator gesendet (`i.meszely@antares-apo.de`).
|
||||||
|
|
||||||
|
* **Script-Speicherort:** `/usr/local/sbin/sftp-notify.sh`
|
||||||
|
* **Funktionsweise:** Das Script wird durch das PAM-System (Pluggable Authentication Modules) bei jedem `open_session`-Ereignis aufgerufen. Es unterscheidet zwischen SFTP (eingeschränkt) und interaktiven SSH-Anmeldungen anhand der Benutzer-Shell und versendet die Details (Benutzer, Remote-IP, Zeitstempel) per E-Mail.
|
||||||
|
* **Logdatei:** `/tmp/sftp-notify.log` (für das Debugging).
|
||||||
|
|
||||||
|
---
|
||||||
|
*Aktualisiert am: 25. März 2026*
|
||||||
56
Dev/APS-SFTP01/APS-SFTP01_System_Documentation_HU.md
Normal file
56
Dev/APS-SFTP01/APS-SFTP01_System_Documentation_HU.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Rendszerdokumentáció: APS-SFTP01 Adatcsere Szerver
|
||||||
|
|
||||||
|
Ez a dokumentum az **APS-SFTP01 (10.102.1.202)** szerver működését, jogosultsági rendszerét és elérési útjait foglalja össze. A szerver két elkülönített import folyamatot szolgál ki.
|
||||||
|
|
||||||
|
## 1. Rendszer Áttekintés
|
||||||
|
A szerver központi adatcsere pontként funkcionál a Bremen és az Amondis rendszerek felé:
|
||||||
|
1. **Bremen-Mave Import:** Külső adatok fogadása SFTP-n keresztül.
|
||||||
|
2. **Amondis-Mave Import:** Belső és külső adatcsere SMB (Samba) és SFTP protokollokon.
|
||||||
|
|
||||||
|
## 2. Felhasználók és Hozzáférés
|
||||||
|
┌──────────────────┬──────────────┬───────────────┬─────────────────┬───────────────────────────┐
|
||||||
|
│ Felhasználó │ Folyamat │ Típus │ Shell │ Feladat │
|
||||||
|
├──────────────────┼──────────────┼───────────────┼─────────────────┼───────────────────────────┤
|
||||||
|
│ mave-sftp │ Bremen-Mave │ Csak SFTP │ /sbin/nologin │ Bremen adatok importálása │
|
||||||
|
│ mave-amondis │ Amondis-Mave │ SFTP & SMB │ /sbin/nologin │ Amondis adatok kezelése │
|
||||||
|
└──────────────────┴──────────────┴───────────────┴─────────────────┴───────────────────────────┘
|
||||||
|
*Megjegyzés: Egyik felhasználó sem jogosult interaktív SSH (terminál) belépésre.*
|
||||||
|
|
||||||
|
## 3. Könyvtárstruktúra és Jogosultságok
|
||||||
|
|
||||||
|
### Bremen-Mave Import (mave-sftp)
|
||||||
|
┌────────────────────────────┬─────────────────────┬─────────────┬─────────────────────────────────┐
|
||||||
|
│ Elérési út │ Tulajdonos │ Jogosultság │ Szerep │
|
||||||
|
├────────────────────────────┼─────────────────────┼─────────────┼─────────────────────────────────┤
|
||||||
|
│ /home/mave-sftp │ root:root │ 755 │ SFTP Chroot Börtön │
|
||||||
|
│ /home/mave-sftp/feltoltes │ mave-sftp:mave-sftp │ 775 │ Írható mappa a Bremen adatoknak │
|
||||||
|
└────────────────────────────┴─────────────────────┴─────────────┴─────────────────────────────────┘
|
||||||
|
|
||||||
|
### Amondis-Mave Import (mave-amondis)
|
||||||
|
┌───────────────────────────────────────────┬───────────────────────────┬─────────────┬────────────────────────┐
|
||||||
|
│ Elérési út │ Tulajdonos │ Jogosultság │ Szerep │
|
||||||
|
├───────────────────────────────────────────┼───────────────────────────┼─────────────┼────────────────────────┤
|
||||||
|
│ /home/mave-amondis │ root:root │ 755 │ SFTP Home (nem írható) │
|
||||||
|
│ /home/mave-amondis/Schnittstellen │ root:root │ 755 │ SFTP Chroot Börtön │
|
||||||
|
│ /home/mave-amondis/Schnittstellen/Amondis │ mave-amondis:mave-amondis │ 775 │ Írható munkakönyvtár │
|
||||||
|
└───────────────────────────────────────────┴───────────────────────────┴─────────────┴────────────────────────┘
|
||||||
|
|
||||||
|
## 4. Hálózati Elérések
|
||||||
|
|
||||||
|
### SMB (Windows Megosztás)
|
||||||
|
* **Amondis Útvonal:** `\\10.102.1.202\mave-amondis\Schnittstellen\Amondis\APO`
|
||||||
|
* **Működés:** A Samba a `force user = mave-amondis` beállítást használja a jogosultsági hibák elkerülése érdekében.
|
||||||
|
|
||||||
|
### SFTP (Biztonságos FTP)
|
||||||
|
* **Bremen Kapcsolat:** `sftp://mave-sftp@10.102.1.202` (belépéskor a `feltoltes` mappát látja).
|
||||||
|
* **Amondis Kapcsolat:** `sftp://mave-amondis@10.102.1.202` (belépéskor az `Amondis` mappát látja).
|
||||||
|
|
||||||
|
## 5. Automatikus Értesítések (Monitoring)
|
||||||
|
Minden sikeres bejelentkezéskor (mindkét felhasználó esetén) e-mail értesítés érkezik az adminisztrátornak (`i.meszely@antares-apo.de`).
|
||||||
|
|
||||||
|
* **Script helye:** `/usr/local/sbin/sftp-notify.sh`
|
||||||
|
* **Működés:** A scriptet a PAM (Pluggable Authentication Modules) rendszer hívja meg minden `open_session` eseménynél. A script megkülönbözteti az SFTP (korlátozott) és az interaktív SSH belépéseket a felhasználó shellje alapján, majd elküldi az adatokat (felhasználó, távoli IP, időpont) e-mailben.
|
||||||
|
* **Log fájl:** `/tmp/sftp-notify.log` (hibakereséshez).
|
||||||
|
|
||||||
|
---
|
||||||
|
*Frissítve: 2026. március 24.*
|
||||||
80
Dev/APS-SFTP01/SFTP_Setup_DE.md
Normal file
80
Dev/APS-SFTP01/SFTP_Setup_DE.md
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
# Konfiguration eines SFTP-Servers auf Fedora Linux
|
||||||
|
|
||||||
|
Diese Anleitung beschreibt die Einrichtung eines sicheren SFTP-Servers unter Verwendung von OpenSSH. Der Fokus liegt auf Sicherheit durch die Einschränkung des Benutzerzugriffs (Chroot) und die Deaktivierung des Shell-Zugriffs.
|
||||||
|
|
||||||
|
## 1. Benutzer anlegen
|
||||||
|
Zuerst erstellen wir einen dedizierten Benutzer für den SFTP-Zugriff. Um die Sicherheit zu erhöhen, deaktivieren wir den normalen SSH-Terminal-Zugriff (`/sbin/nologin`).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Benutzer erstellen (ohne Shell-Zugriff)
|
||||||
|
sudo useradd -m -s /sbin/nologin sftpuser
|
||||||
|
|
||||||
|
# Passwort für den Benutzer festlegen
|
||||||
|
sudo passwd sftpuser
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. Firewall-Konfiguration
|
||||||
|
SFTP läuft über das SSH-Protokoll (Port 22). Dieser muss in der Firewall freigegeben werden.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# SSH-Dienst in der Firewall erlauben
|
||||||
|
sudo firewall-cmd --permanent --add-service=ssh
|
||||||
|
|
||||||
|
# Konfiguration neu laden
|
||||||
|
sudo firewall-cmd --reload
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. SSH-Konfiguration (Einschränkungen)
|
||||||
|
Um den Benutzer in seinem Home-Verzeichnis zu isolieren (Chroot) und nur SFTP zu erlauben, muss die Datei `/etc/ssh/sshd_config` angepasst werden.
|
||||||
|
|
||||||
|
1. Öffnen Sie die Konfigurationsdatei: `sudo nano /etc/ssh/sshd_config`
|
||||||
|
2. Fügen Sie am Ende der Datei folgende Zeilen hinzu:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Match User sftpuser
|
||||||
|
ForceCommand internal-sftp
|
||||||
|
PasswordAuthentication yes
|
||||||
|
ChrootDirectory %h
|
||||||
|
AllowTcpForwarding no
|
||||||
|
X11Forwarding no
|
||||||
|
```
|
||||||
|
|
||||||
|
* **Match User:** Wendet die Regeln nur auf diesen Benutzer an.
|
||||||
|
* **ForceCommand internal-sftp:** Erlaubt nur SFTP-Befehle, keinen interaktiven Shell-Zugriff.
|
||||||
|
* **ChrootDirectory %h:** Sperrt den Benutzer in sein Home-Verzeichnis ein.
|
||||||
|
|
||||||
|
## 4. Verzeichnisberechtigungen (Wichtig für Chroot)
|
||||||
|
Damit der `Chroot`-Mechanismus funktioniert, muss das Home-Verzeichnis dem Benutzer `root` gehören und darf für andere nicht schreibbar sein.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Besitzer auf root setzen
|
||||||
|
sudo chown root:root /home/sftpuser
|
||||||
|
sudo chmod 755 /home/sftpuser
|
||||||
|
|
||||||
|
# Einen Unterordner für Uploads erstellen, in dem der Benutzer schreiben darf
|
||||||
|
sudo mkdir /home/sftpuser/uploads
|
||||||
|
sudo chown sftpuser:sftpuser /home/sftpuser/uploads
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. SELinux-Anpassungen (Fedora-spezifisch)
|
||||||
|
Auf Fedora verhindert SELinux standardmäßig, dass der SSH-Dienst in Chroot-Umgebungen Schreibzugriff auf Home-Verzeichnisse hat. Dies muss explizit erlaubt werden.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Schreibzugriff für SFTP-Chroot in SELinux aktivieren
|
||||||
|
sudo setsebool -P ssh_chroot_rw_homedirs on
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. Dienst neu starten und testen
|
||||||
|
Nachdem alle Änderungen vorgenommen wurden, muss der SSH-Dienst neu gestartet werden.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# SSH-Dienst neu starten
|
||||||
|
sudo systemctl restart sshd
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testen des Zugriffs:
|
||||||
|
Von einem entfernten Rechner oder lokal:
|
||||||
|
```bash
|
||||||
|
sftp sftpuser@<IP-ADRESSE-DES-SERVERS>
|
||||||
|
```
|
||||||
|
*Hinweis: Ein Login via normalem SSH (`ssh sftpuser@...`) sollte nun automatisch abgelehnt werden.*
|
||||||
45
Dev/APS-SFTP01/SFTP_Setup_HU.md
Normal file
45
Dev/APS-SFTP01/SFTP_Setup_HU.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
1. Felhasználó létrehozása
|
||||||
|
Hozzunk létre egy felhasználót (pl. sftpuser), de tiltsuk le neki a shell hozzáférést, hogy ne tudjon belépni a terminálba, csak fájlokat másolni:
|
||||||
|
1 sudo useradd -m -s /sbin/nologin sftpuser
|
||||||
|
2 sudo passwd sftpuser
|
||||||
|
|
||||||
|
2. Tűzfal (Firewall) beállítása
|
||||||
|
Fedora alatt a firewalld fut. Engedélyezni kell az SSH-t (ami az SFTP-t is viszi):
|
||||||
|
1 sudo firewall-cmd --permanent --add-service=ssh
|
||||||
|
2 sudo firewall-cmd --reload
|
||||||
|
|
||||||
|
3. Az SFTP korlátozása (Opcionális, de ajánlott)
|
||||||
|
Ha azt szeretnéd, hogy a felhasználó csak az SFTP-t használhassa, és ne lásson bele a teljes szerver fájlrendszerébe, módosítsd az SSH konfigurációt:
|
||||||
|
|
||||||
|
1. Nyisd meg: sudo nano /etc/ssh/sshd_config
|
||||||
|
2. Menj a fájl végére és add hozzá:
|
||||||
|
|
||||||
|
1 Match User sftpuser
|
||||||
|
2 ForceCommand internal-sftp
|
||||||
|
3 PasswordAuthentication yes
|
||||||
|
4 ChrootDirectory %h
|
||||||
|
5 AllowTcpForwarding no
|
||||||
|
6 X11Forwarding no
|
||||||
|
Megjegyzés: A ChrootDirectory %h bezárja a felhasználót a saját home mappájába.
|
||||||
|
|
||||||
|
3. Fontos: Ha ChrootDirectory-t használsz, a home mappa tulajdonosának a root-nak kell lennie:
|
||||||
|
|
||||||
|
1 sudo chown root:root /home/sftpuser
|
||||||
|
2 sudo chmod 755 /home/sftpuser
|
||||||
|
3 # Hozz létre egy mappát, amibe írhat is:
|
||||||
|
4 sudo mkdir /home/sftpuser/feltoltes
|
||||||
|
5 sudo chown sftpuser:sftpuser /home/sftpuser/feltoltes
|
||||||
|
|
||||||
|
4. Indítsd újra az SSH-t:
|
||||||
|
1 sudo systemctl restart sshd
|
||||||
|
|
||||||
|
4. SELinux (A Fedora "lelke")
|
||||||
|
Mivel Fedora alatt dolgozunk, az SELinux alapértelmezés szerint blokkolhatja az SFTP írási jogokat, ha nem a szokványos módon használod. Engedélyezd az SFTP írást a home mappákba:
|
||||||
|
|
||||||
|
1 sudo setsebool -P ssh_chroot_rw_homedirs on
|
||||||
|
(Ha nem használsz Chroot-ot, akkor is érdemes ezt futtatni, ha hiba van.)
|
||||||
|
|
||||||
|
Összegzés:
|
||||||
|
* Ha csak gyorsan kell: useradd + passwd + firewall-cmd -> KÉSZ.
|
||||||
|
* Ha biztonságosan kell: Használd a Match User részt az sshd_config-ban, hogy ne tudjon "mászkálni" a szerveren.
|
||||||
|
|
||||||
62
Dev/APS-SFTP01/SMB_Setup_HU.md
Normal file
62
Dev/APS-SFTP01/SMB_Setup_HU.md
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
# Samba (SMB) Megosztás Beállítása - APS-SFTP01 (mave-amondis)
|
||||||
|
|
||||||
|
Ez a leírás a `mave-amondis` felhasználó home könyvtárának megosztását mutatja be, aki **kizárólag SMB** hozzáféréssel rendelkezik (nem használ SFTP-t).
|
||||||
|
|
||||||
|
## 1. Előfeltételek (Rendszerfelhasználó)
|
||||||
|
Ellenőrizzük, hogy a felhasználó létezik-e, és a saját mappája az övé:
|
||||||
|
```bash
|
||||||
|
# Ha még nincs felhasználó:
|
||||||
|
# sudo useradd -m -s /sbin/nologin mave-amondis
|
||||||
|
|
||||||
|
# Jogosultságok ellenőrzése (Samba eléréshez 0700 vagy 0755 javasolt)
|
||||||
|
sudo chown mave-amondis:mave-amondis /home/mave-amondis
|
||||||
|
sudo chmod 700 /home/mave-amondis
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. Samba jelszó beállítása
|
||||||
|
A Samba saját adatbázist használ, így meg kell adni egy jelszót a felhasználónak:
|
||||||
|
```bash
|
||||||
|
sudo smbpasswd -a mave-amondis
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. Samba konfiguráció (/etc/samba/smb.conf)
|
||||||
|
Add hozzá a fájl végéhez az alábbi részt:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[mave-amondis]
|
||||||
|
comment = Mave Amondis SMB Share
|
||||||
|
path = /home/mave-amondis
|
||||||
|
valid users = mave-amondis
|
||||||
|
public = no
|
||||||
|
writable = yes
|
||||||
|
browsable = yes
|
||||||
|
guest ok = no
|
||||||
|
create mask = 0644
|
||||||
|
directory mask = 0755
|
||||||
|
force user = mave-amondis
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. SELinux és Tűzfal (Fedora / RHEL esetén kötelező!)
|
||||||
|
A Fedora alapértelmezésben tiltja a Home könyvtárak megosztását és a Samba forgalmat.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# SELinux: Home könyvtárak engedélyezése Sambához
|
||||||
|
sudo setsebool -P samba_enable_home_dirs on
|
||||||
|
|
||||||
|
# Tűzfal: Samba szolgáltatás engedélyezése
|
||||||
|
sudo firewall-cmd --permanent --add-service=samba
|
||||||
|
sudo firewall-cmd --reload
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Szolgáltatások indítása
|
||||||
|
```bash
|
||||||
|
sudo systemctl enable --now smb nmb
|
||||||
|
sudo systemctl restart smb
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. Csatlakozás (Windows)
|
||||||
|
Windows Intézőben:
|
||||||
|
`\\APS-SFTP01\mave-amondis`
|
||||||
|
|
||||||
|
---
|
||||||
|
*Megjegyzés: Mivel ez a felhasználó nem használ SFTP-t, nem ütközünk a ChrootDirectory (root-owner) korlátozásaiba.*
|
||||||
45
Dev/APS-SFTP01/sftp-notify.sh
Normal file
45
Dev/APS-SFTP01/sftp-notify.sh
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Locale beállítása, hogy a mail parancs ne hibázzon karakterkódolás miatt
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
export LANG=C.UTF-8
|
||||||
|
|
||||||
|
# Log fájl a hibakereséshez (adj rá írási jogot: chmod 666 /tmp/sftp-notify.log)
|
||||||
|
LOGFILE="/tmp/sftp-notify.log"
|
||||||
|
|
||||||
|
# Csak a sikeres bejelentkezésekről (open_session) küldünk értesítést
|
||||||
|
if [ "$PAM_TYPE" = "open_session" ]; then
|
||||||
|
|
||||||
|
# Környezet mentése logba
|
||||||
|
echo "--- $(/usr/bin/date): Login attempt for $PAM_USER from $PAM_RHOST ---" >> "$LOGFILE"
|
||||||
|
|
||||||
|
# Felhasználó shelljének ellenőrzése
|
||||||
|
USER_SHELL=$(/usr/bin/getent passwd "$PAM_USER" | /usr/bin/cut -d: -f7)
|
||||||
|
|
||||||
|
# Típus meghatározása
|
||||||
|
if [[ "$USER_SHELL" == *"/nologin" ]] || [[ "$USER_SHELL" == *"/false" ]]; then
|
||||||
|
LOGIN_TYPE="SFTP (Restricted)"
|
||||||
|
else
|
||||||
|
LOGIN_TYPE="SSH (Interactive)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
MESSAGE="Login értesítés ($PAM_SERVICE):
|
||||||
|
Típus: $LOGIN_TYPE
|
||||||
|
Felhasználó: $PAM_USER
|
||||||
|
Távoli gép: $PAM_RHOST
|
||||||
|
Shell: $USER_SHELL
|
||||||
|
Időpont: $(/usr/bin/date)
|
||||||
|
Host: $(/usr/bin/hostname)"
|
||||||
|
|
||||||
|
# Email küldés (abszolút útvonallal)
|
||||||
|
# Ellenőrizd, hogy a 'mail' parancs a /usr/sbin/mail helyen van-e!
|
||||||
|
echo "$MESSAGE" | /usr/sbin/mail -s "$LOGIN_TYPE: $PAM_USER" i.meszely@antares-apo.de >> "$LOGFILE" 2>&1
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Siker: Email elküldve." >> "$LOGFILE"
|
||||||
|
else
|
||||||
|
echo "HIBA: Az email küldés sikertelen volt! (Exit code: $?)" >> "$LOGFILE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
45
Dev/APS-SFTP01/sftp-notify_de.sh
Normal file
45
Dev/APS-SFTP01/sftp-notify_de.sh
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Locale-Einstellungen, damit der Mail-Befehl keine Zeichenkodierungsfehler verursacht
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
export LANG=C.UTF-8
|
||||||
|
|
||||||
|
# Logdatei für das Debugging (Schreibrechte setzen: chmod 666 /tmp/sftp-notify.log)
|
||||||
|
LOGFILE="/tmp/sftp-notify.log"
|
||||||
|
|
||||||
|
# Benachrichtigung nur bei erfolgreichen Anmeldungen (open_session)
|
||||||
|
if [ "$PAM_TYPE" = "open_session" ]; then
|
||||||
|
|
||||||
|
# Umgebung in Log speichern
|
||||||
|
echo "--- $(/usr/bin/date): Anmeldeversuch für $PAM_USER von $PAM_RHOST ---" >> "$LOGFILE"
|
||||||
|
|
||||||
|
# Überprüfung der Benutzer-Shell
|
||||||
|
USER_SHELL=$(/usr/bin/getent passwd "$PAM_USER" | /usr/bin/cut -d: -f7)
|
||||||
|
|
||||||
|
# Bestimmung des Typs
|
||||||
|
if [[ "$USER_SHELL" == *"/nologin" ]] || [[ "$USER_SHELL" == *"/false" ]]; then
|
||||||
|
LOGIN_TYPE="SFTP (Eingeschränkt)"
|
||||||
|
else
|
||||||
|
LOGIN_TYPE="SSH (Interaktiv)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
MESSAGE="Anmeldebenachrichtigung ($PAM_SERVICE):
|
||||||
|
Typ: $LOGIN_TYPE
|
||||||
|
Benutzer: $PAM_USER
|
||||||
|
Remote-Host: $PAM_RHOST
|
||||||
|
Shell: $USER_SHELL
|
||||||
|
Zeitpunkt: $(/usr/bin/date)
|
||||||
|
Host: $(/usr/bin/hostname)"
|
||||||
|
|
||||||
|
# E-Mail-Versand (mit absolutem Pfad)
|
||||||
|
# Prüfen, ob der 'mail'-Befehl unter /usr/sbin/mail verfügbar ist!
|
||||||
|
echo "$MESSAGE" | /usr/sbin/mail -s "$LOGIN_TYPE: $PAM_USER" i.meszely@antares-apo.de >> "$LOGFILE" 2>&1
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Erfolg: E-Mail gesendet." >> "$LOGFILE"
|
||||||
|
else
|
||||||
|
echo "FEHLER: E-Mail-Versand fehlgeschlagen! (Exit code: $?)" >> "$LOGFILE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
11
Dev/APS-SFTP01/ssh_user_im_ssd.conf.md
Normal file
11
Dev/APS-SFTP01/ssh_user_im_ssd.conf.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[mave-amondis]
|
||||||
|
comment = Mave Amondis SMB Share
|
||||||
|
path = /home/mave-amondis
|
||||||
|
valid users = mave-amondis
|
||||||
|
public = no
|
||||||
|
writable = yes
|
||||||
|
browsable = yes
|
||||||
|
guest ok = no
|
||||||
|
create mask = 0644
|
||||||
|
directory mask = 0755
|
||||||
|
force user = mave-amondis
|
||||||
13
Dev/APS-SMTP01/Adduser_für_SMTP_Relay.md
Normal file
13
Dev/APS-SMTP01/Adduser_für_SMTP_Relay.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
useradd -M -s /sbin/nologin n8nuser
|
||||||
|
passwd n8nuser
|
||||||
|
|
||||||
|
|
||||||
|
sudo postconf -e 'relayhost = [10.102.1.201]'
|
||||||
|
sudo postconf -e 'myorigin = antares-apo.de'
|
||||||
|
sudo postconf -e 'smtp_generic_maps = hash:/etc/postfix/generic'
|
||||||
|
|
||||||
|
echo "apslinux@aps-sftp01.localdomain sftp-alert@antares-apo.de" | sudo tee /etc/postfix/generic
|
||||||
|
sudo postmap /etc/postfix/generic
|
||||||
|
|
||||||
|
sudo systemctl restart postfix
|
||||||
|
|
||||||
52
Dev/APS-SMTP01/GEMINI_smtp_user.md
Normal file
52
Dev/APS-SMTP01/GEMINI_smtp_user.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# Postfix SMTP Hitelesítés Beállítása (Fedora 43)
|
||||||
|
|
||||||
|
Ez a dokumentum összefoglalja a lépéseket, amelyekkel lokális felhasználói hitelesítést (SASL) állítottunk be egy meglévő Postfix SMTP relay szerveren.
|
||||||
|
|
||||||
|
## 1. Szükséges csomagok telepítése
|
||||||
|
A SASL hitelesítéshez a Cyrus SASL könyvtárakra van szükség.
|
||||||
|
```bash
|
||||||
|
sudo dnf install cyrus-sasl cyrus-sasl-plain
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. SASL konfigurálása
|
||||||
|
Létrehoztuk a `/etc/sasl2/smtpd.conf` fájlt, amely meghatározza, hogyan ellenőrizze a Postfix a jelszavakat.
|
||||||
|
```conf
|
||||||
|
# /etc/sasl2/smtpd.conf
|
||||||
|
pwcheck_method: saslauthd
|
||||||
|
mech_list: plain login
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. Postfix konfiguráció módosítása
|
||||||
|
Beállítottuk a Postfix-et, hogy használja a SASL hitelesítést és engedélyezze a hitelesített kliensek számára a levélküldést.
|
||||||
|
```bash
|
||||||
|
sudo postconf -e 'smtpd_sasl_auth_enable = yes'
|
||||||
|
sudo postconf -e 'smtpd_sasl_security_options = noanonymous'
|
||||||
|
sudo postconf -e 'smtpd_sasl_local_domain = $myhostname'
|
||||||
|
sudo postconf -e 'broken_sasl_auth_clients = yes'
|
||||||
|
sudo postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination'
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Lokális felhasználó létrehozása
|
||||||
|
Létrehoztunk egy rendszerszintű felhasználót, aki csak hitelesítésre szolgál (nincs shell hozzáférése).
|
||||||
|
```bash
|
||||||
|
sudo useradd -M -s /sbin/nologin mdmuser
|
||||||
|
sudo passwd mdmuser
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Szolgáltatások indítása és engedélyezése
|
||||||
|
Elindítottuk a hitelesítésért felelős démont és újraindítottuk a Postfix-et.
|
||||||
|
```bash
|
||||||
|
sudo systemctl enable --now saslauthd
|
||||||
|
sudo systemctl restart postfix
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. Ellenőrzés és Tesztelés
|
||||||
|
A hitelesítés meglétét `telnet`-tel ellenőriztük:
|
||||||
|
```bash
|
||||||
|
telnet localhost 25
|
||||||
|
# EHLO teszt.local parancs után látni kell:
|
||||||
|
# 250-AUTH PLAIN LOGIN
|
||||||
|
```
|
||||||
|
|
||||||
|
A sikeres küldést a logokban az alábbi bejegyzés igazolja:
|
||||||
|
`sasl_method=PLAIN, sasl_username=mdmuser@antares-apo.local, status=sent`
|
||||||
71
Dev/APS-SMTP01/Postfix_SMTP_Relay_SOP_de.md
Normal file
71
Dev/APS-SMTP01/Postfix_SMTP_Relay_SOP_de.md
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# SOP: Konfiguration Postfix SMTP Relay (APS-SMTP01)
|
||||||
|
|
||||||
|
## 1. Zweck & Übersicht
|
||||||
|
Diese Dokumentation beschreibt die Konfiguration des zentralen Postfix Mail-Relays (**APS-SMTP01**). Das System dient als Brücke, um internen Geräten (Druckern, Scannern) und automatisierten IT-Skripten den E-Mail-Versand über unseren offiziellen Provider zu ermöglichen.
|
||||||
|
|
||||||
|
**System-Details:**
|
||||||
|
* **Server:** Linux (Ubuntu/Fedora basierend)
|
||||||
|
* **Hostname:** `aps-smtp01.aps.local`
|
||||||
|
* **IP-Adresse:** [Bitte interne IP ergänzen]
|
||||||
|
* **Dienst:** Postfix (MTA - Mail Transfer Agent)
|
||||||
|
|
||||||
|
## 2. Zentrale Konfigurationsdateien
|
||||||
|
Die gesamte Konfiguration befindet sich im Verzeichnis `/etc/postfix/`. Die wichtigsten Dateien sind:
|
||||||
|
|
||||||
|
* **`/etc/postfix/main.cf`**: Die Hauptkonfigurationsdatei mit den globalen Parametern.
|
||||||
|
* **`/etc/postfix/sasl_passwd`**: Enthält die Zugangsdaten für den externen Relay-Host (verschlüsselt via postmap).
|
||||||
|
* **`/etc/aliases`**: Definiert E-Mail-Weiterleitungen für lokale Benutzer.
|
||||||
|
|
||||||
|
## 3. Konfigurations-Ausschnitt (main.cf)
|
||||||
|
Die folgenden Parameter sind für den Betrieb als Relay entscheidend:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Beispiel-Konfiguration für Relay mit Authentifizierung
|
||||||
|
relayhost = [smtp.dein-provider.de]:587
|
||||||
|
mynetworks = 127.0.0.0/8, 192.168.1.0/24 [Hier interne Subnetze erlauben]
|
||||||
|
smtp_sasl_auth_enable = yes
|
||||||
|
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
||||||
|
smtp_tls_security_level = may
|
||||||
|
header_size_limit = 4096000
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Administrative Befehle & Wartung
|
||||||
|
Nach Änderungen an der Konfiguration müssen folgende Schritte durchgeführt werden:
|
||||||
|
|
||||||
|
### Konfiguration prüfen und laden:
|
||||||
|
```bash
|
||||||
|
# Syntax-Check der main.cf
|
||||||
|
postfix check
|
||||||
|
|
||||||
|
# Konfiguration neu laden (ohne Neustart des Dienstes)
|
||||||
|
systemctl reload postfix
|
||||||
|
```
|
||||||
|
|
||||||
|
### Passwort-Datenbank aktualisieren:
|
||||||
|
Wenn die `sasl_passwd` geändert wurde, muss die Datenbank neu generiert werden:
|
||||||
|
```bash
|
||||||
|
postmap /etc/postfix/sasl_passwd
|
||||||
|
systemctl restart postfix
|
||||||
|
```
|
||||||
|
|
||||||
|
### Überprüfung der Logs (Fehlersuche):
|
||||||
|
```bash
|
||||||
|
# Echtzeit-Überwachung der Mail-Logs
|
||||||
|
tail -f /var/log/mail.log
|
||||||
|
# Alternativ via journalctl
|
||||||
|
journalctl -u postfix -f
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Testen des E-Mail-Versands
|
||||||
|
Um die Funktionalität des Relays direkt auf dem Server zu testen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "Testmail von APS-SMTP01" | mail -s "Testbetreff" de@deine-domain.de
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. Bekannte Probleme (Troubleshooting)
|
||||||
|
* **Relay access denied:** Prüfen Sie den Parameter `mynetworks`. Die IP des sendenden Geräts muss dort erlaubt sein.
|
||||||
|
* **Connection timed out (Port 25/587):** Prüfen Sie die Firewall-Regeln auf dem Server und im Netzwerk (Ausgehende Verbindung zum Provider).
|
||||||
|
|
||||||
|
---
|
||||||
|
*Erstellt für die IT-Dokumentation - Projekt: IT Internal Repository*
|
||||||
7
Dev/autostart/autostart_url.desktop
Normal file
7
Dev/autostart/autostart_url.desktop
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Type=Application
|
||||||
|
Name=Autostart URL
|
||||||
|
Comment=Opens a specific URL with the default browser on GUI login.
|
||||||
|
Exec=chromium --kiosk https://status.aps.local/
|
||||||
|
Terminal=false
|
||||||
6
Dev/n8n/docker compose refresh.md
Normal file
6
Dev/n8n/docker compose refresh.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
docker compose pull
|
||||||
|
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
docker image prune -f
|
||||||
|
|
||||||
43
Dev/postfix_smtp_relay/etc/postfix/main.cf
Normal file
43
Dev/postfix_smtp_relay/etc/postfix/main.cf
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
alias_database = hash:/etc/aliases
|
||||||
|
alias_maps = hash:/etc/aliases
|
||||||
|
command_directory = /usr/bin
|
||||||
|
compatibility_level = 3.10
|
||||||
|
daemon_directory = /usr/libexec/postfix
|
||||||
|
data_directory = /var/lib/postfix
|
||||||
|
debug_peer_level = 2
|
||||||
|
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
|
||||||
|
html_directory = no
|
||||||
|
inet_interfaces = all
|
||||||
|
inet_protocols = all
|
||||||
|
mail_owner = postfix
|
||||||
|
mailq_path = /usr/bin/mailq.postfix
|
||||||
|
manpage_directory = /usr/share/man
|
||||||
|
meta_directory = /etc/postfix
|
||||||
|
mydestination = $myhostname, localhost.$mydomain, localhost
|
||||||
|
mynetworks = 127.0.0.0/8, 10.102.9.0/24, 10.101.0.0/16, 10.102.1.0/24
|
||||||
|
newaliases_path = /usr/bin/newaliases.postfix
|
||||||
|
queue_directory = /var/spool/postfix
|
||||||
|
readme_directory = /usr/share/doc/postfix/README_FILES
|
||||||
|
#relayhost = apshh-de0i.mail.protection.outlook.com
|
||||||
|
#relayhost = [apshh.mail.protection.outlook.com]:25
|
||||||
|
relayhost = [aps-exch01.aps.local]:25
|
||||||
|
#relayhost =
|
||||||
|
sample_directory = /usr/share/doc/postfix/samples
|
||||||
|
sendmail_path = /usr/bin/sendmail.postfix
|
||||||
|
setgid_group = postdrop
|
||||||
|
shlib_directory = /usr/lib64/postfix
|
||||||
|
#smtp_sasl_auth_enable = no
|
||||||
|
smtpd_sasl_auth_enable = yes
|
||||||
|
smtpd_sasl_security_options = noanonymous
|
||||||
|
smtpd_sasl_local_domain = $myhostname
|
||||||
|
broken_sasl_auth_clients = yes
|
||||||
|
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
|
||||||
|
smtp_tls_CApath = /etc/pki/tls/certs
|
||||||
|
smtp_tls_security_level = may
|
||||||
|
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
|
||||||
|
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
|
||||||
|
smtpd_tls_security_level = may
|
||||||
|
unknown_local_recipient_reject_code = 550
|
||||||
|
myhostname = antares-apo.local
|
||||||
|
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
|
||||||
|
|
||||||
37
Dev/postfix_smtp_relay/etc/postfix/main.cf.19.02.2026
Normal file
37
Dev/postfix_smtp_relay/etc/postfix/main.cf.19.02.2026
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
alias_database = hash:/etc/aliases
|
||||||
|
alias_maps = hash:/etc/aliases
|
||||||
|
command_directory = /usr/bin
|
||||||
|
compatibility_level = 3.10
|
||||||
|
daemon_directory = /usr/libexec/postfix
|
||||||
|
data_directory = /var/lib/postfix
|
||||||
|
debug_peer_level = 2
|
||||||
|
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
|
||||||
|
html_directory = no
|
||||||
|
inet_interfaces = all
|
||||||
|
inet_protocols = all
|
||||||
|
mail_owner = postfix
|
||||||
|
mailq_path = /usr/bin/mailq.postfix
|
||||||
|
manpage_directory = /usr/share/man
|
||||||
|
meta_directory = /etc/postfix
|
||||||
|
mydestination = $myhostname, localhost.$mydomain, localhost
|
||||||
|
mynetworks = 127.0.0.0/8, 10.102.9.0/24, 10.101.0.0/16, 10.102.1.0/24
|
||||||
|
newaliases_path = /usr/bin/newaliases.postfix
|
||||||
|
queue_directory = /var/spool/postfix
|
||||||
|
readme_directory = /usr/share/doc/postfix/README_FILES
|
||||||
|
#relayhost = apshh-de0i.mail.protection.outlook.com
|
||||||
|
#relayhost = [apshh.mail.protection.outlook.com]:25
|
||||||
|
relayhost = [aps-exch01.aps.local]:25
|
||||||
|
#relayhost =
|
||||||
|
sample_directory = /usr/share/doc/postfix/samples
|
||||||
|
sendmail_path = /usr/bin/sendmail.postfix
|
||||||
|
setgid_group = postdrop
|
||||||
|
shlib_directory = /usr/lib64/postfix
|
||||||
|
smtp_sasl_auth_enable = no
|
||||||
|
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
|
||||||
|
smtp_tls_CApath = /etc/pki/tls/certs
|
||||||
|
smtp_tls_security_level = may
|
||||||
|
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
|
||||||
|
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
|
||||||
|
smtpd_tls_security_level = may
|
||||||
|
unknown_local_recipient_reject_code = 550
|
||||||
|
myhostname = antares-apo.local
|
||||||
151
Dev/postfix_smtp_relay/etc/postfix/master.cf
Normal file
151
Dev/postfix_smtp_relay/etc/postfix/master.cf
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
#
|
||||||
|
# Postfix master process configuration file. For details on the format
|
||||||
|
# of the file, see the master(5) manual page (command: "man 5 master" or
|
||||||
|
# on-line: https://www.postfix.org/master.5.html).
|
||||||
|
#
|
||||||
|
# Do not forget to execute "postfix reload" after editing this file.
|
||||||
|
#
|
||||||
|
# ==========================================================================
|
||||||
|
# service type private unpriv chroot wakeup maxproc command + args
|
||||||
|
# (yes) (yes) (no) (never) (100)
|
||||||
|
# ==========================================================================
|
||||||
|
smtp inet n - n - - smtpd
|
||||||
|
#smtp inet n - n - 1 postscreen
|
||||||
|
#smtpd pass - - n - - smtpd
|
||||||
|
#dnsblog unix - - n - 0 dnsblog
|
||||||
|
#tlsproxy unix - - n - 0 tlsproxy
|
||||||
|
# Choose one: enable submission for loopback clients only, or for any client.
|
||||||
|
#127.0.0.1:submission inet n - n - - smtpd
|
||||||
|
#submission inet n - n - - smtpd
|
||||||
|
# -o syslog_name=postfix/submission
|
||||||
|
# -o smtpd_forbid_unauth_pipelining=no
|
||||||
|
# -o smtpd_tls_security_level=encrypt
|
||||||
|
# -o smtpd_sasl_auth_enable=yes
|
||||||
|
# -o smtpd_tls_auth_only=yes
|
||||||
|
# -o local_header_rewrite_clients=static:all
|
||||||
|
# -o smtpd_hide_client_session=yes
|
||||||
|
# -o smtpd_reject_unlisted_recipient=no
|
||||||
|
# Instead of specifying complex smtpd_<xxx>_restrictions here,
|
||||||
|
# specify "smtpd_<xxx>_restrictions=$mua_<xxx>_restrictions"
|
||||||
|
# here, and specify mua_<xxx>_restrictions in main.cf (where
|
||||||
|
# "<xxx>" is "client", "helo", "sender", "relay", or "recipient").
|
||||||
|
# -o smtpd_client_restrictions=
|
||||||
|
# -o smtpd_helo_restrictions=
|
||||||
|
# -o smtpd_sender_restrictions=
|
||||||
|
# -o smtpd_relay_restrictions=
|
||||||
|
# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
|
||||||
|
# -o milter_macro_daemon_name=ORIGINATING
|
||||||
|
# Choose one: enable submissions for loopback clients only, or for any client.
|
||||||
|
#127.0.0.1:submissions inet n - n - - smtpd
|
||||||
|
#submissions inet n - n - - smtpd
|
||||||
|
# -o syslog_name=postfix/submissions
|
||||||
|
# -o smtpd_forbid_unauth_pipelining=no
|
||||||
|
# -o smtpd_tls_wrappermode=yes
|
||||||
|
# -o smtpd_sasl_auth_enable=yes
|
||||||
|
# -o local_header_rewrite_clients=static:all
|
||||||
|
# -o smtpd_hide_client_session=yes
|
||||||
|
# -o smtpd_reject_unlisted_recipient=no
|
||||||
|
# Instead of specifying complex smtpd_<xxx>_restrictions here,
|
||||||
|
# specify "smtpd_<xxx>_restrictions=$mua_<xxx>_restrictions"
|
||||||
|
# here, and specify mua_<xxx>_restrictions in main.cf (where
|
||||||
|
# "<xxx>" is "client", "helo", "sender", "relay", or "recipient").
|
||||||
|
# -o smtpd_client_restrictions=
|
||||||
|
# -o smtpd_helo_restrictions=
|
||||||
|
# -o smtpd_sender_restrictions=
|
||||||
|
# -o smtpd_relay_restrictions=
|
||||||
|
# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
|
||||||
|
# -o milter_macro_daemon_name=ORIGINATING
|
||||||
|
#628 inet n - n - - qmqpd
|
||||||
|
pickup unix n - n 60 1 pickup
|
||||||
|
cleanup unix n - n - 0 cleanup
|
||||||
|
qmgr unix n - n 300 1 qmgr
|
||||||
|
#qmgr unix n - n 300 1 oqmgr
|
||||||
|
tlsmgr unix - - n 1000? 1 tlsmgr
|
||||||
|
rewrite unix - - n - - trivial-rewrite
|
||||||
|
bounce unix - - n - 0 bounce
|
||||||
|
defer unix - - n - 0 bounce
|
||||||
|
trace unix - - n - 0 bounce
|
||||||
|
verify unix - - n - 1 verify
|
||||||
|
flush unix n - n 1000? 0 flush
|
||||||
|
proxymap unix - - n - - proxymap
|
||||||
|
proxywrite unix - - n - 1 proxymap
|
||||||
|
smtp unix - - n - - smtp
|
||||||
|
relay unix - - n - - smtp
|
||||||
|
-o syslog_name=${multi_instance_name?{$multi_instance_name}:{postfix}}/$service_name
|
||||||
|
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
|
||||||
|
showq unix n - n - - showq
|
||||||
|
error unix - - n - - error
|
||||||
|
retry unix - - n - - error
|
||||||
|
discard unix - - n - - discard
|
||||||
|
local unix - n n - - local
|
||||||
|
virtual unix - n n - - virtual
|
||||||
|
lmtp unix - - n - - lmtp
|
||||||
|
anvil unix - - n - 1 anvil
|
||||||
|
scache unix - - n - 1 scache
|
||||||
|
postlog unix-dgram n - n - 1 postlogd
|
||||||
|
#
|
||||||
|
# ====================================================================
|
||||||
|
# Interfaces to non-Postfix software. Be sure to examine the manual
|
||||||
|
# pages of the non-Postfix software to find out what options it wants.
|
||||||
|
#
|
||||||
|
# Many of the following services use the Postfix pipe(8) delivery
|
||||||
|
# agent. See the pipe(8) man page for information about ${recipient}
|
||||||
|
# and other message envelope options.
|
||||||
|
# ====================================================================
|
||||||
|
#
|
||||||
|
# maildrop. See the Postfix MAILDROP_README file for details.
|
||||||
|
# Also specify in main.cf: maildrop_destination_recipient_limit=1
|
||||||
|
#
|
||||||
|
#maildrop unix - n n - - pipe
|
||||||
|
# flags=DRXhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
|
||||||
|
#
|
||||||
|
# ====================================================================
|
||||||
|
#
|
||||||
|
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
|
||||||
|
#
|
||||||
|
# Specify in cyrus.conf:
|
||||||
|
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
|
||||||
|
#
|
||||||
|
# Specify in main.cf one or more of the following:
|
||||||
|
# mailbox_transport = lmtp:inet:localhost
|
||||||
|
# virtual_transport = lmtp:inet:localhost
|
||||||
|
#
|
||||||
|
# ====================================================================
|
||||||
|
#
|
||||||
|
# Cyrus 2.1.5 (Amos Gouaux)
|
||||||
|
# Also specify in main.cf: cyrus_destination_recipient_limit=1
|
||||||
|
#
|
||||||
|
#cyrus unix - n n - - pipe
|
||||||
|
# flags=DRX user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}
|
||||||
|
#
|
||||||
|
# ====================================================================
|
||||||
|
#
|
||||||
|
# Old example of delivery via Cyrus.
|
||||||
|
#
|
||||||
|
#old-cyrus unix - n n - - pipe
|
||||||
|
# flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user}
|
||||||
|
#
|
||||||
|
# ====================================================================
|
||||||
|
#
|
||||||
|
# See the Postfix UUCP_README file for configuration details.
|
||||||
|
#
|
||||||
|
#uucp unix - n n - - pipe
|
||||||
|
# flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
|
||||||
|
#
|
||||||
|
# ====================================================================
|
||||||
|
#
|
||||||
|
# Other external delivery methods.
|
||||||
|
#
|
||||||
|
#ifmail unix - n n - - pipe
|
||||||
|
# flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
|
||||||
|
#
|
||||||
|
#bsmtp unix - n n - - pipe
|
||||||
|
# flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
|
||||||
|
#
|
||||||
|
#scalemail-backend unix - n n - 2 pipe
|
||||||
|
# flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
|
||||||
|
# ${nexthop} ${user} ${extension}
|
||||||
|
#
|
||||||
|
#mailman unix - n n - - pipe
|
||||||
|
# flags=FRX user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
|
||||||
|
# ${nexthop} ${user}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
switch_name,ip_address,firmware_version
|
||||||
|
NET-SW01,10.220.1.84,PL.10.16.1006
|
||||||
|
NET-SW02,10.220.1.85,PL.10.16.1006
|
||||||
|
NET-SW01,10.220.1.84,PL.10.16.1006
|
||||||
|
NET-SW02,10.220.1.85,PL.10.16.1006
|
||||||
|
NET-SW04,10.220.1.86,PL.10.16.1006
|
||||||
|
NET-SW05,10.220.1.87,PL.10.16.1006
|
||||||
|
NET-SW06,10.220.1.88,PL.10.16.1006
|
||||||
|
NET-SW01-CORE,10.220.1.89,LL.10.16.1006
|
||||||
|
NET-SW07,10.220.1.90,PL.10.16.1006
|
||||||
|
NET-SW08,10.220.1.91,PL.10.16.1006
|
||||||
|
NET-SW09,10.220.1.92,PL.10.16.1006
|
||||||
|
NET-SW10,10.220.1.93,PL.10.16.1006
|
||||||
|
NET-SW11,10.220.1.94,PL.10.16.1006
|
||||||
|
NET-SW13,10.220.1.96,PL.10.16.1006
|
||||||
|
NET-SW16,10.220.1.98,PL.10.16.1006
|
||||||
|
N/A,10.220.1.99,Auth Failed
|
||||||
|
@@ -0,0 +1,17 @@
|
|||||||
|
switch_name,ip_address,firmware_version
|
||||||
|
NET-SW01,10.220.1.84,PL.10.16.1006
|
||||||
|
NET-SW02,10.220.1.85,PL.10.16.1006
|
||||||
|
NET-SW01,10.220.1.84,PL.10.16.1006
|
||||||
|
NET-SW02,10.220.1.85,PL.10.16.1006
|
||||||
|
NET-SW04,10.220.1.86,PL.10.16.1006
|
||||||
|
NET-SW05,10.220.1.87,PL.10.16.1006
|
||||||
|
NET-SW06,10.220.1.88,PL.10.16.1006
|
||||||
|
NET-SW01-CORE,10.220.1.89,LL.10.16.1006
|
||||||
|
NET-SW07,10.220.1.90,PL.10.16.1006
|
||||||
|
NET-SW08,10.220.1.91,PL.10.16.1006
|
||||||
|
NET-SW09,10.220.1.92,PL.10.16.1006
|
||||||
|
NET-SW10,10.220.1.93,PL.10.16.1006
|
||||||
|
NET-SW11,10.220.1.94,PL.10.16.1006
|
||||||
|
NET-SW13,10.220.1.96,PL.10.16.1006
|
||||||
|
NET-SW16,10.220.1.98,PL.10.16.1006
|
||||||
|
N/A,10.220.1.99,Auth Failed
|
||||||
|
@@ -1,19 +1,20 @@
|
|||||||
{
|
{
|
||||||
"network": {
|
"switch_ips": [
|
||||||
"subnet": "10.101.0.0/24",
|
"10.220.1.84",
|
||||||
"auto_detect": false
|
"10.220.1.85",
|
||||||
},
|
"10.220.1.86",
|
||||||
"scanning": {
|
"10.220.1.87",
|
||||||
"ping_timeout": 0.3,
|
"10.220.1.88",
|
||||||
"ping_delay": 0.001,
|
"10.220.1.89",
|
||||||
"max_threads": 10
|
"10.220.1.90",
|
||||||
},
|
"10.220.1.91",
|
||||||
"database": {
|
"10.220.1.92",
|
||||||
"devices_file": "known_devices.json"
|
"10.220.1.93",
|
||||||
},
|
"10.220.1.94",
|
||||||
"logging": {
|
"10.220.1.96",
|
||||||
"enabled": true,
|
"10.220.1.98",
|
||||||
"log_file": "network_scanner.log",
|
"10.220.1.99"
|
||||||
"log_level": "INFO"
|
],
|
||||||
}
|
"username": "svc.operator",
|
||||||
|
"password": "NuAaGTNPQWyeneQLI5qr"
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
PASSWORD = os.getenv('ARUBA_PASSWORD')
|
PASSWORD = os.getenv('ARUBA_PASSWORD', 'NuAaGTNPQWyeneQLI5qr')
|
||||||
if not PASSWORD:
|
if not PASSWORD:
|
||||||
print("Hiba: Az ARUBA_PASSWORD környezeti változó nincs beállítva.")
|
print("Hiba: Az ARUBA_PASSWORD környezeti változó nincs beállítva.")
|
||||||
exit()
|
exit()
|
||||||
|
|||||||
5
Doc/Ai/Codex_AI_CLI.md
Normal file
5
Doc/Ai/Codex_AI_CLI.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Codex
|
||||||
|
npm i -g @openai/codex
|
||||||
|
|
||||||
|
verbung@
|
||||||
|
virgI6774#6774
|
||||||
3
Doc/Aps/Neue User für SMTP Relay.md
Normal file
3
Doc/Aps/Neue User für SMTP Relay.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Neue User für SMTP Relay
|
||||||
|
sudo useradd -M -s /sbin/nologin printeruser
|
||||||
|
sudo passwd printeruser
|
||||||
20
Doc/Aps/Securitas.md
Normal file
20
Doc/Aps/Securitas.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
i.A. Tim Grüner
|
||||||
|
Projektleiter
|
||||||
|
Neuer Höltigbaum 26-30
|
||||||
|
22143 Hamburg
|
||||||
|
Mobil: +49 170 7983858
|
||||||
|
|
||||||
|
i. V. Dipl.-Ing.(FH) Jens Utke
|
||||||
|
Senior Regional Account Manager
|
||||||
|
Securitas Technology GmbH
|
||||||
|
Neuer Höltigbaum 26-30
|
||||||
|
22143 Hamburg
|
||||||
|
M: +49 151 12237016
|
||||||
|
i.A. Nico Wiehr
|
||||||
|
Servicekoordinator
|
||||||
|
T: +49 40 4149392221
|
||||||
|
|
||||||
|
a.NR 206065
|
||||||
|
|
||||||
|
IxEx$99
|
||||||
|
|
||||||
49
Doc/Aps/User/Alakhras_Ahmed.md
Normal file
49
Doc/Aps/User/Alakhras_Ahmed.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
PS C:\Tools> .\Get-ADUserDetails.ps1 A.Alakhras
|
||||||
|
|
||||||
|
========================================================
|
||||||
|
AD FELHASZNALOI ADATOK: Alakhras, Ahmed
|
||||||
|
========================================================
|
||||||
|
|
||||||
|
[ Allgemein / Altalanos ]
|
||||||
|
|
||||||
|
|
||||||
|
Vorname (Keresztnev) : Ahmed
|
||||||
|
Nachname (Vezeteknev) : Alakhras
|
||||||
|
Anzeigename : Alakhras, Ahmed
|
||||||
|
Beschreibung :
|
||||||
|
Buero (Iroda) :
|
||||||
|
Telefon : +49 40 523889-0
|
||||||
|
E-Mail : A.Alakhras@antares-apo.de
|
||||||
|
Webseite : www.aps-hh.de
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Adresse / Cim ]
|
||||||
|
|
||||||
|
|
||||||
|
Strasse : Kuehnstraße 75
|
||||||
|
Postfach : {}
|
||||||
|
PLZ (Iranyitoszam) : 22045
|
||||||
|
Stadt (Varos) : Hamburg
|
||||||
|
Bundesland (Megye) : Hamburg
|
||||||
|
Land : Deutschland
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Organisation / Szervezet ]
|
||||||
|
|
||||||
|
|
||||||
|
Titel (Beosztas) :
|
||||||
|
Abteilung (Osztaly) : Lager
|
||||||
|
Firma (Ceg) : antares-apotheke Pharma Service e.K.
|
||||||
|
Vorgesetzter (Fonok) : Nincs megadva
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Gruppen / Csoporttagsagok (8 db) ]
|
||||||
|
DG_antares-apotheke-Jenfeld, Domänen-Benutzer, LIZ-M365-E3, Org-APS-alle, Org-GHKV, Org-Lager, Org-LO, VPN-User-Antares
|
||||||
|
|
||||||
|
========================================================
|
||||||
49
Doc/Aps/User/Bremer Bärbel.md
Normal file
49
Doc/Aps/User/Bremer Bärbel.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
PS C:\Tools> .\Get-ADUserDetails.ps1 -UserName "b.bremer"
|
||||||
|
|
||||||
|
========================================================
|
||||||
|
AD FELHASZNALOI ADATOK: Bremer Bärbel
|
||||||
|
========================================================
|
||||||
|
|
||||||
|
[ Allgemein / Altalanos ]
|
||||||
|
|
||||||
|
|
||||||
|
Vorname (Keresztnev) : Bärbel
|
||||||
|
Nachname (Vezeteknev) : Bremer
|
||||||
|
Anzeigename : Bremer Bärbel
|
||||||
|
Beschreibung :
|
||||||
|
Buero (Iroda) :
|
||||||
|
Telefon : +49 4141 7886-276
|
||||||
|
E-Mail : b.bremer@antares-apo.de
|
||||||
|
Webseite : www.aps-hh.de
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Adresse / Cim ]
|
||||||
|
|
||||||
|
|
||||||
|
Strasse : Harsefelder Straße 6
|
||||||
|
Postfach : {}
|
||||||
|
PLZ (Iranyitoszam) : 21680
|
||||||
|
Stadt (Varos) : Stade
|
||||||
|
Bundesland (Megye) : Niedersachsen
|
||||||
|
Land : Deutschland
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Organisation / Szervezet ]
|
||||||
|
|
||||||
|
|
||||||
|
Titel (Beosztas) : Buchhaltung
|
||||||
|
Abteilung (Osztaly) : STD-OFZ
|
||||||
|
Firma (Ceg) : antares-apotheke Stade e.K.
|
||||||
|
Vorgesetzter (Fonok) : Huth Sybille
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Gruppen / Csoporttagsagok (11 db) ]
|
||||||
|
DG_antares-apotheke-Stade, Domänen-Benutzer, FS_STD_BO_Daten_C, FS_STD_KV_Daten_C, FS_STD_OFZ_Daten_C, FS_STD_ONKO_Daten_C, FS_STD_VW_Daten_C, LIZ-M365-E3, MAP-Pfad-Z, Org-STD-Alle, Org-STD-FIBU
|
||||||
|
|
||||||
|
========================================================
|
||||||
49
Doc/Aps/User/Steffen_Max.md
Normal file
49
Doc/Aps/User/Steffen_Max.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
PS C:\Tools> .\Get-ADUserDetails.ps1 -UserName "m.steffen"
|
||||||
|
|
||||||
|
========================================================
|
||||||
|
AD FELHASZNALOI ADATOK: Steffen, Max
|
||||||
|
========================================================
|
||||||
|
|
||||||
|
[ Allgemein / Altalanos ]
|
||||||
|
|
||||||
|
Vorname (Keresztnev) : Max
|
||||||
|
Nachname (Vezeteknev) : Steffen
|
||||||
|
Anzeigename : Steffen, Max
|
||||||
|
Beschreibung :
|
||||||
|
Buero (Iroda) :
|
||||||
|
Telefon : +49 4141 7886-275
|
||||||
|
E-Mail : m.steffen@antares-apo.de
|
||||||
|
Webseite : www.aps-hh.de
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Adresse / Cim ]
|
||||||
|
|
||||||
|
Strasse : Harsefelder Straße 6
|
||||||
|
Postfach : {}
|
||||||
|
PLZ (Iranyitoszam) : 21680
|
||||||
|
Stadt (Varos) : Stade
|
||||||
|
Bundesland (Megye) : Niedersachsen
|
||||||
|
Land : Deutschland
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Organisation / Szervezet ]
|
||||||
|
|
||||||
|
|
||||||
|
Titel (Beosztas) : Buchhaltung
|
||||||
|
Abteilung (Osztaly) : Org-STD-FIBU
|
||||||
|
Firma (Ceg) : antares-apotheke Stade e.K.
|
||||||
|
Vorgesetzter (Fonok) : Huth Sybille
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
[ Gruppen / Csoporttagsagok (11 db) ]
|
||||||
|
DG_antares-apotheke-Stade,
|
||||||
|
Domänen-Benutzer
|
||||||
|
FS_STD_BO_Daten_C
|
||||||
|
FS_STD_KV_Daten_C
|
||||||
|
FS_STD_OFZ_Daten_C
|
||||||
|
FS_STD_ONKO_Daten_C
|
||||||
|
FS_STD_VW_Daten_C
|
||||||
|
LIZ-M365-E3
|
||||||
|
MAP-Pfad-Z
|
||||||
|
Org-STD-Alle
|
||||||
|
Org-STD-FIBU
|
||||||
8
Doc/Aps/User/mave-sftp.md
Normal file
8
Doc/Aps/User/mave-sftp.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Username: mave-sftp
|
||||||
|
Password : asdWFWF45mfEGGEwf
|
||||||
|
Server : 10.102.1.202
|
||||||
|
Server : aps-sftp01
|
||||||
|
|
||||||
|
User kann schrieben unten die Schnittstellen/Bremen/ Ordner
|
||||||
|
|
||||||
|
|
||||||
BIN
Doc/Arbeitsagentur/20260208_031203_LEISTUNGSNACHWEIS.pdf
Normal file
BIN
Doc/Arbeitsagentur/20260208_031203_LEISTUNGSNACHWEIS.pdf
Normal file
Binary file not shown.
@@ -6,9 +6,32 @@ https://www.tc-telefon.de/Kontakt/
|
|||||||
|
|
||||||
-- https://www.behnke-online.de/de/partner-plz-20000-29999
|
-- https://www.behnke-online.de/de/partner-plz-20000-29999
|
||||||
|
|
||||||
4.
|
8. Anrufen Fabio wegen die Donau Drucker Toner lvl 18%
|
||||||
|
|
||||||
5.
|
11.
|
||||||
|
003 - Becker Florian
|
||||||
|
010 - Wako
|
||||||
|
025 - Hinck Stefanie (Stru)
|
||||||
|
026 - va den Berg Wiebke (Stru)
|
||||||
|
|
||||||
verbung@meszely.eu
|
|
||||||
ionOs#6774#IonOs
|
Kosten aps - Continia - kosten.aps.7739934@cdc.continiaonline.com
|
||||||
|
Einkauf aps - Continia - einkauf.aps.7739934@cdc.continiaonline.com
|
||||||
|
|
||||||
|
Informationstechnologie
|
||||||
|
Software
|
||||||
|
|
||||||
|
tv-token api
|
||||||
|
297eca2e0221361646d3aa88f4b00e6f
|
||||||
|
|
||||||
|
curl -H 'X-Auth-Token: 297eca2e0221361646d3aa88f4b00e6f' https://10.102.1.201/api/v0
|
||||||
|
|
||||||
|
|
||||||
|
jasmin gresen
|
||||||
|
|
||||||
|
PG19 : Officin
|
||||||
|
|
||||||
|
15454
|
||||||
|
|
||||||
|
ilka banemann - laptop - outlook (profile)
|
||||||
|
inten im Officein drucker von Iphone
|
||||||
|
|||||||
BIN
Doc/Bilders/Development.png
Normal file
BIN
Doc/Bilders/Development.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 877 KiB |
BIN
Doc/Bilders/Infrastrukture.png
Normal file
BIN
Doc/Bilders/Infrastrukture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
BIN
Doc/Bilders/Infrastrukture2.png
Normal file
BIN
Doc/Bilders/Infrastrukture2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 MiB |
BIN
Doc/Bilders/Knowledge Base.png
Normal file
BIN
Doc/Bilders/Knowledge Base.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 789 KiB |
BIN
Doc/Bilders/Scripts.png
Normal file
BIN
Doc/Bilders/Scripts.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 760 KiB |
@@ -1,36 +1,35 @@
|
|||||||
Normal:
|
Normal: i.meszely - vi..+Ma
|
||||||
i.meszely
|
Lokal: t2.meszely - ep..Ep
|
||||||
vi..+Ma
|
Server: t1.meszely - warP#....#Mac
|
||||||
|
Ent: adm.meszely@aps-hh.de - win
|
||||||
|
|
||||||
Lokal:
|
linux: q5tOCJLo
|
||||||
t2.meszely
|
Mave: WERNER
|
||||||
ep..Ep
|
Wifi: a494052388958b494052388958
|
||||||
|
Wifi: ASR22Antares
|
||||||
|
KP: MuVD9Zcc4HK0jDQ4HzMt
|
||||||
|
|
||||||
Server:
|
Sftp : mave-sftp : asdWFWF45mfEGGEwf
|
||||||
t1.meszely
|
SMB : mave-amondis : asdWFasdas43fEGGCf
|
||||||
warP#....#Maci
|
|
||||||
|
|
||||||
000
|
Smtp : mdmuser : Q8ZdNSEFCPwDCpoPsage
|
||||||
pandA#...#min
|
Smtp : n8nuser : Q8ZdNSEFCPwDCpoPsage
|
||||||
|
Smtp : drucker : Q8ZdNSrFCpwdCPoPsAge
|
||||||
|
Smtp : elpro : Q8ZwerrRTHwdDfoPsAge
|
||||||
|
Smtp : maveuser: Q8456rrRgwegwDoRGSRQ
|
||||||
|
Smtp : useralert : Q845Rr345gwDoRsdRQ
|
||||||
|
|
||||||
Wifi:
|
monitor - GNYOJTPFASNEEICPSV
|
||||||
a494052388958b494052388958
|
|
||||||
Wifi:
|
|
||||||
ASR22Antares
|
|
||||||
|
|
||||||
KP:
|
antares-apo.de
|
||||||
MuVD9Zcc4HK0jDQ4HzMt
|
QuickHelp : win+ctrl+Q
|
||||||
|
|
||||||
Web:
|
Web: https://aps-hh.estargmbh.de/ virgI6774+
|
||||||
https://aps-hh.estargmbh.de/
|
|
||||||
virgI6774+
|
|
||||||
|
|
||||||
Onboarding :
|
Onboarding :
|
||||||
file:///Z:/IT_Dokumentation/APS-IT-Dokumentation/onboarding.pdf
|
file:///Z:/IT_Dokumentation/APS-IT-Dokumentation/onboarding.pdf
|
||||||
|
|
||||||
DHCP Servers:
|
DHCP Servers: APS-Infra01, APS-Infra02
|
||||||
APS-Infra01
|
|
||||||
APS-Infra02
|
|
||||||
|
|
||||||
Mysql server:
|
Mysql server:
|
||||||
root -
|
root -
|
||||||
@@ -73,7 +72,10 @@ Sophos :
|
|||||||
https://vpn.aps-hh.de:7443/
|
https://vpn.aps-hh.de:7443/
|
||||||
|
|
||||||
|
|
||||||
Mobil : 0171 / 62 29 88 6
|
|
||||||
|
hhbeshop.rdp
|
||||||
|
|
||||||
|
Mobil : 0171 62 29 88 6
|
||||||
E-Mail:D.Laumann@mavesoft.de
|
E-Mail:D.Laumann@mavesoft.de
|
||||||
|
|
||||||
steve : 0017649423884
|
steve : 0017649423884
|
||||||
@@ -85,11 +87,6 @@ AWs5XRhwkiBQcFf8Da
|
|||||||
Siebert Kristina -
|
Siebert Kristina -
|
||||||
Dirk Jänicke 0-6000 - 94 - 060 , 0 6000 94 060
|
Dirk Jänicke 0-6000 - 94 - 060 , 0 6000 94 060
|
||||||
|
|
||||||
543 Jan
|
|
||||||
546 Mario
|
|
||||||
|
|
||||||
Dirk Jänicke 0-6000 - 94 - 060 , 0 6000 94 060
|
|
||||||
|
|
||||||
powercfg /h off
|
powercfg /h off
|
||||||
|
|
||||||
SOIB-2024! oder SOIB2024
|
SOIB-2024! oder SOIB2024
|
||||||
@@ -100,6 +97,8 @@ ANTARES
|
|||||||
|
|
||||||
ASR22Antares
|
ASR22Antares
|
||||||
|
|
||||||
|
1234
|
||||||
|
|
||||||
Status Lokal Remote Netzwerk
|
Status Lokal Remote Netzwerk
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -127,18 +126,20 @@ virgI6774#Virgi
|
|||||||
|
|
||||||
virgI6774#
|
virgI6774#
|
||||||
|
|
||||||
|
verbung@meszely.eu
|
||||||
|
ionOs#6774#IonOs
|
||||||
|
|
||||||
nogy tudom a hälozati jelszot viszaällitani windows serveren valami reset-networkpassword
|
nogy tudom a hälozati jelszot viszaällitani windows serveren valami reset-networkpassword
|
||||||
Reset-ComputerMachinePassword -Server dc01.domain.local -Credential (Get-Credential)
|
Reset-ComputerMachinePassword -Server dc01.domain.local -Credential (Get-Credential)
|
||||||
|
|
||||||
NET-SW02 - 1/1/23
|
homeassistant key : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhMzNjZGMzMDcwNzE0ZTY2YTkwMGUwMjgzMTcxNTg2ZSIsImlhdCI6MTc3MDM2MTk1MiwiZXhwIjoyMDg1NzIxOTUyfQ.6kG97i32BJb_HknD7R-y8xHqSpTaofbmTtoqjB8g1-w
|
||||||
Drucker Emmer
|
|
||||||
|
|
||||||
NET-SW02 - 1/1/25
|
|
||||||
Drucek Etsch
|
|
||||||
|
|
||||||
gemini api key : AIzaSyBUvqSD7llReHbCQAosuDDy1Q5gIT6pKLw
|
gemini api key : AIzaSyBUvqSD7llReHbCQAosuDDy1Q5gIT6pKLw
|
||||||
gitea apy key : d5747e87cb2e1022904c4a60f801cb2758542abb
|
gitea api key : d5747e87cb2e1022904c4a60f801cb2758542abb
|
||||||
apple app key : wflh-aaft-dizu-cyxm
|
apple api key : wflh-aaft-dizu-cyxm
|
||||||
|
uptimerobot api key : u3239099-556320ad0c63c591a7742a47
|
||||||
|
|
||||||
|
uptmerobot@meszely.eu
|
||||||
|
virgI
|
||||||
|
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
docker-compose up -d --build
|
docker-compose up -d --build
|
||||||
@@ -162,12 +163,23 @@ q5tOCJLo
|
|||||||
hipas
|
hipas
|
||||||
321684
|
321684
|
||||||
|
|
||||||
Security .. Mario , akku defekt... Spranke...
|
|
||||||
|
|
||||||
uptmerobot@meszely.eu
|
|
||||||
virgI
|
|
||||||
u3239099-556320ad0c63c591a7742a47
|
|
||||||
|
|
||||||
verbung@meszely.eu
|
verbung@meszely.eu
|
||||||
ionOs#6774#IonOs
|
ionOs#6774#IonOs
|
||||||
|
|
||||||
|
3840 x
|
||||||
|
4096 x 2160
|
||||||
|
|
||||||
|
https://prtg.aps.local/public/mapshow.htm?id=5643&mapid=4864A75D-BDEF-4C43-AD6E-02F79DA4A1EC
|
||||||
|
|
||||||
|
|
||||||
|
RCPT TO:<istvan@meszely.eu>
|
||||||
|
|
||||||
|
|
||||||
|
00:08:7B:25:DD:F3
|
||||||
|
|
||||||
|
Kapelou2025
|
||||||
|
|
||||||
|
Schliesinger mail:
|
||||||
|
wegner@
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,3 +26,8 @@ xqol-fwhb-cmnb-vgac
|
|||||||
|
|
||||||
APS-FILE02
|
APS-FILE02
|
||||||
User$\p.heinrich\_Scans
|
User$\p.heinrich\_Scans
|
||||||
|
|
||||||
|
IXOS
|
||||||
|
j.berg - 1234
|
||||||
|
|
||||||
|
+4940523889211
|
||||||
|
|||||||
49
Doc/Drucklog_MySQL_SOP_de.md
Normal file
49
Doc/Drucklog_MySQL_SOP_de.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# SOP: Export von Druckprotokollen in MySQL (drucklog_export_v.0.1.ps1)
|
||||||
|
|
||||||
|
## 1. Zweck des Skripts
|
||||||
|
Dieses PowerShell-Skript dient der zentralen Erfassung von Druckvorgängen auf Windows-Servern oder Workstations. Es liest das Ereignisprotokoll `Microsoft-Windows-PrintService/Operational` (Event ID 307) aus und überträgt die Details (Benutzer, Dokumentname, Seitenanzahl, Drucker) in eine MySQL-Datenbank (`drucklog`).
|
||||||
|
|
||||||
|
**Nutzen:** Ermöglicht die langfristige Analyse des Druckaufkommens und die Erstellung von Reports für die IT-Administration.
|
||||||
|
|
||||||
|
## 2. Voraussetzungen & Installation
|
||||||
|
Damit das Skript ordnungsgemäß ausgeführt werden kann, müssen folgende Voraussetzungen erfüllt sein:
|
||||||
|
|
||||||
|
* **MySQL Connector NET:** Das Skript erwartet die `MySql.Data.dll` im Pfad:
|
||||||
|
`C:\Program Files (x86)\MySQL\MySQL Connector NET 9.4\MySql.Data.dll`
|
||||||
|
* **PrintService Log:** Das "Operational"-Protokoll im Windows Event Viewer muss **aktiviert** sein.
|
||||||
|
* **MySQL Datenbank:** Eine Datenbank namens `drucklog` mit der entsprechenden Tabellenstruktur muss auf dem Host `10.102.1.65` vorhanden sein.
|
||||||
|
|
||||||
|
## 3. Zentrale Konfiguration (Skript-Header)
|
||||||
|
Die Verbindungsparameter sind im Skript wie folgt definiert:
|
||||||
|
|
||||||
|
* **MySQL-Host:** `10.102.1.65`
|
||||||
|
* **Datenbank-Benutzer:** `svc.druckerlog`
|
||||||
|
* **Datenbank-Passwort:** (Im Skript hinterlegt)
|
||||||
|
* **Ziel-Datenbank:** `drucklog`
|
||||||
|
* **Log-Pfad:** `C:\Tools\drucklog_task.log` (Überprüfung der Skriptausführung)
|
||||||
|
|
||||||
|
## 4. Ausführung & Automatisierung
|
||||||
|
Das Skript kann manuell oder über die **Windows Aufgabenplanung (Task Scheduler)** ausgeführt werden.
|
||||||
|
|
||||||
|
### Manueller Test (PowerShell):
|
||||||
|
```powershell
|
||||||
|
# In das Verzeichnis wechseln und ausführen
|
||||||
|
.\drucklog_export_v.0.1.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Empfohlene Automatisierung (Task Scheduler):
|
||||||
|
* **Trigger:** Täglich, Wiederholung alle 1 Stunde.
|
||||||
|
* **Aktion:** `powershell.exe`
|
||||||
|
* **Argumente:** `-ExecutionPolicy Bypass -File "C:\Scripts\drucklog_export_v.0.1.ps1"`
|
||||||
|
|
||||||
|
## 5. Monitoring & Protokollierung
|
||||||
|
Das Skript schreibt bei jedem Durchlauf einen Zeitstempel in die lokale Datei:
|
||||||
|
`C:\Tools\drucklog_task.log`
|
||||||
|
|
||||||
|
Bei Fehlern in der Datenbankverbindung prüfen Sie bitte, ob der MySQL-Host `10.102.1.65` vom lokalen System aus erreichbar ist (Port 3306).
|
||||||
|
|
||||||
|
## 6. Sicherheitshinweis
|
||||||
|
**Achtung:** Das Skript enthält Datenbank-Zugangsdaten im Klartext. Stellen Sie sicher, dass die NTFS-Berechtigungen auf dem Windows-Server so gesetzt sind, dass nur das IT-Team Zugriff auf das Skriptverzeichnis hat.
|
||||||
|
|
||||||
|
---
|
||||||
|
*Erstellt für die IT-Dokumentation - Projekt: IT Internal Repository*
|
||||||
24
Doc/Microsoft o365 URL.md
Normal file
24
Doc/Microsoft o365 URL.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
1. Kulcsfontosságú URL-ek (FQDN-ek)
|
||||||
|
A login és az outlook mellett a következőket is engedélyezni kell (jellemzően a 443-as porton):
|
||||||
|
|
||||||
|
* Bejelentkezés és Hitelesítés:
|
||||||
|
* *.microsoftonline.com
|
||||||
|
* *.microsoft.com
|
||||||
|
* *.msftauth.net
|
||||||
|
* *.msauth.net
|
||||||
|
* Outlook/OWA és Kapcsolódó szolgáltatások:
|
||||||
|
* *.office.com
|
||||||
|
* *.office365.com
|
||||||
|
* *.outlook.com
|
||||||
|
* Statikus tartalom és CDN (nélkülük lassú vagy szétesik az oldal):
|
||||||
|
* *.msedge.net
|
||||||
|
* *.msecnd.net
|
||||||
|
* *.res.office365.com
|
||||||
|
|
||||||
|
|
||||||
|
*.outlook.office.com
|
||||||
|
*.office.com
|
||||||
|
*.microsoftonline.com
|
||||||
|
*.msftauth.net
|
||||||
|
|
||||||
|
https://learn.microsoft.com/en-us/microsoft-365/enterprise/urls-and-ip-address-ranges?view=o365-worldwide
|
||||||
38
Doc/MySQL_Cleaning_SOP_de.md
Normal file
38
Doc/MySQL_Cleaning_SOP_de.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# SOP: Bereinigung alter Datensätze (delete_old_records.py)
|
||||||
|
|
||||||
|
## 1. Zweck des Skripts
|
||||||
|
Dieses Python-Skript dient der automatischen Bereinigung (Housekeeping) unserer MySQL-Datenbanken. Es entfernt veraltete Datensätze, die eine definierte Aufbewahrungsfrist (Retention Period) überschritten haben, um die Datenbankgröße zu kontrollieren und die Abfragegeschwindigkeit zu optimieren.
|
||||||
|
|
||||||
|
## 2. Voraussetzungen
|
||||||
|
* **Python Version:** Mindestens Python 3.8.
|
||||||
|
* **Bibliotheken:** `mysql-connector-python`, `python-dotenv`.
|
||||||
|
* **Datenbankzugriff:** Das Skript benötigt einen Benutzer mit `DELETE`-Berechtigungen auf die entsprechenden Tabellen.
|
||||||
|
|
||||||
|
## 3. Konfiguration
|
||||||
|
Die Steuerung des Skripts erfolgt über eine `.env`-Datei oder direkt im Skript-Header:
|
||||||
|
|
||||||
|
* **DB_HOST:** IP des Datenbankservers (z. B. `10.102.1.65`).
|
||||||
|
* **RETENTION_DAYS:** Anzahl der Tage, nach denen Daten gelöscht werden (Standard: X Tage).
|
||||||
|
* **DRY_RUN:** Wenn auf `True` gesetzt, zeigt das Skript nur an, was gelöscht würde, ohne die Datenbank tatsächlich zu verändern.
|
||||||
|
|
||||||
|
## 4. Ausführung
|
||||||
|
Es wird empfohlen, das Skript regelmäßig als Cronjob (Linux) oder Task Scheduler (Windows) auszuführen.
|
||||||
|
|
||||||
|
### Testlauf (Dry-Run):
|
||||||
|
```bash
|
||||||
|
python3 delete_old_records.py --mode dry-run
|
||||||
|
```
|
||||||
|
|
||||||
|
### Scharfe Ausführung:
|
||||||
|
```bash
|
||||||
|
python3 delete_old_records.py --mode execute
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Monitoring & Logs
|
||||||
|
Alle Löschvorgänge werden in der Standardausgabe und optional in einer Log-Datei protokolliert. Prüfen Sie regelmäßig die Anzahl der gelöschten Datensätze, um sicherzustellen, dass die Logik korrekt arbeitet.
|
||||||
|
|
||||||
|
## 6. Sicherheitshinweis
|
||||||
|
**Achtung:** Gelöschte Daten können nicht ohne Backup wiederhergestellt werden. Führen Sie vor größeren Änderungen an der Aufbewahrungslogik immer ein Datenbank-Backup durch.
|
||||||
|
|
||||||
|
---
|
||||||
|
*Erstellt für die IT-Dokumentation - Projekt: IT Internal Repository*
|
||||||
31
Doc/O365_Winmail_Dat_Fix_SOP_de.md
Normal file
31
Doc/O365_Winmail_Dat_Fix_SOP_de.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# SOP: Behebung winmail.dat Anhang-Fehler (Office 365)
|
||||||
|
|
||||||
|
## Problembeschreibung
|
||||||
|
Wenn E-Mails an externe Empfänger gesendet werden, werden Anhänge (z. B. PDF-Dateien) nicht korrekt angezeigt, sondern sind in einer einzigen `winmail.dat`-Datei verpackt. Dies wird durch das Outlook-eigene **TNEF (Transport Neutral Encapsulation Format)** verursacht, das andere E-Mail-Clients nicht interpretieren können.
|
||||||
|
|
||||||
|
## Lösungsmöglichkeiten
|
||||||
|
|
||||||
|
### 1. Globale Lösung (Exchange Online Admin) - EMPFOHLEN
|
||||||
|
Diese Einstellung gilt für die gesamte Organisation und deaktiviert die TNEF-Codierung auf Serverebene für externe Empfänger.
|
||||||
|
|
||||||
|
1. Melden Sie sich im **Exchange Admin Center** an.
|
||||||
|
2. Navigieren Sie zu: **Mail flow** (Nachrichtenfluss) -> **Remote domains** (Remote-Domänen).
|
||||||
|
3. Wählen Sie die Domäne **Default** (*) aus.
|
||||||
|
4. Suchen Sie die Einstellung **Use Table Neutral Encapsulation Format (TNEF)**.
|
||||||
|
5. Setzen Sie den Wert auf **Never** (Niemals).
|
||||||
|
6. Speichern Sie die Änderungen.
|
||||||
|
|
||||||
|
### 2. PowerShell-Lösung (Schnellere Administration)
|
||||||
|
Führen Sie den folgenden Befehl im Exchange Online PowerShell-Modul aus:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Set-RemoteDomain -Identity Default -TNEFEnabled $false
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Einzelne Benutzerlösung (Outlook Client)
|
||||||
|
Wenn die Korrektur nur an einem PC erfolgen soll:
|
||||||
|
1. **Datei -> Optionen -> E-Mail**.
|
||||||
|
2. Im Abschnitt **Nachrichtenformat**: *"Beim Senden von Nachrichten im Rich-Text-Format an externe Empfänger"* -> Auf **In HTML-Format konvertieren** umstellen.
|
||||||
|
|
||||||
|
---
|
||||||
|
*Erstellt am: 24. März 2026*
|
||||||
31
Doc/O365_Winmail_Dat_Fix_SOP_hu.md
Normal file
31
Doc/O365_Winmail_Dat_Fix_SOP_hu.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# SOP: winmail.dat csatolmány hiba javítása (Office 365)
|
||||||
|
|
||||||
|
## Probléma leírása
|
||||||
|
Külső címzetteknek küldött e-mailek esetén a csatolmányok (például PDF fájlok) nem megfelelően érkeznek meg, hanem egyetlen `winmail.dat` fájlba csomagolva látszanak. Ezt az Outlook saját **TNEF (Transport Neutral Encapsulation Format)** kódolása okozza, amit más levelezőrendszerek nem tudnak értelmezni.
|
||||||
|
|
||||||
|
## Megoldási lehetőségek
|
||||||
|
|
||||||
|
### 1. Globális megoldás (Exchange Online Admin) - JAVASOLT
|
||||||
|
Ez a beállítás az egész szervezetre vonatkozik, és szerver szinten tiltja le a TNEF kódolást a külső címzettek felé.
|
||||||
|
|
||||||
|
1. Lépj be az **Exchange Admin Center** felületre.
|
||||||
|
2. Navigálj ide: **Mail flow** (Üzenetküldés) -> **Remote domains** (Távoli tartományok).
|
||||||
|
3. Válaszd ki a **Default** (*) tartományt.
|
||||||
|
4. Keresd meg a **Use Table Neutral Encapsulation Format (TNEF)** beállítást.
|
||||||
|
5. Állítsd az értékét **Never** (Soha) típusra.
|
||||||
|
6. Mentsd el a módosításokat.
|
||||||
|
|
||||||
|
### 2. PowerShell megoldás (Gyorsabb adminisztráció)
|
||||||
|
Futtasd az alábbi parancsot az Exchange Online PowerShell modulban:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Set-RemoteDomain -Identity Default -TNEFEnabled $false
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Egyéni felhasználói megoldás (Outlook kliens)
|
||||||
|
Ha csak egy gépen kell javítani:
|
||||||
|
1. **Fájl -> Beállítások -> Posta**.
|
||||||
|
2. Az **Üzenetformátum** résznél: *"Üzenetek küldése RTF formátumban külső címzetteknek"* -> Állítsd át **Konvertálás HTML formátumra** értékre.
|
||||||
|
|
||||||
|
---
|
||||||
|
*Készült: 2026. március 24.*
|
||||||
41
Doc/PDF_Import_O365_SOP_de.md
Normal file
41
Doc/PDF_Import_O365_SOP_de.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# SOP: Automatisierter PDF-Import aus O365 (import_pdf_from_o365_de.v2.2.py)
|
||||||
|
|
||||||
|
## 1. Zweck des Skripts
|
||||||
|
Dieses Python-Skript automatisiert den Import von PDF-Dokumenten aus der Microsoft 365-Umgebung (z.B. Outlook-Postfächer oder SharePoint) in das lokale IT-Dateisystem. Es dient zur effizienten Digitalisierung von Dokumenten, die als E-Mail-Anhänge eingehen.
|
||||||
|
|
||||||
|
## 2. Voraussetzungen & Bibliotheken
|
||||||
|
Um das Skript auszuführen, sind folgende Module notwendig:
|
||||||
|
|
||||||
|
* **Python:** Version 3.8+
|
||||||
|
* **Module:** `pip install O365 requests python-dotenv`
|
||||||
|
* **Infrastruktur:** Eine registrierte Anwendung in Azure AD (Entra ID) mit den entsprechenden API-Berechtigungen (`Mail.Read`, `Files.Read`).
|
||||||
|
|
||||||
|
## 3. Zentrale Konfiguration
|
||||||
|
Das Skript benötigt eine `.env`-Datei mit folgenden Zugangsdaten:
|
||||||
|
|
||||||
|
* **CLIENT_ID:** Die ID der registrierten Azure-App.
|
||||||
|
* **CLIENT_SECRET:** Das zugehörige Client-Secret für die Authentifizierung.
|
||||||
|
* **TARGET_FOLDER:** Der lokale Pfad, in dem die PDF-Dateien gespeichert werden sollen.
|
||||||
|
* **MAILBOX:** Die E-Mail-Adresse des zu überwachenden Postfachs.
|
||||||
|
|
||||||
|
## 4. Ausführung & Betrieb
|
||||||
|
Das Skript kann sowohl manuell als auch automatisiert über einen Dienst oder Cronjob gestartet werden.
|
||||||
|
|
||||||
|
### Manueller Start:
|
||||||
|
```bash
|
||||||
|
# Skript manuell aufrufen
|
||||||
|
python3 import_pdf_from_o365_de.v2.2.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fehlerbehebung (Troubleshooting):
|
||||||
|
* **Authentifizierungsfehler:** Prüfen Sie, ob das Client-Secret abgelaufen ist oder die Berechtigungen in Azure AD korrekt gesetzt sind.
|
||||||
|
* **Download-Fehler:** Stellen Sie sicher, dass das Zielverzeichnis vorhanden ist und Schreibrechte bestehen.
|
||||||
|
|
||||||
|
## 5. Monitoring
|
||||||
|
Die Ausführung des Skripts wird standardmäßig protokolliert. Bei erfolgreichem Import werden die entsprechenden Log-Einträge erstellt, die den Dateinamen und den Zeitstempel enthalten.
|
||||||
|
|
||||||
|
## 6. Sicherheitshinweis
|
||||||
|
Bewahren Sie die `.env`-Datei sicher auf und geben Sie das **Client-Secret** niemals an unbefugte Personen weiter. Es wird empfohlen, die Secret-Rotation gemäß IT-Sicherheitsrichtlinien regelmäßig durchzuführen.
|
||||||
|
|
||||||
|
---
|
||||||
|
*Erstellt für die IT-Dokumentation - Projekt: IT Internal Repository*
|
||||||
2
Doc/WoT/WoT.md
Normal file
2
Doc/WoT/WoT.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# WoT
|
||||||
|
https://worldoftanks.eu/hu/content/guide/twitch-drops/
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
+ Angel
|
|
||||||
+ Aalbek
|
|
||||||
+ Beek
|
|
||||||
Donau
|
|
||||||
+ Eider
|
|
||||||
+ Elbe
|
|
||||||
+ Emmer
|
|
||||||
+ Ems
|
|
||||||
Enz
|
|
||||||
+ Fintau
|
|
||||||
+ Flottbek
|
|
||||||
+ Goldbach
|
|
||||||
+ Hamme
|
|
||||||
+ Hellbach
|
|
||||||
+ Jasenitz
|
|
||||||
+ Juemme
|
|
||||||
+ Linde
|
|
||||||
+ Orthbrookgraben
|
|
||||||
+ Lottbek
|
|
||||||
+ Bille
|
|
||||||
+ Iller
|
|
||||||
Ahr_Struensee-Haus
|
|
||||||
+ Müritz
|
|
||||||
+ Weser
|
|
||||||
+ Radegast
|
|
||||||
+ Seseke
|
|
||||||
+ Siede
|
|
||||||
+ Zorge
|
|
||||||
Elbe 01 - Stuensee - Haus
|
|
||||||
115
Docker/checkmk_aps/checkmk_import_switches.py
Normal file
115
Docker/checkmk_aps/checkmk_import_switches.py
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import urllib3
|
||||||
|
|
||||||
|
# Kikapcsoljuk az SSL figyelmeztetéseket
|
||||||
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
|
# --- KONFIGURÁCIÓ ---
|
||||||
|
# Módosítva a kért IP-re:
|
||||||
|
URL = "http://10.102.1.201:8080/monitoring/check_mk/api/1.0"
|
||||||
|
USERNAME = "cmkadmin"
|
||||||
|
PASSWORD = "cmkadmin123"
|
||||||
|
FOLDER = "/"
|
||||||
|
|
||||||
|
# A fő szülő (Parent) adatai
|
||||||
|
GW_NAME = "SOPHOS-GW"
|
||||||
|
GW_IP = "10.102.1.1"
|
||||||
|
|
||||||
|
# A switchek adatai
|
||||||
|
SWITCHES = {
|
||||||
|
"NET-SW01": "10.220.1.84",
|
||||||
|
"NET-SW02": "10.220.1.85",
|
||||||
|
"NET-SW03": "172.16.71.6",
|
||||||
|
"NET-SW04": "10.220.1.86",
|
||||||
|
"NET-SW05": "10.220.1.87",
|
||||||
|
"NET-SW06": "10.220.1.88",
|
||||||
|
"NET-SW07": "10.220.1.90",
|
||||||
|
"NET-SW08": "10.220.1.91",
|
||||||
|
"NET-SW09": "10.220.1.92",
|
||||||
|
"NET-SW10": "10.220.1.93",
|
||||||
|
"NET-SW11": "10.220.1.94",
|
||||||
|
"NET-SW12": "10.220.1.95",
|
||||||
|
"NET-SW13": "10.220.1.96",
|
||||||
|
"NET-SW14": "10.220.1.97",
|
||||||
|
}
|
||||||
|
|
||||||
|
session = requests.Session()
|
||||||
|
session.auth = (USERNAME, PASSWORD)
|
||||||
|
session.headers.update({"Accept": "application/json", "Content-Type": "application/json"})
|
||||||
|
|
||||||
|
def add_host(name, ip, parents=None):
|
||||||
|
print(f"Adding host: {name} ({ip})...")
|
||||||
|
|
||||||
|
attributes = {
|
||||||
|
"ipaddress": ip,
|
||||||
|
"tag_agent": "no-agent",
|
||||||
|
}
|
||||||
|
|
||||||
|
if parents:
|
||||||
|
attributes["parents"] = parents
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"host_name": name,
|
||||||
|
"folder": FOLDER,
|
||||||
|
"attributes": attributes
|
||||||
|
}
|
||||||
|
|
||||||
|
response = session.post(
|
||||||
|
f"{URL}/domain-types/host_config/collections/all",
|
||||||
|
json=payload
|
||||||
|
)
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
print(f" [OK] Host '{name}' successfully added.")
|
||||||
|
elif response.status_code == 400 and "already exists" in response.text:
|
||||||
|
print(f" [INFO] Host '{name}' already exists.")
|
||||||
|
else:
|
||||||
|
print(f" [ERROR] Failed to add {name}: {response.status_code} - {response.text}")
|
||||||
|
|
||||||
|
def activate_changes():
|
||||||
|
print("Fetching pending changes to get ETag...")
|
||||||
|
|
||||||
|
# Külön session az ETag lekéréshez a biztonság kedvéért
|
||||||
|
etag_session = requests.Session()
|
||||||
|
etag_session.auth = (USERNAME, PASSWORD)
|
||||||
|
etag_session.headers.update({"Accept": "application/json"})
|
||||||
|
|
||||||
|
resp = etag_session.get(f"{URL}/domain-types/activation_run/collections/pending_changes")
|
||||||
|
if resp.status_code != 200:
|
||||||
|
print(f" [ERROR] Could not fetch pending changes: {resp.text}")
|
||||||
|
return
|
||||||
|
|
||||||
|
etag = resp.headers.get("ETag")
|
||||||
|
|
||||||
|
# Ha nincs ETag vagy nincs függőben lévő változás, ne csináljunk semmit
|
||||||
|
if not etag or resp.json().get('value') == []:
|
||||||
|
print(" [INFO] No pending changes to activate.")
|
||||||
|
return
|
||||||
|
|
||||||
|
print(f"Activating changes with ETag: {etag}")
|
||||||
|
|
||||||
|
# Az aktiváláshoz be kell állítani az If-Match fejlécet
|
||||||
|
# Ezt az eredeti session headerjeihez adjuk hozzá
|
||||||
|
session.headers.update({"If-Match": etag})
|
||||||
|
|
||||||
|
response = session.post(
|
||||||
|
f"{URL}/domain-types/activation_run/actions/activate-changes/invoke",
|
||||||
|
json={"redirect": False, "sites": ["monitoring"]}
|
||||||
|
)
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
print(" [OK] Changes activated successfully.")
|
||||||
|
else:
|
||||||
|
print(f" [ERROR] Failed to activate changes: {response.status_code} - {response.text}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# 1. Először a SOPHOS GW-t vesszük fel
|
||||||
|
add_host(GW_NAME, GW_IP)
|
||||||
|
|
||||||
|
# 2. Utána a switcheket a GW-vel szülőként
|
||||||
|
for name, ip in SWITCHES.items():
|
||||||
|
add_host(name, ip, parents=[GW_NAME])
|
||||||
|
|
||||||
|
# 3. Aktiváljuk a változtatásokat
|
||||||
|
activate_changes()
|
||||||
17
Docker/checkmk_aps/docker-compose.yml
Normal file
17
Docker/checkmk_aps/docker-compose.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
services:
|
||||||
|
checkmk:
|
||||||
|
image: checkmk/check-mk-raw:2.3.0-latest
|
||||||
|
container_name: checkmk
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "8080:5000"
|
||||||
|
environment:
|
||||||
|
- CMK_SITE_ID=monitoring
|
||||||
|
- CMK_PASSWORD=cmkadmin123
|
||||||
|
- TZ=Europe/Berlin
|
||||||
|
volumes:
|
||||||
|
- ./sites:/opt/omd/sites
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_RAW
|
||||||
68
Docker/checkmk_aps/hosts_for_checkmk.csv
Normal file
68
Docker/checkmk_aps/hosts_for_checkmk.csv
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
Host,Port,Description,Display Name,Folder
|
||||||
|
APPCS01.aps.local,3389,,APPCS01,APS
|
||||||
|
APS-ADMIN01.aps.local,3389,,APS-ADMIN01,APS
|
||||||
|
APS-ADMIN01.aps.local,3389,,APS-ADMIN01 - FullSize,APS
|
||||||
|
APS-AOTRACE01.aps.local,3389,,APS-AOTRACE01,APS\Apotheke
|
||||||
|
APS-APO01.aps.local,3389,,APS-APO01,APS\Apotheke
|
||||||
|
APS-BK01.aps.local,3389,,APS-BK01,APS\Backup
|
||||||
|
APS-CONN01.aps.local,3389,,APS-CONN01,APS\AD
|
||||||
|
APS-DC01.aps.local,3389,,APS-DC01,APS\AD
|
||||||
|
APS-DC02.aps.local,3389,,APS-DC02,APS\AD
|
||||||
|
APS-EGOSEC01.aps.local,3389,,APS-EGOSEC01,APS\Matrix42
|
||||||
|
APS-ELPRO01.aps.local,3389,,APS-ELPRO01,APS\Elpro-Monitoring
|
||||||
|
APS-EXCH01.aps.local,3389,,APS-EXCH01,APS\Exchange
|
||||||
|
APS-EXCH02.aps.local,3389,,APS-EXCH02,APS\Exchange
|
||||||
|
APS-FAX01.aps.local,3389,,APS-FAX01,APS\FAX
|
||||||
|
APS-FILE01.aps.local,3389,,"APS-FILE01 (Abt.,Apps,Data)",APS\Fileserver
|
||||||
|
APS-FILE02.aps.local,3389,,APS-FILE02 (UserShare),APS\Fileserver
|
||||||
|
APS-GENO01.aps.local,3389,,APS-GENO01,APS\FB/CO
|
||||||
|
APS-Infra01.aps.local,3389,,APS-Infra01,APS\AD
|
||||||
|
APS-Infra02.aps.local,3389,,APS-Infra02,APS\AD
|
||||||
|
APS-Lizenz01.aps.local,3389,,APS-Lizenz01,APS\AD
|
||||||
|
APS-MAVE01.aps.local,3389,,APS-MAVE01 (Jobs),APS\Mave
|
||||||
|
APS-MAVE02.aps.local,3389,,APS-MAVE02 (Scanner),APS\Mave
|
||||||
|
APS-MAVE03.aps.local,3389,,APS-MAVE03 (Schnittstellen),APS\Mave
|
||||||
|
APS-MAVE04.aps.local,3389,,APS-MAVE04 (Datenbank),APS\Mave
|
||||||
|
APs-MYSQL01.aps.local,3389,,APS-MYSQL01,APS\SQL
|
||||||
|
APS-NPS01.aps.local,3389,,APS-NPS01,APS\AD
|
||||||
|
APS-NSM01.aps.local,3389,,APS-NSM01,APS\Matrix42
|
||||||
|
APS-PKI01.aps.local,3389,,APS-PKI01 (offline),APS\PKI
|
||||||
|
APS-PKI02.aps.local,3389,,APS-PKI02,APS\PKI
|
||||||
|
APS-PRINT01.aps.local,3389,,APS-PRINT01,APS\Drucker
|
||||||
|
APS-PRINT02.aps.local,3389,,APS-PRINT02,APS\Drucker
|
||||||
|
APS-PRTG01.aps.local,3389,,APS-PRTG01,APS\Monitoring
|
||||||
|
APS-RDS01.aps.local,3389,,APS-RDS01,APS\Terminal
|
||||||
|
APS-RDS02.aps.local,3389,,APS-RDS02,APS\Terminal
|
||||||
|
APS-RDS03.aps.local,3389,,APS-RDS03,APS\Terminal
|
||||||
|
APS-RDS04.aps.local,3389,,APS-RDS04,APS\Terminal
|
||||||
|
APS-RDS05.aps.local,3389,,APS-RDS05,APS\Terminal
|
||||||
|
APS-RDS06.aps.local,3389,,APS-RDS06,APS\Terminal
|
||||||
|
APS-RDSCB01.aps.local,3389,,APS-RDSCB01,APS\Terminal
|
||||||
|
APS-ROXTRA01.aps.local,3389,,APS-ROXTRA01,APS\roXtra
|
||||||
|
APS-SASM01.aps.local,3389,,APS-SASM01,APS\Matrix42
|
||||||
|
APS-SQL01.aps.local,3389,,APS-SQL01,APS\SQL
|
||||||
|
APS-TC011.aps.local,3389,,APS-TC011,APS\xxx-Desktops
|
||||||
|
APS-TC022.aps.local,3389,,APS-TC022,APS\xxx-Desktops
|
||||||
|
APS-TC068.aps.local,3389,,APS-TC068,APS\xxx-Desktops
|
||||||
|
APS-TC069.aps.local,3389,,APS-TC069,APS\xxx-Desktops
|
||||||
|
APS-TC073.aps.local,3389,,APS-TC073,APS\xxx-Desktops
|
||||||
|
APS-TC074.aps.local,3389,,APS-TC074,APS\xxx-Desktops
|
||||||
|
APS-TC075.aps.local,3389,,APS-TC075,APS\xxx-Desktops
|
||||||
|
APS-TC076.aps.local,3389,,APS-TC076,APS\xxx-Desktops
|
||||||
|
APS-TC077.aps.local,3389,,APS-TC077,APS\xxx-Desktops
|
||||||
|
APS-TC078.aps.local,3389,,APS-TC078,APS\xxx-Desktops
|
||||||
|
APS-TC079.aps.local,3389,,APS-TC079,APS\xxx-Desktops
|
||||||
|
APS-TC080.aps.local,3389,,APS-TC080,APS\xxx-Desktops
|
||||||
|
APS-TC081.aps.local,3389,,APS-TC081,APS\xxx-Desktops
|
||||||
|
APS-TC082.aps.local,3389,,APS-TC082,APS\xxx-Desktops
|
||||||
|
APS-TC083.aps.local,3389,,APS-TC083,APS\xxx-Desktops
|
||||||
|
APS-TC086.aps.local,3389,,APS-TC086,APS\xxx-Desktops
|
||||||
|
APS-TC087.aps.local,3389,,APS-TC087,APS\xxx-Desktops
|
||||||
|
APS-TC088.aps.local,3389,,APS-TC088,APS\xxx-Desktops
|
||||||
|
APS-TC089.aps.local,3389,,APS-TC089,APS\xxx-Desktops
|
||||||
|
APS-TD001.aps.local,3389,,APS-TD001,APS\xxx-Desktops
|
||||||
|
APS-UEM01.aps.local,3389,,APS-UEM01,APS\Matrix42
|
||||||
|
mave-terminals.aps.local,3389,,MAVE-TERMINALS,APS\Mave
|
||||||
|
10.101.0.83,3389,,10.101.0.83,
|
||||||
|
APS-VM01.aps.local,3389,,APS-VM01,
|
||||||
|
APS-VM02.aps.local,3389,,APS-VM02,
|
||||||
|
142
Docker/checkmk_aps/import_csv_hosts_to_checkmk.py
Normal file
142
Docker/checkmk_aps/import_csv_hosts_to_checkmk.py
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import urllib3
|
||||||
|
import csv
|
||||||
|
import socket
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Kikapcsoljuk az SSL figyelmeztetéseket
|
||||||
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
|
# --- KONFIGURÁCIÓ ---
|
||||||
|
URL = "http://10.102.1.201:8080/monitoring/check_mk/api/1.0"
|
||||||
|
USERNAME = "cmkadmin"
|
||||||
|
PASSWORD = "cmkadmin123"
|
||||||
|
|
||||||
|
# CSV fájl elérési útja, a szkript új helyéhez viszonyítva (Docker/checkmk_aps/)
|
||||||
|
CSV_FILE_PATH = "hosts_for_checkmk.csv"
|
||||||
|
|
||||||
|
session = requests.Session()
|
||||||
|
session.auth = (USERNAME, PASSWORD)
|
||||||
|
session.headers.update({"Accept": "application/json", "Content-Type": "application/json"})
|
||||||
|
|
||||||
|
def resolve_hostname_to_ip(hostname):
|
||||||
|
"""Feloldja a hosztnevet IP címre. Ha már IP cím, visszaadja azt."""
|
||||||
|
try:
|
||||||
|
socket.inet_pton(socket.AF_INET, hostname)
|
||||||
|
return hostname # Már IP cím
|
||||||
|
except socket.error:
|
||||||
|
# Ha nem IP cím, próbáljuk meg feloldani
|
||||||
|
try:
|
||||||
|
return socket.gethostbyname(hostname)
|
||||||
|
except socket.gaierror:
|
||||||
|
print(f" [WARNING] Could not resolve hostname: {hostname}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
def add_host(name, ip, parents=None):
|
||||||
|
"""
|
||||||
|
Hozzáad egy hosztot a Checkmk-hoz.
|
||||||
|
Minden hoszt a gyökér mappába kerül.
|
||||||
|
"""
|
||||||
|
checkmk_folder_path_slug = "/" # Mindig a gyökér mappa
|
||||||
|
|
||||||
|
print(f"Adding host: {name} ({ip}) to root folder '/''...")
|
||||||
|
|
||||||
|
attributes = {
|
||||||
|
"ipaddress": ip,
|
||||||
|
"tag_agent": "no-agent", # Csak pingeljen, ne keressen agentet
|
||||||
|
}
|
||||||
|
|
||||||
|
if parents:
|
||||||
|
attributes["parents"] = parents
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"host_name": name,
|
||||||
|
"folder": checkmk_folder_path_slug, # Folder must be the slugified full path
|
||||||
|
"attributes": attributes
|
||||||
|
}
|
||||||
|
|
||||||
|
response = session.post(
|
||||||
|
f"{URL}/domain-types/host_config/collections/all",
|
||||||
|
json=payload
|
||||||
|
)
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
print(f" [OK] Host '{name}' successfully added.")
|
||||||
|
elif response.status_code == 400 and "already exists" in response.text:
|
||||||
|
print(f" [INFO] Host '{name}' already exists.")
|
||||||
|
else:
|
||||||
|
print(f" [ERROR] Failed to add {name}: {response.status_code} - {response.text}")
|
||||||
|
print(f" [DEBUG] Payload: {json.dumps(payload)}")
|
||||||
|
|
||||||
|
def activate_changes():
|
||||||
|
"""
|
||||||
|
Aktiválja a Checkmk-ban lévő függőben lévő változásokat.
|
||||||
|
"""
|
||||||
|
print("Fetching pending changes to get ETag...")
|
||||||
|
|
||||||
|
etag_session = requests.Session()
|
||||||
|
etag_session.auth = (USERNAME, PASSWORD)
|
||||||
|
etag_session.headers.update({"Accept": "application/json"})
|
||||||
|
|
||||||
|
resp = etag_session.get(f"{URL}/domain-types/activation_run/collections/pending_changes")
|
||||||
|
if resp.status_code != 200:
|
||||||
|
print(f" [ERROR] Could not fetch pending changes: {resp.text}")
|
||||||
|
return
|
||||||
|
|
||||||
|
etag = resp.headers.get("ETag")
|
||||||
|
|
||||||
|
# Ha nincs ETag vagy nincs függőben lévő változás, ne csináljunk semmit
|
||||||
|
if not etag or not resp.json().get('value'): # ellenőrizzük, hogy 'value' nem üres-e
|
||||||
|
print(" [INFO] No pending changes to activate.")
|
||||||
|
return
|
||||||
|
|
||||||
|
print(f"Activating changes with ETag: {etag}")
|
||||||
|
|
||||||
|
# Az aktiváláshoz be kell állítani az If-Match fejlécet
|
||||||
|
activation_headers = {
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"If-Match": etag
|
||||||
|
}
|
||||||
|
|
||||||
|
response = session.post(
|
||||||
|
f"{URL}/domain-types/activation_run/actions/activate-changes/invoke",
|
||||||
|
headers=activation_headers,
|
||||||
|
json={"redirect": False, "sites": ["monitoring"]}
|
||||||
|
)
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
print(" [OK] Changes activated successfully.")
|
||||||
|
else:
|
||||||
|
print(f" [ERROR] Failed to activate changes: {response.status_code} - {response.text}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
hosts_to_import = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(CSV_FILE_PATH, mode='r', newline='', encoding='utf-8') as file:
|
||||||
|
reader = csv.DictReader(file)
|
||||||
|
for row in reader:
|
||||||
|
hostname = row['Host'].strip()
|
||||||
|
|
||||||
|
ip_address = resolve_hostname_to_ip(hostname)
|
||||||
|
|
||||||
|
if ip_address:
|
||||||
|
hosts_to_import.append({
|
||||||
|
"name": hostname,
|
||||||
|
"ip": ip_address,
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
print(f"Skipping host '{hostname}' due to unresolved IP address.")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(f"ERROR: CSV file not found at {CSV_FILE_PATH}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Nincs mappalétrehozás, minden a gyökérbe kerül
|
||||||
|
|
||||||
|
# Hosztok hozzáadása a Checkmk-hoz
|
||||||
|
for host in hosts_to_import:
|
||||||
|
add_host(host['name'], host['ip']) # Nincs 'folder_display' paraméter
|
||||||
|
|
||||||
|
activate_changes()
|
||||||
17
Docker/graphana_aps/docker-compose.yml
Normal file
17
Docker/graphana_aps/docker-compose.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
services:
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana-oss:9.5.15
|
||||||
|
container_name: graphana_aps
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
- GF_INSTALL_PLUGINS=jasonlashua-prtg-datasource
|
||||||
|
- GF_SERVER_ROOT_URL=http://graphana.aps.local
|
||||||
|
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||||
|
- GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=jasonlashua-prtg-datasource
|
||||||
|
volumes:
|
||||||
|
- graphana_data:/var/lib/grafana
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
graphana_data:
|
||||||
5
Docker/librenms_aps/.env
Normal file
5
Docker/librenms_aps/.env
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# LibreNMS alap beállítások
|
||||||
|
MYSQL_PASSWORD=librenms_db_pass
|
||||||
|
MYSQL_ROOT_PASSWORD=librenms_root_pass
|
||||||
|
TZ=Europe/Berlin
|
||||||
|
# Az időzónát módosítsd igény szerint (pl. Europe/Budapest)
|
||||||
106
Docker/librenms_aps/docker-compose.yml
Normal file
106
Docker/librenms_aps/docker-compose.yml
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mariadb:10.5
|
||||||
|
container_name: librenms_db
|
||||||
|
command:
|
||||||
|
- mysqld
|
||||||
|
- --innodb-file-per-table=1
|
||||||
|
- --lower-case-table-names=1
|
||||||
|
- --character-set-server=utf8mb4
|
||||||
|
- --collation-server=utf8mb4_unicode_ci
|
||||||
|
volumes:
|
||||||
|
- ./db:/var/lib/mysql
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
|
- MYSQL_DATABASE=librenms
|
||||||
|
- MYSQL_USER=librenms
|
||||||
|
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:6.0-alpine
|
||||||
|
container_name: librenms_redis
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
librenms:
|
||||||
|
image: librenms/librenms:latest
|
||||||
|
container_name: librenms
|
||||||
|
hostname: librenms
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- ./librenms:/data
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- redis
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- APP_URL=http://10.102.1.201:8000
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_NAME=librenms
|
||||||
|
- DB_USER=librenms
|
||||||
|
- DB_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
cron:
|
||||||
|
image: librenms/librenms:latest
|
||||||
|
container_name: librenms_cron
|
||||||
|
hostname: librenms-cron
|
||||||
|
volumes:
|
||||||
|
- ./librenms:/data
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- redis
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_NAME=librenms
|
||||||
|
- DB_USER=librenms
|
||||||
|
- DB_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
- SIDECAR_CRON=1
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
dispatcher:
|
||||||
|
image: librenms/librenms:latest
|
||||||
|
container_name: librenms_dispatcher
|
||||||
|
hostname: librenms-dispatcher
|
||||||
|
volumes:
|
||||||
|
- ./librenms:/data
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- redis
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_NAME=librenms
|
||||||
|
- DB_USER=librenms
|
||||||
|
- DB_PASSWORD=${MYSQL_PASSWORD}
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
- LIBRENMS_ALLOW_LOGIN_GET=true
|
||||||
|
- DISPATCHER_NODE_ID=dispatcher1
|
||||||
|
- SIDECAR_DISPATCHER=1
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana-oss:latest
|
||||||
|
container_name: grafana
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
volumes:
|
||||||
|
- ./grafana_data:/var/lib/grafana
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
|
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||||
|
- GF_USERS_ALLOW_SIGN_UP=false
|
||||||
|
restart: always
|
||||||
5
Docker/n8n_aps/Your license key.md
Normal file
5
Docker/n8n_aps/Your license key.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Your license key
|
||||||
|
5e377abd-f816-4949-9f95-5c8c9dbfbd37
|
||||||
|
|
||||||
|
Your license key
|
||||||
|
19385219-1295-451f-8130-37557cf74f8c
|
||||||
27
Docker/n8n_aps/docker-compose.yml
Normal file
27
Docker/n8n_aps/docker-compose.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
services:
|
||||||
|
n8n:
|
||||||
|
image: n8nio/n8n
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "5678:5678"
|
||||||
|
volumes:
|
||||||
|
- n8n_data:/home/node/.n8n
|
||||||
|
environment:
|
||||||
|
# The host URL where n8n will be accessible. Change to your domain or IP.
|
||||||
|
- N8N_HOST=${N8N_HOST:-localhost}
|
||||||
|
- N8N_PORT=5678
|
||||||
|
- N8N_PROTOCOL=http
|
||||||
|
# This is the URL that n8n will send to external services for webhooks.
|
||||||
|
# Make sure to update this to your publicly accessible URL.
|
||||||
|
- WEBHOOK_URL=${WEBHOOK_URL:-http://localhost:5678/}
|
||||||
|
# Explicitly set secure cookie to false for testing with HTTP
|
||||||
|
- N8N_SECURE_COOKIE=false
|
||||||
|
# Set your desired timezone
|
||||||
|
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE:-Europe/Berlin}
|
||||||
|
# Database configuration - using SQLite for simplicity with fewer tasks
|
||||||
|
- DB_TYPE=sqlite
|
||||||
|
# No specific host, database, user, or password needed for SQLite
|
||||||
|
# depends_on is no longer needed without postgres
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
n8n_data:
|
||||||
33
Docker/n8n_aps/n8n.conf
Normal file
33
Docker/n8n_aps/n8n.conf
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name your.domain.com; # Replace with your actual domain
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name your.domain.com; # Replace with your actual domain
|
||||||
|
|
||||||
|
ssl_certificate /path/to/your/fullchain.pem; # Replace with your certificate path (e.g., /etc/letsencrypt/live/your.domain.com/fullchain.pem)
|
||||||
|
ssl_certificate_key /path/to/your/privkey.pem; # Replace with your private key path (e.g., /etc/letsencrypt/live/your.domain.com/privkey.pem)
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers "ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20";
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
# Optional: Enable HSTS
|
||||||
|
# add_header Strict-Transport-Security "max-age=63072000" always;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://localhost:5678; # n8n is running on port 5678 on the host
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
# Required for n8n Webhook URLs
|
||||||
|
proxy_set_header X-N8N-Webhook-Url $scheme://$host$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,8 +16,6 @@ This directory contains all the scripts for automation and administration, organ
|
|||||||
### `/Dev/`
|
### `/Dev/`
|
||||||
This directory contains various development projects, such as `network_scann/`, `switch_ip_scann_CSV/`, `switch_ip_scann_DB/` and serves as a collection of configuration files and notes for various system administration tasks.
|
This directory contains various development projects, such as `network_scann/`, `switch_ip_scann_CSV/`, `switch_ip_scann_DB/` and serves as a collection of configuration files and notes for various system administration tasks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### `/Doku/`
|
### `/Doku/`
|
||||||
This directory is used for documentation, data storage, and logs. It contains CSV and text files with user data, printer information, and various logs, organized into subdirectories like `Ai`, `Logs`, and `Pdf`.
|
This directory is used for documentation, data storage, and logs. It contains CSV and text files with user data, printer information, and various logs, organized into subdirectories like `Ai`, `Logs`, and `Pdf`.
|
||||||
|
|
||||||
@@ -36,6 +34,7 @@ A kedvenc programozási nyelvem a Python.
|
|||||||
Weboldalak amiket hasznälni szoktunk:
|
Weboldalak amiket hasznälni szoktunk:
|
||||||
mermaid.live
|
mermaid.live
|
||||||
|
|
||||||
Általában fedora linux alatt dolgozunk.
|
Általában szerver oldalon Fedora Linux alatt dolgozunk.
|
||||||
Második leggyakrabban használt linux az Ubuntu alapu.
|
A második leggyakrabban használt linux az Ubuntu alapú (szintén szerver).
|
||||||
Virtualizácionk Proxmox VE
|
Kliens oldalon (munkaállomás) Windows 11-et vagy macOS-t használunk.
|
||||||
|
Virtualizációnk Proxmox VE.
|
||||||
|
|||||||
41
GEMINI_sharepoint_concept.md
Normal file
41
GEMINI_sharepoint_concept.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# SharePoint IT Dokumentációs Központ - Koncepció
|
||||||
|
|
||||||
|
## 1. Célkitűzés
|
||||||
|
Egy központi, felhőalapú (O365) platform létrehozása az IT részleg összes dokumentációjának, konfigurációjának és tudásbázisának tárolására. Ez egy **zárt, belső IT gyűjtemény**, nem nyilvános a többi dolgozó számára.
|
||||||
|
|
||||||
|
## 2. Webhely Típusa
|
||||||
|
- **Típus:** SharePoint Team Site (**Privát**)
|
||||||
|
- **Név:** `IT Internal Repository`
|
||||||
|
- **Hozzáférés:** Kizárólag az IT csapat tagjai számára (Tulajdonosok és Tagok).
|
||||||
|
|
||||||
|
## 3. Végleges Struktúra (Dokumentumtárak)
|
||||||
|
A SharePoint felületen kialakított mappaszerkezet:
|
||||||
|
|
||||||
|
- **01_Infrastructure:** Postfix konfigok, Switch beállítások, hálózati rajzok.
|
||||||
|
- **02_Software:** Telepítőfájlok (.zip, .exe), szoftveres dokumentációk.
|
||||||
|
- **03_Knowledge_Base:** Általános IT útmutatók és Markdown (.md) dokumentumok.
|
||||||
|
- **04_Automation_Scripts:** Python és Bash szkriptek gyűjteménye.
|
||||||
|
- **05_Archive:** Régi mentések és logok.
|
||||||
|
|
||||||
|
## 4. Technikai Funkciók (IT Fókusz)
|
||||||
|
- **SOP (Wiki) Oldalak:** Modern SharePoint oldalakat használunk a folyamatok leírására (német nyelven a kollégáknak).
|
||||||
|
- **Code Snippets:** A kódminták szintaxis-kiemeléssel jelennek meg az oldalakon.
|
||||||
|
- **Verziókezelés:** Minden fájl módosítása visszakövethető.
|
||||||
|
- **OneDrive Sync:** Windows/WSL környezetből való kényelmes feltöltés és szinkronizáció.
|
||||||
|
|
||||||
|
## 5. Elvégzett és Következő Lépések
|
||||||
|
- [x] Célközönség meghatározása (Csak IT).
|
||||||
|
- [x] Privát SharePoint Team Site létrehozása.
|
||||||
|
- [x] Dokumentumtárak (Libraries) kialakítása (01-05).
|
||||||
|
- [x] Kezdőlap (Dashboard) testreszabása (Hero, Schnelllinks).
|
||||||
|
- [x] Első SOP (Wiki) oldalak létrehozása (Német nyelven).
|
||||||
|
- [ ] Teljes adatkészlet feltöltése (OneDrive szinkronizáció befejezése).
|
||||||
|
- [ ] Teams integráció véglegesítése (Tab-ok hozzáadása).
|
||||||
|
|
||||||
|
## 6. Megvalósított SOP Oldalak (2026.03.16)
|
||||||
|
- **SOP: Automatisierter PDF-Import aus O365 (v2.2)**
|
||||||
|
- **SOP: Bereinigung alter Datensätze (delete_old_records.py)**
|
||||||
|
- **SOP: Konfiguration Postfix SMTP Relay (APS-SMTP01)**
|
||||||
|
|
||||||
|
---
|
||||||
|
*Ez a dokumentum a Gemini CLI segítségével készült, és a projekt aktuális állapotát tükrözi.*
|
||||||
@@ -1,66 +1,15 @@
|
|||||||
# Sudo használata nem-interaktív környezetben (pl. n8n)
|
# Sudo jogosultság beállítása Postfix statisztikákhoz
|
||||||
|
|
||||||
## A probléma
|
Ha egy sima felhasználónak (pl. `apslinux`) jelszó nélkül kell futtatnia a `pflogsumm` parancsot a `/var/log/maillog` fájlon, kövesd az alábbi lépéseket a célszerveren:
|
||||||
|
|
||||||
Amikor egy automatizált folyamat (mint egy n8n workflow) SSH-n keresztül egy `sudo`-t igénylő parancsot próbál futtatni, a következő hibaüzenetet kaphatod:
|
1. Hozz létre egy sudoers konfigurációs fájlt:
|
||||||
`sudo: a terminal is required to read the password`
|
`sudo nano /etc/sudoers.d/postfix-stats`
|
||||||
|
|
||||||
Ennek oka, hogy a `sudo` parancs alapértelmezetten jelszót kérne, de nincs interaktív terminál, ahol ezt be tudná kérni a felhasználótól.
|
2. Add hozzá a következő sort (helyettesítsd a felhasználónevet):
|
||||||
|
`felhasznalonev ALL=(ALL) NOPASSWD: /usr/sbin/pflogsumm /var/log/maillog`
|
||||||
|
|
||||||
**Fontos:** Az SSH kulcsos authentikáció (jelszó nélküli bejelentkezés) nem oldja meg ezt a problémát, mivel az a *bejelentkezésre* vonatkozik, míg a `sudo` a *jogosultság emelésére* a bejelentkezés után.
|
3. Állítsd be a megfelelő jogosultságot:
|
||||||
|
`sudo chmod 0440 /etc/sudoers.d/postfix-stats`
|
||||||
|
|
||||||
## A legjobb megoldás: `sudoers` fájl konfigurálása
|
4. Teszteld a parancsot:
|
||||||
|
`sudo pflogsumm /var/log/maillog`
|
||||||
A legszabványosabb és legbiztonságosabb megoldás az, ha a `sudoers` fájlban beállítod, hogy egy adott felhasználó (pl. `n8nuser`) **jelszó nélkül** is futtathasson bizonyos parancsokat.
|
|
||||||
|
|
||||||
### Lépések:
|
|
||||||
|
|
||||||
1. Jelentkezz be a szerverre egy `sudo` joggal rendelkező felhasználóval.
|
|
||||||
|
|
||||||
2. Nyisd meg a `sudoers` fájlt szerkesztésre a **`visudo`** paranccsal. Ez a parancs ellenőrzi a szintaxist mentés előtt, megelőzve a hibákat.
|
|
||||||
```bash
|
|
||||||
sudo visudo
|
|
||||||
```
|
|
||||||
|
|
||||||
3. A megnyílt szerkesztőben menj a fájl aljára, és adj hozzá egy új sort a felhasználó nevével.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 1. opció: A LEGJOBB és LEGbiztonságosabb módszer
|
|
||||||
|
|
||||||
Csak azokra a konkrét parancsokra adj jelszó nélküli (`NOPASSWD`) jogot, amikre az automatizálásnak valóban szüksége van.
|
|
||||||
|
|
||||||
**Példa egy parancsra:**
|
|
||||||
```
|
|
||||||
# A fájl aljára add hozzá ezt a sort, a 'n8nuser'-t cseréld a te felhasználódra:
|
|
||||||
n8nuser ALL=(ALL) NOPASSWD: /usr/bin/apt-get update
|
|
||||||
```
|
|
||||||
|
|
||||||
**Példa több parancsra (vesszővel elválasztva):**
|
|
||||||
```
|
|
||||||
# A 'n8nuser'-t és a parancsokat cseréld a tieidre:
|
|
||||||
n8nuser ALL=(ALL) NOPASSWD: /usr/bin/apt-get update, /usr/bin/apt-get upgrade -y
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 2. opció: Az EGYSZERŰBB, de kevésbé biztonságos módszer
|
|
||||||
|
|
||||||
Engedélyezd, hogy a felhasználó *bármilyen* parancsot futtathasson jelszó nélkül. Ezt csak akkor használd, ha teljesen megbízol a rendszerben és az automatizált folyamatokban.
|
|
||||||
|
|
||||||
```
|
|
||||||
# A fájl aljára add hozzá ezt a sort, a 'n8nuser'-t cseréld a te felhasználódra:
|
|
||||||
n8nuser ALL=(ALL) NOPASSWD: ALL
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
4. Mentsd el és zárd be a fájlt.
|
|
||||||
* **nano** szerkesztő esetén: `Ctrl+X`, majd `Y` (vagy `I`), végül `Enter`.
|
|
||||||
* **vi** szerkesztő esetén: `Esc`, majd írd be `:wq` és `Enter`.
|
|
||||||
|
|
||||||
Ettől kezdve az adott felhasználó a megadott parancsokat jelszókérés nélkül futtathatja a nem-interaktív SSH session alatt is.
|
|
||||||
|
|
||||||
## Amit NE csinálj
|
|
||||||
|
|
||||||
A hibaüzenet említi az `-S` opciót, ami lehetővé teszi a jelszó "bepipelolását" (`echo "jelszavam" | sudo -S parancs`). **Ez egy rendkívül rossz biztonsági gyakorlat**, mert a jelszavadat egyszerű szövegként kellene tárolnod egy scriptben vagy workflow-ban. Ezt mindenképpen kerüld el!
|
|
||||||
|
|||||||
BIN
Personal/Anamnesebogen__-_Einverst_ndniserkl_rung.doc
Normal file
BIN
Personal/Anamnesebogen__-_Einverst_ndniserkl_rung.doc
Normal file
Binary file not shown.
2
Personal/Films.md
Normal file
2
Personal/Films.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
https://www.imdb.com/de/title/tt30923123/
|
||||||
|
|
||||||
0
Personal/KaufenList.md
Normal file
0
Personal/KaufenList.md
Normal file
37
Scripts/bash/ssh_login_alert_de.sh
Normal file
37
Scripts/bash/ssh_login_alert_de.sh
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# SSH Login Alert Script (DE)
|
||||||
|
# Dieses Skript sendet eine E-Mail an eine angegebene Adresse,
|
||||||
|
# wenn sich ein Benutzer über SSH anmeldet.
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
# Geben Sie hier die E-Mail-Adresse ein, an die die Benachrichtigung gesendet werden soll.
|
||||||
|
RECIPIENT_EMAIL="ihre_email_adresse@example.com"
|
||||||
|
|
||||||
|
# Betreff der E-Mail. Der Befehl `hostname` fügt den Servernamen ein.
|
||||||
|
SUBJECT="SSH-Anmeldung: $USER auf Server $(hostname -f)"
|
||||||
|
|
||||||
|
# Extrahiere nur die IP-Adresse aus der SSH_CLIENT-Variablen.
|
||||||
|
# Z. B. "1.2.3.4 56789 22" -> "1.2.3.4"
|
||||||
|
CLIENT_IP=${SSH_CLIENT%% *}
|
||||||
|
|
||||||
|
# E-Mail-Inhalt. 'cat << EOF' ist eine elegante Art, mehrzeiligen Text zu verarbeiten.
|
||||||
|
BODY=$(cat << EOF
|
||||||
|
Eine SSH-Anmeldung ist auf dem Server $(hostname -f) erfolgt.
|
||||||
|
|
||||||
|
Details:
|
||||||
|
Benutzer: $USER
|
||||||
|
IP-Adresse: $CLIENT_IP
|
||||||
|
Zeitpunkt: $(date +"%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
|
--- Aktuell angemeldete Benutzer ---
|
||||||
|
$(who)
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
# E-Mail mit dem 'mail'-Befehl senden.
|
||||||
|
# Nur senden, wenn die Variable SSH_CLIENT existiert (d. h. es handelt sich um eine SSH-Verbindung).
|
||||||
|
if [ -n "$SSH_CLIENT" ]; then
|
||||||
|
echo "$BODY" | mail -s "$SUBJECT" "$RECIPIENT_EMAIL"
|
||||||
|
fi
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
conf t
|
||||||
|
snmp-server community prtg
|
||||||
|
snmp-server vrf default
|
||||||
|
show snmp community
|
||||||
|
exit
|
||||||
|
exit
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
$events = Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" -MaxEvents 500 |
|
|
||||||
Where-Object { $_.Id -eq 307 }
|
|
||||||
|
|
||||||
$logList = @()
|
|
||||||
|
|
||||||
foreach ($event in $events) {
|
|
||||||
$message = $event.Message
|
|
||||||
$user = ""
|
|
||||||
$document = ""
|
|
||||||
$printer = ""
|
|
||||||
$pages = ""
|
|
||||||
|
|
||||||
# Felhasználó (pl. L.Vogt auf APS-NB072)
|
|
||||||
if ($message -match "im Besitz von (.+?) wurde auf") {
|
|
||||||
$user = $matches[1].Trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
# Nyomtató neve (pl. Jasenitz)
|
|
||||||
if ($message -match "wurde auf (.+?) über Port") {
|
|
||||||
$printer = $matches[1].Trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
# Oldalszám (pl. Gedruckte Seiten: 1)
|
|
||||||
if ($message -match "Gedruckte Seiten:\s+(\d+)") {
|
|
||||||
$pages = $matches[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Dokumentum sorszám (pl. Dokument 62) – jobb híján
|
|
||||||
if ($message -match "^Dokument\s+(\d+)") {
|
|
||||||
$document = "Dokument " + $matches[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
$logList += [PSCustomObject]@{
|
|
||||||
Datum = $event.TimeCreated
|
|
||||||
Benutzer = $user
|
|
||||||
Dokument = $document
|
|
||||||
Drucker = $printer
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Exportálás CSV-be
|
|
||||||
$exportPfad = "$env:USERPROFILE\Desktop\drucklog_export.csv"
|
|
||||||
$logList | Export-Csv -Path $exportPfad -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
Write-Host "Exportálás kész: $exportPfad"
|
|
||||||
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
$events = Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" -MaxEvents 500 |
|
|
||||||
Where-Object { $_.Id -eq 307 }
|
|
||||||
|
|
||||||
$logList = @()
|
|
||||||
|
|
||||||
foreach ($event in $events) {
|
|
||||||
$message = $event.Message
|
|
||||||
$user = ""
|
|
||||||
$computer = ""
|
|
||||||
$document = ""
|
|
||||||
$printer = ""
|
|
||||||
$pages = ""
|
|
||||||
|
|
||||||
# Felhasználó és gép különválasztása
|
|
||||||
if ($message -match "im Besitz von (.+?) wurde auf") {
|
|
||||||
$fullUser = $matches[1].Trim()
|
|
||||||
if ($fullUser -match "^(.+?) auf (.+)$") {
|
|
||||||
$user = $matches[1].Trim()
|
|
||||||
$computer = $matches[2].Trim()
|
|
||||||
} else {
|
|
||||||
$user = $fullUser
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Nyomtató neve (pl. Jasenitz)
|
|
||||||
if ($message -match "wurde auf (.+?) über Port") {
|
|
||||||
$printer = $matches[1].Trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
# Oldalszám (pl. Gedruckte Seiten: 1)
|
|
||||||
if ($message -match "Gedruckte Seiten:\s+(\d+)") {
|
|
||||||
$pages = $matches[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Dokument sorszám (pl. Dokument 62)
|
|
||||||
if ($message -match "^Dokument\s+(\d+)") {
|
|
||||||
$document = "Dokument " + $matches[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
$logList += [PSCustomObject]@{
|
|
||||||
Datum = $event.TimeCreated
|
|
||||||
Benutzer = $user
|
|
||||||
Computer = $computer
|
|
||||||
Dokument = $document
|
|
||||||
Drucker = $printer
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Exportálás CSV-be
|
|
||||||
$exportPfad = "$env:USERPROFILE\Desktop\drucklog_export.csv"
|
|
||||||
$logList | Export-Csv -Path $exportPfad -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
Write-Host "Exportálás kész: $exportPfad"
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
# Printer Log Report 0.3
|
|
||||||
#
|
|
||||||
# Get-WinEvent on Englische Windows : Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational"
|
|
||||||
# Get-WinEvent on Deutsche Windows : Get-WinEvent -LogName "Microsoft-Windows-PrintService/Betriebsbereit"
|
|
||||||
|
|
||||||
$events = Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" -MaxEvents 500 |
|
|
||||||
Where-Object { $_.Id -eq 307 }
|
|
||||||
|
|
||||||
$logList = @()
|
|
||||||
|
|
||||||
foreach ($event in $events) {
|
|
||||||
$message = $event.Message
|
|
||||||
$user = ""
|
|
||||||
$computer = ""
|
|
||||||
$document = ""
|
|
||||||
$printer = ""
|
|
||||||
$pages = 0
|
|
||||||
|
|
||||||
# Felhasználó és gép különválasztása
|
|
||||||
if ($message -match "im Besitz von (.+?) wurde auf") {
|
|
||||||
$fullUser = $matches[1].Trim()
|
|
||||||
if ($fullUser -match "^(.+?) auf (.+)$") {
|
|
||||||
$user = $matches[1].Trim()
|
|
||||||
$computer = $matches[2].Trim()
|
|
||||||
} else {
|
|
||||||
$user = $fullUser
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Nyomtató neve (pl. Jasenitz)
|
|
||||||
if ($message -match "wurde auf (.+?) über Port") {
|
|
||||||
$printer = $matches[1].Trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
# Oldalszám (pl. Gedruckte Seiten: 1)
|
|
||||||
if ($message -match "Gedruckte Seiten:\s+(\d+)") {
|
|
||||||
$pages = [int]$matches[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Dokument sorszám (pl. Dokument 62)
|
|
||||||
if ($message -match "^Dokument\s+(\d+)") {
|
|
||||||
$document = "Dokument " + $matches[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
$logList += [PSCustomObject]@{
|
|
||||||
Datum = $event.TimeCreated
|
|
||||||
Benutzer = $user
|
|
||||||
Computer = $computer
|
|
||||||
Dokument = $document
|
|
||||||
Drucker = $printer
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Export részletes lista
|
|
||||||
$exportPfad = "$env:USERPROFILE\Desktop\drucklog_export.csv"
|
|
||||||
$logList | Export-Csv -Path $exportPfad -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
# ✅ Összesítés felhasználónként
|
|
||||||
$summary = $logList | Group-Object -Property Benutzer | ForEach-Object {
|
|
||||||
$userGroup = $_.Group
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Benutzer = $_.Name
|
|
||||||
Anzahl_Dokumente = $userGroup.Count
|
|
||||||
Gesamt_Seiten = ($userGroup | Measure-Object -Property Seiten -Sum).Sum
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Export összesítés
|
|
||||||
$summaryPfad = "$env:USERPROFILE\Desktop\drucklog_summary.csv"
|
|
||||||
$summary | Export-Csv -Path $summaryPfad -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
Write-Host "Exportálás kész:"
|
|
||||||
Write-Host "- Részletes lista: $exportPfad"
|
|
||||||
Write-Host "- Felhasználónkénti összesítés: $summaryPfad"
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
# Printer Log Report 0.3
|
|
||||||
#
|
|
||||||
# Get-WinEvent on Englische Windows : Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational"
|
|
||||||
# Get-WinEvent on Deutsche Windows : Get-WinEvent -LogName "Microsoft-Windows-PrintService/Betriebsbereit"
|
|
||||||
|
|
||||||
|
|
||||||
$events = Get-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" -MaxEvents 2000 |
|
|
||||||
Where-Object { $_.Id -eq 307 }
|
|
||||||
|
|
||||||
$logList = @()
|
|
||||||
|
|
||||||
foreach ($event in $events) {
|
|
||||||
$message = $event.Message
|
|
||||||
$user = ""
|
|
||||||
$computer = ""
|
|
||||||
$document = ""
|
|
||||||
$printer = ""
|
|
||||||
$pages = 0
|
|
||||||
|
|
||||||
if ($message -match "im Besitz von (.+?) wurde auf") {
|
|
||||||
$fullUser = $matches[1].Trim()
|
|
||||||
if ($fullUser -match "^(.+?) auf (.+)$") {
|
|
||||||
$user = $matches[1].Trim()
|
|
||||||
$computer = $matches[2].Trim()
|
|
||||||
} else {
|
|
||||||
$user = $fullUser
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($message -match "wurde auf (.+?) über Port") {
|
|
||||||
$printer = $matches[1].Trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($message -match "Gedruckte Seiten:\s+(\d+)") {
|
|
||||||
$pages = [int]$matches[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($message -match "^Dokument\s+(\d+)") {
|
|
||||||
$document = "Dokument " + $matches[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
$logList += [PSCustomObject]@{
|
|
||||||
Datum = $event.TimeCreated
|
|
||||||
Tag = $event.TimeCreated.Date.ToString("yyyy-MM-dd")
|
|
||||||
Woche = Get-Date $event.TimeCreated -UFormat "%Y-W%V"
|
|
||||||
Benutzer = $user
|
|
||||||
Computer = $computer
|
|
||||||
Dokument = $document
|
|
||||||
Drucker = $printer
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 🔹 Export részletes lista
|
|
||||||
$exportPfad = "$env:USERPROFILE\Desktop\drucklog_export.csv"
|
|
||||||
$logList | Export-Csv -Path $exportPfad -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
# 🔸 Összesítés felhasználónként (teljes)
|
|
||||||
$summary = $logList | Group-Object -Property Benutzer | ForEach-Object {
|
|
||||||
$userGroup = $_.Group
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Benutzer = $_.Name
|
|
||||||
Anzahl_Dokumente = $userGroup.Count
|
|
||||||
Gesamt_Seiten = ($userGroup | Measure-Object -Property Seiten -Sum).Sum
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$summary | Export-Csv -Path "$env:USERPROFILE\Desktop\drucklog_summary.csv" -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
# 🔸 Napi összesítés felhasználónként
|
|
||||||
$dailySummary = $logList | Group-Object -Property Tag, Benutzer | ForEach-Object {
|
|
||||||
$day = $_.Group[0].Tag
|
|
||||||
$user = $_.Group[0].Benutzer
|
|
||||||
$pages = ($_.Group | Measure-Object -Property Seiten -Sum).Sum
|
|
||||||
$docs = $_.Count
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Datum = $day
|
|
||||||
Benutzer = $user
|
|
||||||
Dokumente = $docs
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$dailySummary | Export-Csv -Path "$env:USERPROFILE\Desktop\drucklog_daily.csv" -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
# 🔸 Heti összesítés felhasználónként (ISO hét formátum: pl. 2025-W30)
|
|
||||||
$weeklySummary = $logList | Group-Object -Property Woche, Benutzer | ForEach-Object {
|
|
||||||
$week = $_.Group[0].Woche
|
|
||||||
$user = $_.Group[0].Benutzer
|
|
||||||
$pages = ($_.Group | Measure-Object -Property Seiten -Sum).Sum
|
|
||||||
$docs = $_.Count
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Woche = $week
|
|
||||||
Benutzer = $user
|
|
||||||
Dokumente = $docs
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$weeklySummary | Export-Csv -Path "$env:USERPROFILE\Desktop\drucklog_weekly.csv" -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
Write-Host "Exportálás kész:"
|
|
||||||
Write-Host "- Részletes lista: drucklog_export.csv"
|
|
||||||
Write-Host "- Összesítés: drucklog_summary.csv"
|
|
||||||
Write-Host "- Napi összesítés: drucklog_daily.csv"
|
|
||||||
Write-Host "- Heti összesítés: drucklog_weekly.csv"
|
|
||||||
|
|
||||||
# 🔸 Nyomtatónkénti összesítés
|
|
||||||
$printerSummary = $logList | Group-Object -Property Drucker | ForEach-Object {
|
|
||||||
$printer = $_.Name
|
|
||||||
$pages = ($_.Group | Measure-Object -Property Seiten -Sum).Sum
|
|
||||||
$docs = $_.Count
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Drucker = $printer
|
|
||||||
Dokumente = $docs
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$printerSummary | Export-Csv -Path "$env:USERPROFILE\Desktop\drucklog_by_printer.csv" -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
# 🔸 Napi összesítés nyomtatónként
|
|
||||||
$dailyPrinterSummary = $logList | Group-Object -Property Tag, Drucker | ForEach-Object {
|
|
||||||
$day = $_.Group[0].Tag
|
|
||||||
$printer = $_.Group[0].Drucker
|
|
||||||
$pages = ($_.Group | Measure-Object -Property Seiten -Sum).Sum
|
|
||||||
$docs = $_.Count
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Datum = $day
|
|
||||||
Drucker = $printer
|
|
||||||
Dokumente = $docs
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$dailyPrinterSummary | Export-Csv -Path "$env:USERPROFILE\Desktop\drucklog_daily_by_printer.csv" -NoTypeInformation -Encoding UTF8
|
|
||||||
|
|
||||||
# 🔸 Heti összesítés nyomtatónként
|
|
||||||
$weeklyPrinterSummary = $logList | Group-Object -Property Woche, Drucker | ForEach-Object {
|
|
||||||
$week = $_.Group[0].Woche
|
|
||||||
$printer = $_.Group[0].Drucker
|
|
||||||
$pages = ($_.Group | Measure-Object -Property Seiten -Sum).Sum
|
|
||||||
$docs = $_.Count
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Woche = $week
|
|
||||||
Drucker = $printer
|
|
||||||
Dokumente = $docs
|
|
||||||
Seiten = $pages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$weeklyPrinterSummary | Export-Csv -Path "$env:USERPROFILE\Desktop\drucklog_weekly_by_printer.csv" -NoTypeInformation -Encoding UTF8
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
# Drucklog_Export.ps1
|
|
||||||
# Nyomtatási napló beolvasása Event Log-ból, feldolgozása és mentése SQLite adatbázisba duplikációk nélkül
|
|
||||||
# Fontos modul SQLite feldolgozäshoz
|
|
||||||
# Install-Module -Name SQLite -Scope CurrentUser
|
|
||||||
# Import-Module SQLite
|
|
||||||
|
|
||||||
# --- Beállítások ---
|
|
||||||
$logName = "Microsoft-Windows-PrintService/Operational"
|
|
||||||
$dbPath = "$env:USERPROFILE\Desktop\drucklog_APS-PRINT01.db"
|
|
||||||
# $dbPath = "$env:USERPROFILE\Desktop\drucklog_APS-PRINT02.db"
|
|
||||||
|
|
||||||
# --- SQLite kapcsolat ---
|
|
||||||
# Add-Type -Path "C:\Tools\SQLite\System.Data.SQLite.dll"
|
|
||||||
$connectionString = "Data Source=$dbPath;Version=3;"
|
|
||||||
$connection = New-Object System.Data.SQLite.SQLiteConnection($connectionString)
|
|
||||||
$connection.Open()
|
|
||||||
|
|
||||||
# --- Tábla létrehozása, ha nem létezik ---
|
|
||||||
$createTableCmd = $connection.CreateCommand()
|
|
||||||
$createTableCmd.CommandText = @"
|
|
||||||
CREATE TABLE IF NOT EXISTS drucklog (
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
event_id INTEGER UNIQUE,
|
|
||||||
datum TEXT,
|
|
||||||
tag TEXT,
|
|
||||||
woche TEXT,
|
|
||||||
benutzer TEXT,
|
|
||||||
computer TEXT,
|
|
||||||
dokument TEXT,
|
|
||||||
drucker TEXT,
|
|
||||||
seiten INTEGER
|
|
||||||
);
|
|
||||||
"@
|
|
||||||
$createTableCmd.ExecuteNonQuery()
|
|
||||||
|
|
||||||
# --- Események lekérdezése ---
|
|
||||||
$events = Get-WinEvent -LogName $logName -ErrorAction SilentlyContinue | Where-Object { $_.Id -eq 307 }
|
|
||||||
|
|
||||||
# --- Adatok feldolgozása ---
|
|
||||||
$logList = foreach ($event in $events) {
|
|
||||||
$msg = $event.Message
|
|
||||||
|
|
||||||
if ($msg -match "im Besitz von (.+?) auf (.+?) wurde auf (.+?) über Port") {
|
|
||||||
$benutzer = $matches[1]
|
|
||||||
$computer = $matches[2]
|
|
||||||
$drucker = $matches[3]
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
$dokument = if ($msg -match "Dokument (.+?), Dokument drucken") { $matches[1] } else { "Unbekannt" }
|
|
||||||
$seiten = if ($msg -match "Gedruckte Seiten: (\d+)") { [int]$matches[1] } else { 0 }
|
|
||||||
|
|
||||||
$calendar = [System.Globalization.CultureInfo]::CurrentCulture.Calendar
|
|
||||||
$weekRule = [System.Globalization.CalendarWeekRule]::FirstFourDayWeek
|
|
||||||
$firstDay = [System.DayOfWeek]::Monday
|
|
||||||
$woche = $calendar.GetWeekOfYear($event.TimeCreated, $weekRule, $firstDay)
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Id = $event.RecordId
|
|
||||||
Datum = $event.TimeCreated.ToString("yyyy-MM-dd HH:mm:ss")
|
|
||||||
Tag = $event.TimeCreated.ToString("yyyy-MM-dd")
|
|
||||||
Woche = $woche
|
|
||||||
Benutzer = $benutzer
|
|
||||||
Computer = $computer
|
|
||||||
Dokument = $dokument
|
|
||||||
Drucker = $drucker
|
|
||||||
Seiten = $seiten
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- Adatok mentése adatbázisba, duplikáció nélkül ---
|
|
||||||
foreach ($row in $logList) {
|
|
||||||
$checkCmd = $connection.CreateCommand()
|
|
||||||
$checkCmd.CommandText = "SELECT COUNT(*) FROM drucklog WHERE event_id = @id"
|
|
||||||
$checkCmd.Parameters.AddWithValue("@id", $row.Id)
|
|
||||||
$exists = $checkCmd.ExecuteScalar()
|
|
||||||
|
|
||||||
if ($exists -eq 0) {
|
|
||||||
$insertCmd = $connection.CreateCommand()
|
|
||||||
$insertCmd.CommandText = "INSERT INTO drucklog (event_id, datum, tag, woche, benutzer, computer, dokument, drucker, seiten)
|
|
||||||
VALUES (@id, @datum, @tag, @woche, @benutzer, @computer, @dokument, @drucker, @seiten)"
|
|
||||||
$insertCmd.Parameters.AddWithValue("@id", $row.Id)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@datum", $row.Datum)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@tag", $row.Tag)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@woche", $row.Woche)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@benutzer", $row.Benutzer)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@computer", $row.Computer)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@dokument", $row.Dokument)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@drucker", $row.Drucker)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@seiten", $row.Seiten)
|
|
||||||
$insertCmd.ExecuteNonQuery()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$connection.Close()
|
|
||||||
Write-Host "Sikeresen frissítve: $($logList.Count) esemény feldolgozva."
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
# Drucklog_Export.ps1
|
|
||||||
# Nyomtatási napló beolvasása Event Log-ból, feldolgozása és mentése SQLite adatbázisba duplikációk nélkül
|
|
||||||
# Fontos modul SQLite feldolgozäshoz
|
|
||||||
# Install-Module -Name SQLite -Scope CurrentUser
|
|
||||||
# Import-Module SQLite
|
|
||||||
|
|
||||||
# --- Beállítások ---
|
|
||||||
$logName = "Microsoft-Windows-PrintService/Operational"
|
|
||||||
$dbPath = "$env:USERPROFILE\Desktop\drucklog_APS-PRINT01.db"
|
|
||||||
# $dbPath = "$env:USERPROFILE\Desktop\drucklog_APS-PRINT02.db"
|
|
||||||
|
|
||||||
# --- SQLite kapcsolat ---
|
|
||||||
# Add-Type -Path "C:\Tools\SQLite\System.Data.SQLite.dll"
|
|
||||||
$connectionString = "Data Source=$dbPath;Version=3;"
|
|
||||||
$connection = New-Object System.Data.SQLite.SQLiteConnection($connectionString)
|
|
||||||
$connection.Open()
|
|
||||||
|
|
||||||
# --- Tábla létrehozása, ha nem létezik ---
|
|
||||||
$createTableCmd = $connection.CreateCommand()
|
|
||||||
$createTableCmd.CommandText = @"
|
|
||||||
CREATE TABLE IF NOT EXISTS drucklog (
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
event_id INTEGER UNIQUE,
|
|
||||||
datum TEXT,
|
|
||||||
tag TEXT,
|
|
||||||
woche TEXT,
|
|
||||||
benutzer TEXT,
|
|
||||||
computer TEXT,
|
|
||||||
dokument TEXT,
|
|
||||||
drucker TEXT,
|
|
||||||
seiten INTEGER
|
|
||||||
);
|
|
||||||
"@
|
|
||||||
$createTableCmd.ExecuteNonQuery()
|
|
||||||
|
|
||||||
# --- Események lekérdezése ---
|
|
||||||
$events = Get-WinEvent -LogName $logName -ErrorAction SilentlyContinue | Where-Object { $_.Id -eq 307 }
|
|
||||||
|
|
||||||
# --- Adatok feldolgozása ---
|
|
||||||
$logList = foreach ($event in $events) {
|
|
||||||
$msg = $event.Message
|
|
||||||
|
|
||||||
if ($msg -match "im Besitz von (.+?) auf (.+?) wurde auf (.+?) über Port") {
|
|
||||||
$benutzer = $matches[1]
|
|
||||||
$computer = $matches[2]
|
|
||||||
$drucker = $matches[3]
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
$dokument = if ($msg -match "Dokument (.+?), Dokument drucken") { $matches[1] } else { "Unbekannt" }
|
|
||||||
$seiten = if ($msg -match "Gedruckte Seiten: (\d+)") { [int]$matches[1] } else { 0 }
|
|
||||||
|
|
||||||
$calendar = [System.Globalization.CultureInfo]::CurrentCulture.Calendar
|
|
||||||
$weekRule = [System.Globalization.CalendarWeekRule]::FirstFourDayWeek
|
|
||||||
$firstDay = [System.DayOfWeek]::Monday
|
|
||||||
$woche = $calendar.GetWeekOfYear($event.TimeCreated, $weekRule, $firstDay)
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Id = $event.RecordId
|
|
||||||
Datum = $event.TimeCreated.ToString("yyyy-MM-dd HH:mm:ss")
|
|
||||||
Tag = $event.TimeCreated.ToString("yyyy-MM-dd")
|
|
||||||
Woche = $woche
|
|
||||||
Benutzer = $benutzer
|
|
||||||
Computer = $computer
|
|
||||||
Dokument = $dokument
|
|
||||||
Drucker = $drucker
|
|
||||||
Seiten = $seiten
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- Adatok mentése adatbázisba, duplikáció nélkül ---
|
|
||||||
$ujBejegyzesek = 0
|
|
||||||
foreach ($row in $logList) {
|
|
||||||
$checkCmd = $connection.CreateCommand()
|
|
||||||
$checkCmd.CommandText = "SELECT COUNT(*) FROM drucklog WHERE event_id = @id"
|
|
||||||
$checkCmd.Parameters.AddWithValue("@id", $row.Id)
|
|
||||||
$exists = $checkCmd.ExecuteScalar()
|
|
||||||
|
|
||||||
if ($exists -eq 0) {
|
|
||||||
$insertCmd = $connection.CreateCommand()
|
|
||||||
$insertCmd.CommandText = "INSERT INTO drucklog (event_id, datum, tag, woche, benutzer, computer, dokument, drucker, seiten)
|
|
||||||
VALUES (@id, @datum, @tag, @woche, @benutzer, @computer, @dokument, @drucker, @seiten)"
|
|
||||||
$insertCmd.Parameters.AddWithValue("@id", $row.Id)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@datum", $row.Datum)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@tag", $row.Tag)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@woche", $row.Woche)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@benutzer", $row.Benutzer)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@computer", $row.Computer)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@dokument", $row.Dokument)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@drucker", $row.Drucker)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@seiten", $row.Seiten)
|
|
||||||
$insertCmd.ExecuteNonQuery()
|
|
||||||
$ujBejegyzesek++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$connection.Close()
|
|
||||||
Write-Host "Sikeresen frissítve: $($logList.Count) esemény feldolgozva."
|
|
||||||
Write-Host "Új bejegyzések az adatbázisban: $ujBejegyzesek"
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
# Drucklog_MySQL.ps1
|
|
||||||
# Install-Module MySQLCmdlets
|
|
||||||
# Nyomtatási napló export MySQL adatbázisba
|
|
||||||
# Aufgabeplannung: Taglich um 8.00 Uhr
|
|
||||||
# Name: Drucklog_MySQL_0.1.ps1
|
|
||||||
# powershell.exe -ExecutionPolicy Bypass -File "-ExecutionPolicy Bypass -File "C:\Tools\drucklog_export_0.1.ps1"
|
|
||||||
|
|
||||||
# Beállítások
|
|
||||||
$logName = "Microsoft-Windows-PrintService/Operational"
|
|
||||||
$mysqlHost = "10.101.0.82"
|
|
||||||
$mysqlUser = "druckloguser"
|
|
||||||
$mysqlPassword = "Test123#"
|
|
||||||
$mysqlDatabase = "drucklog"
|
|
||||||
$quelleServer = $env:COMPUTERNAME # vagy: "Szerver01"
|
|
||||||
|
|
||||||
# MySQL .NET csomag betöltése (előzetesen szükséges: MySql.Data.dll)
|
|
||||||
# Add-Type -Path "C:\Tools\MySql.Data.dll"
|
|
||||||
# Add-Type -Path "C:\Program Files (x86)\MySQL\MySQL Connector NET 9.4\MySql.Data.dll"
|
|
||||||
[Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\MySQL\MySQL Connector NET 9.4\MySql.Data.dll") | Out-Null
|
|
||||||
|
|
||||||
# Kapcsolódás
|
|
||||||
$connectionString = "server=$mysqlHost;user id=$mysqlUser;password=$mysqlPassword;database=$mysqlDatabase;SslMode=none"
|
|
||||||
$connection = New-Object MySql.Data.MySqlClient.MySqlConnection($connectionString)
|
|
||||||
$connection.Open()
|
|
||||||
|
|
||||||
# Lekérés a logból
|
|
||||||
$events = Get-WinEvent -LogName $logName -ErrorAction SilentlyContinue | Where-Object { $_.Id -eq 307 }
|
|
||||||
|
|
||||||
# Kulturális beállítás a heti számításhoz
|
|
||||||
$calendar = [System.Globalization.CultureInfo]::CurrentCulture.Calendar
|
|
||||||
$weekRule = [System.Globalization.CalendarWeekRule]::FirstFourDayWeek
|
|
||||||
$firstDay = [System.DayOfWeek]::Monday
|
|
||||||
|
|
||||||
$ujBejegyzes = 0
|
|
||||||
|
|
||||||
foreach ($event in $events) {
|
|
||||||
$msg = $event.Message
|
|
||||||
|
|
||||||
if ($msg -match "im Besitz von (.+?) auf (.+?) wurde auf (.+?) über Port") {
|
|
||||||
$benutzer = $matches[1]
|
|
||||||
$computer = $matches[2]
|
|
||||||
$drucker = $matches[3]
|
|
||||||
} else {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
$dokument = if ($msg -match "Dokument (.+?), Dokument drucken") { $matches[1] } else { "Unbekannt" }
|
|
||||||
$seiten = if ($msg -match "Gedruckte Seiten: (\d+)") { [int]$matches[1] } else { 0 }
|
|
||||||
$woche = $calendar.GetWeekOfYear($event.TimeCreated, $weekRule, $firstDay)
|
|
||||||
$datum = $event.TimeCreated.ToString("yyyy-MM-dd HH:mm:ss")
|
|
||||||
$tag = $event.TimeCreated.ToString("yyyy-MM-dd")
|
|
||||||
$id = $event.RecordId
|
|
||||||
|
|
||||||
# Duplikáció ellenőrzés
|
|
||||||
$checkCmd = $connection.CreateCommand()
|
|
||||||
$checkCmd.CommandText = "SELECT COUNT(*) FROM drucklog WHERE event_id = @id AND quelle_server = @qs"
|
|
||||||
$checkCmd.Parameters.AddWithValue("@id", $id)
|
|
||||||
$checkCmd.Parameters.AddWithValue("@qs", $quelleServer)
|
|
||||||
$exists = $checkCmd.ExecuteScalar()
|
|
||||||
|
|
||||||
if ($exists -eq 0) {
|
|
||||||
$insertCmd = $connection.CreateCommand()
|
|
||||||
$insertCmd.CommandText = "INSERT INTO drucklog (event_id, datum, tag, woche, benutzer, computer, dokument, drucker, seiten, quelle_server)
|
|
||||||
VALUES (@id, @datum, @tag, @woche, @benutzer, @computer, @dokument, @drucker, @seiten, @qs)"
|
|
||||||
$insertCmd.Parameters.AddWithValue("@id", $id)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@datum", $datum)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@tag", $tag)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@woche", $woche)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@benutzer", $benutzer)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@computer", $computer)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@dokument", $dokument)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@drucker", $drucker)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@seiten", $seiten)
|
|
||||||
$insertCmd.Parameters.AddWithValue("@qs", $quelleServer)
|
|
||||||
$insertCmd.ExecuteNonQuery()
|
|
||||||
$ujBejegyzes++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$connection.Close()
|
|
||||||
Write-Host "Feldolgozott események: $($events.Count) | Új bejegyzés: $ujBejegyzes"
|
|
||||||
97
Scripts/powershell/Get-ADUserDetails.ps1
Normal file
97
Scripts/powershell/Get-ADUserDetails.ps1
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Reszletes informaciokat kerdez le egy AD felhasznalorol (Allgemein, Adresse, Organisation fulek).
|
||||||
|
#>
|
||||||
|
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true, HelpMessage="Add meg a felhasznalo nevet (sAMAccountName)")]
|
||||||
|
[string]$UserName
|
||||||
|
)
|
||||||
|
|
||||||
|
# Ellenorizzuk, hogy az Active Directory modul elerheto-e
|
||||||
|
if (!(Get-Module -ListAvailable ActiveDirectory)) {
|
||||||
|
Write-Error "Az 'ActiveDirectory' modul nem talalhato. Kerlek telepitsd az RSAT eszközt!"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Importaljuk a modult, ha meg nincs betoltve
|
||||||
|
if (!(Get-Module ActiveDirectory)) {
|
||||||
|
Import-Module ActiveDirectory
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Az osszes tulajdonsag lekerese
|
||||||
|
$user = Get-ADUser -Identity $UserName -Properties * -ErrorAction Stop
|
||||||
|
|
||||||
|
Write-Host "`n========================================================" -ForegroundColor Cyan
|
||||||
|
Write-Host " AD FELHASZNALOI ADATOK: $($user.DisplayName) " -ForegroundColor Cyan
|
||||||
|
Write-Host "========================================================`n" -ForegroundColor Cyan
|
||||||
|
|
||||||
|
# --- ALLGEMEIN (Altalanos) ---
|
||||||
|
Write-Host "[ Allgemein / Altalanos ]" -ForegroundColor Yellow
|
||||||
|
$allgemein = [PSCustomObject]@{
|
||||||
|
"Vorname (Keresztnev)" = $user.GivenName
|
||||||
|
"Nachname (Vezeteknev)" = $user.Surname
|
||||||
|
"Anzeigename" = $user.DisplayName
|
||||||
|
"Beschreibung" = $user.Description
|
||||||
|
"Buero (Iroda)" = $user.Office
|
||||||
|
"Telefon" = $user.TelephoneNumber
|
||||||
|
"E-Mail" = $user.EmailAddress
|
||||||
|
"Webseite" = $user.wWWHomePage
|
||||||
|
}
|
||||||
|
$allgemein | Format-List
|
||||||
|
Write-Host "--------------------------------------------------------" -ForegroundColor Gray
|
||||||
|
|
||||||
|
# --- ADRESSE (Cim) ---
|
||||||
|
Write-Host "[ Adresse / Cim ]" -ForegroundColor Yellow
|
||||||
|
$adresse = [PSCustomObject]@{
|
||||||
|
"Strasse" = $user.StreetAddress
|
||||||
|
"Postfach" = $user.PostOfficeBox
|
||||||
|
"PLZ (Iranyitoszam)" = $user.PostalCode
|
||||||
|
"Stadt (Varos)" = $user.L
|
||||||
|
"Bundesland (Megye)" = $user.St
|
||||||
|
"Land" = $user.CO
|
||||||
|
}
|
||||||
|
$adresse | Format-List
|
||||||
|
Write-Host "--------------------------------------------------------" -ForegroundColor Gray
|
||||||
|
|
||||||
|
# --- ORGANISATION (Szervezet) ---
|
||||||
|
Write-Host "[ Organisation / Szervezet ]" -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# Manager nevenek feloldasa DN-bol
|
||||||
|
$managerName = "Nincs megadva"
|
||||||
|
if ($user.Manager) {
|
||||||
|
try {
|
||||||
|
$managerName = (Get-ADUser -Identity $user.Manager).Name
|
||||||
|
} catch {
|
||||||
|
$managerName = $user.Manager # Ha nem sikerul feloldani, marad a DN
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$org = [PSCustomObject]@{
|
||||||
|
"Titel (Beosztas)" = $user.Title
|
||||||
|
"Abteilung (Osztaly)" = $user.Department
|
||||||
|
"Firma (Ceg)" = $user.Company
|
||||||
|
"Vorgesetzter (Fonok)" = $managerName
|
||||||
|
}
|
||||||
|
$org | Format-List
|
||||||
|
Write-Host "--------------------------------------------------------" -ForegroundColor Gray
|
||||||
|
|
||||||
|
# --- CSOPORTOK LISTAJA ---
|
||||||
|
$groups = Get-ADPrincipalGroupMembership -Identity $UserName | Select-Object -ExpandProperty Name | Sort-Object
|
||||||
|
Write-Host "[ Gruppen / Csoporttagsagok ($($groups.Count) db) ]" -ForegroundColor Yellow
|
||||||
|
if ($groups) {
|
||||||
|
foreach ($group in $groups) {
|
||||||
|
Write-Host "- $group"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host "Csak a Domain Users tagja."
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] {
|
||||||
|
Write-Host "HIBA: A(z) '$UserName' nevu felhasznalo nem talalhato!" -ForegroundColor Red
|
||||||
|
} catch {
|
||||||
|
Write-Host "Varatlan hiba tortent: $($_.Exception.Message)" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "`n========================================================`n" -ForegroundColor Cyan
|
||||||
44
Scripts/powershell/Get-ADUserGroups.ps1
Normal file
44
Scripts/powershell/Get-ADUserGroups.ps1
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Kilistázza egy megadott AD felhasználó összes csoporttagságát.
|
||||||
|
#>
|
||||||
|
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true, HelpMessage="Add meg a felhasználó nevét (sAMAccountName)")]
|
||||||
|
[string]$UserName
|
||||||
|
)
|
||||||
|
|
||||||
|
# Ellenőrizzük, hogy az Active Directory modul elérhető-e
|
||||||
|
if (!(Get-Module -ListAvailable ActiveDirectory)) {
|
||||||
|
Write-Error "Az 'ActiveDirectory' modul nem található. Kérlek telepítsd az RSAT eszközt!"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Importáljuk a modult, ha még nincs betöltve
|
||||||
|
if (!(Get-Module ActiveDirectory)) {
|
||||||
|
Import-Module ActiveDirectory
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Felhasználó ellenőrzése
|
||||||
|
$user = Get-ADUser -Identity $UserName -ErrorAction Stop
|
||||||
|
|
||||||
|
Write-Host "`nLekérdezés folyamatban: $($user.Name) ($UserName)..." -ForegroundColor Cyan
|
||||||
|
|
||||||
|
# Csoportok lekérése (Get-ADPrincipalGroupMembership kezeli a rekurziót is)
|
||||||
|
$groups = Get-ADPrincipalGroupMembership -Identity $UserName | Select-Object Name, Category, GroupScope, DistinguishedName | Sort-Object Name
|
||||||
|
|
||||||
|
if ($groups) {
|
||||||
|
Write-Host "Talált csoportok száma: $($groups.Count)`n" -ForegroundColor Green
|
||||||
|
$groups | Format-Table Name, Category, GroupScope -AutoSize
|
||||||
|
} else {
|
||||||
|
Write-Host "A felhasználó egyetlen csoportnak sem tagja (kivéve a Primary Group-ot)." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] {
|
||||||
|
Write-Host "HIBA: A(z) '$UserName' nevű felhasználó nem található az Active Directory-ban!" -ForegroundColor Red
|
||||||
|
} catch {
|
||||||
|
Write-Host "Váratlan hiba történt: $($_.Exception.Message)" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "`nKész." -ForegroundColor Gray
|
||||||
7
Scripts/powershell/Get-GPO.ps1
Normal file
7
Scripts/powershell/Get-GPO.ps1
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Az összes GPO végigfésülése az "SMTP" kulcsszóra
|
||||||
|
Get-GPO -All | ForEach-Object {
|
||||||
|
$report = Get-GPOReport -Guid $_.Id -ReportType Xml
|
||||||
|
if ($report -like "*SMTP*") {
|
||||||
|
Write-Host "Találat: $($_.DisplayName)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Scripts/powershell/MAC_Address_und_IP_change.ps1
Normal file
18
Scripts/powershell/MAC_Address_und_IP_change.ps1
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# 1️⃣ A hálókártya neve (adapter) lekérése
|
||||||
|
$adapter = Get-NetAdapter | Where-Object {$_.Status -eq "Up" -and $_.InterfaceDescription -like "*Ethernet*"}
|
||||||
|
|
||||||
|
# 2️⃣ Ideiglenes MAC-cím generálása (pl. véletlen)
|
||||||
|
$newMac = -join ((65..70) + (0..9) | Get-Random -Count 12 | ForEach-Object {[char]$_})
|
||||||
|
Write-Host "Új ideiglenes MAC: $newMac"
|
||||||
|
|
||||||
|
# 3️⃣ MAC-cím módosítása
|
||||||
|
Set-NetAdapterAdvancedProperty -Name $adapter.Name -DisplayName "Network Address" -DisplayValue $newMac
|
||||||
|
|
||||||
|
# 4️⃣ DHCP bérlet frissítése
|
||||||
|
# Release
|
||||||
|
ipconfig /release
|
||||||
|
# Renew
|
||||||
|
ipconfig /renew
|
||||||
|
|
||||||
|
# 5️⃣ Visszaállítás a régi MAC-re (opcionális, ha szeretnéd)
|
||||||
|
Set-NetAdapterAdvancedProperty -Name $adapter.Name -DisplayName "Network Address" -DisplayValue ""
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# SNMP An auf Windows Server
|
# SNMP An auf Windows Server
|
||||||
Install-WindowsFeature -Name "SNMP-Service" -IncludeAllSubFeature -IncludeManagementTools
|
Install-WindowsFeature -Name "SNMP-Service" -IncludeAllSubFeature -IncludeManagementTools
|
||||||
# Firewall für SNMP Dienst öffnen
|
# Firewall für SNMP Dienst öffnen
|
||||||
New-NetFirewallRule -Name "SNMP" -DisplayName "Allow SNMP" -Protocol UDP -LocalPort 161 -Action Allow -Direction Inbound -RemoteAddress 10.102.1.59 -Profile Domain
|
New-NetFirewallRule -Name "SNMP" -DisplayName "Allow SNMP" -Protocol UDP -LocalPort 161 -Action Allow -Direction Inbound -RemoteAddress 10.102.1.201 -Profile Domain
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
# Drucklog_MySQL.ps1
|
# Drucklog_MySQL.ps1
|
||||||
# Install-Module MySQLCmdlets
|
# Install-Module MySQLCmdlets
|
||||||
# Nyomtatási napló export MySQL adatbázisba
|
# Nyomtatási napló export MySQL adatbázisba
|
||||||
|
|
||||||
|
#Teszt
|
||||||
|
Add-Content -Path "C:\Tools\drucklog_task.log" -Value "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Script futott"
|
||||||
|
|
||||||
|
|
||||||
# Beállítások
|
# Beállítások
|
||||||
$logName = "Microsoft-Windows-PrintService/Operational"
|
$logName = "Microsoft-Windows-PrintService/Operational"
|
||||||
$mysqlHost = "10.101.0.82"
|
$mysqlHost = "10.102.1.65"
|
||||||
$mysqlUser = "druckloguser"
|
$mysqlUser = "svc.druckerlog"
|
||||||
$mysqlPassword = "Test123#"
|
$mysqlPassword = "ctqBirh3eEbakLb96Ks1"
|
||||||
$mysqlDatabase = "drucklog"
|
$mysqlDatabase = "drucklog"
|
||||||
$quelleServer = $env:COMPUTERNAME # vagy: "Szerver01"
|
$quelleServer = $env:COMPUTERNAME # vagy: "Szerver01"
|
||||||
|
|
||||||
@@ -15,6 +19,7 @@ $quelleServer = $env:COMPUTERNAME # vagy: "Szerver01"
|
|||||||
# Add-Type -Path "C:\Program Files (x86)\MySQL\MySQL Connector NET 9.4\MySql.Data.dll"
|
# Add-Type -Path "C:\Program Files (x86)\MySQL\MySQL Connector NET 9.4\MySql.Data.dll"
|
||||||
[Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\MySQL\MySQL Connector NET 9.4\MySql.Data.dll") | Out-Null
|
[Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\MySQL\MySQL Connector NET 9.4\MySql.Data.dll") | Out-Null
|
||||||
|
|
||||||
|
|
||||||
# Kapcsolódás
|
# Kapcsolódás
|
||||||
$connectionString = "server=$mysqlHost;user id=$mysqlUser;password=$mysqlPassword;database=$mysqlDatabase;SslMode=none"
|
$connectionString = "server=$mysqlHost;user id=$mysqlUser;password=$mysqlPassword;database=$mysqlDatabase;SslMode=none"
|
||||||
$connection = New-Object MySql.Data.MySqlClient.MySqlConnection($connectionString)
|
$connection = New-Object MySql.Data.MySqlClient.MySqlConnection($connectionString)
|
||||||
30
Scripts/powershell/get_daily_email_senders.ps1
Normal file
30
Scripts/powershell/get_daily_email_senders.ps1
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# PowerShell script to list senders of emails from an on-premise Exchange server for the current day.
|
||||||
|
|
||||||
|
# Set the start and end times for today
|
||||||
|
$today = Get-Date -Hour 0 -Minute 0 -Second 0
|
||||||
|
$tomorrow = (Get-Date).AddDays(1).Date
|
||||||
|
|
||||||
|
Write-Host "Searching for emails sent between $($today) and $($tomorrow)..."
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Get message tracking logs for sent emails within today's date range
|
||||||
|
# Filtering by EventID 'SEND' focuses on emails leaving the server or being sent internally.
|
||||||
|
# Adjust -ResultSize as needed; 'Unlimited' retrieves all, but can be slow for large environments.
|
||||||
|
$sentEmails = Get-MessageTrackingLog -Start $today -End $tomorrow -EventId "SEND" -ResultSize Unlimited |
|
||||||
|
Select-Object -ExpandProperty Sender |
|
||||||
|
Sort-Object -Unique
|
||||||
|
|
||||||
|
if ($sentEmails) {
|
||||||
|
Write-Host "`nSenders of emails today:`n"
|
||||||
|
$sentEmails | ForEach-Object {
|
||||||
|
Write-Host $_
|
||||||
|
}
|
||||||
|
Write-Host "`nTotal unique senders: $($sentEmails.Count)"
|
||||||
|
} else {
|
||||||
|
Write-Host "`nNo emails sent today found."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error "An error occurred while retrieving message tracking logs: $($_.Exception.Message)"
|
||||||
|
Write-Error "Please ensure you have the necessary Exchange management tools installed and are running the script with appropriate permissions."
|
||||||
|
}
|
||||||
210
Scripts/python/Erledigt/import_pdf_from_o365_de.v.2.0.py
Normal file
210
Scripts/python/Erledigt/import_pdf_from_o365_de.v.2.0.py
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import msal
|
||||||
|
import base64
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# KONFIGURATION
|
||||||
|
# ==============================================================================
|
||||||
|
# Daten aus der Azure App-Registrierung
|
||||||
|
# Tennant ID : caee3499-03f8-4175-9fa8-a935248d0ece
|
||||||
|
TENANT_ID = "caee3499-03f8-4175-9fa8-a935248d0ece"
|
||||||
|
# Client Id : 3a08b279-1fc3-419f-a77e-31f12a0f65f7
|
||||||
|
CLIENT_ID = "3a08b279-1fc3-419f-a77e-31f12a0f65f7"
|
||||||
|
# Key : 3cd0be8b-e58f-4e0c-9856-5c9788183b2c
|
||||||
|
CLIENT_SECRET = "Rk-8Q~nJ.sZ-xUiNxtEDdzVgoFFosODLVHX~jdrh" # Der "Wert", nicht die "Secret ID"
|
||||||
|
|
||||||
|
# Das zu überwachende Postfach
|
||||||
|
# USER_EMAIL = "Bestellung-Fax-Eingang@aps-hh.de"
|
||||||
|
USER_EMAIL = "i.meszely@aps-hh.de"
|
||||||
|
|
||||||
|
# Speicherort für heruntergeladene PDFs
|
||||||
|
# DOWNLOAD_DIR = r"\\aps-nb090\test"
|
||||||
|
# DOWNLOAD_DIR = r"C:\Users\YourUsername\Downloads\PDFs"
|
||||||
|
DOWNLOAD_DIR = "C:/Tools/PDF"
|
||||||
|
|
||||||
|
# Name des Ordners, in den verarbeitete E-Mails verschoben werden
|
||||||
|
PROCESSED_FOLDER_NAME = "erledigt"
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
# Microsoft Graph API Endpunkte
|
||||||
|
GRAPH_API_ENDPOINT = "https://graph.microsoft.com/v1.0"
|
||||||
|
AUTHORITY_URL = f"https://login.microsoftonline.com/{TENANT_ID}"
|
||||||
|
SCOPES = ["https://graph.microsoft.com/.default"]
|
||||||
|
|
||||||
|
|
||||||
|
def get_graph_api_token():
|
||||||
|
"""Ruft das Zugriffstoken für die Microsoft Graph API ab."""
|
||||||
|
app = msal.ConfidentialClientApplication(
|
||||||
|
client_id=CLIENT_ID,
|
||||||
|
authority=AUTHORITY_URL,
|
||||||
|
client_credential=CLIENT_SECRET
|
||||||
|
)
|
||||||
|
result = app.acquire_token_silent(scopes=SCOPES, account=None)
|
||||||
|
if not result:
|
||||||
|
result = app.acquire_token_for_client(scopes=SCOPES)
|
||||||
|
|
||||||
|
if "access_token" in result:
|
||||||
|
print("Graph API-Token erfolgreich abgerufen.")
|
||||||
|
return result["access_token"]
|
||||||
|
else:
|
||||||
|
print("Fehler beim Abrufen des Tokens!")
|
||||||
|
print(result.get("error"))
|
||||||
|
print(result.get("error_description"))
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_folder_id(access_token, folder_name):
|
||||||
|
"""Sucht die ID eines Ordners anhand seines Namens."""
|
||||||
|
headers = {"Authorization": f"Bearer {access_token}"}
|
||||||
|
url = f"{GRAPH_API_ENDPOINT}/users/{USER_EMAIL}/mailFolders"
|
||||||
|
response = requests.get(url, headers=headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
folders = response.json().get("value", [])
|
||||||
|
|
||||||
|
for folder in folders:
|
||||||
|
if folder["displayName"].lower() == folder_name.lower():
|
||||||
|
return folder["id"]
|
||||||
|
|
||||||
|
# Man könnte auch den Fall behandeln, dass der Ordner nicht existiert, und ihn erstellen.
|
||||||
|
# Vorerst wird einfach ein Fehler ausgelöst.
|
||||||
|
raise ValueError(f"Der Ordner '{folder_name}' wurde nicht gefunden.")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Hauptverarbeitungsfunktion."""
|
||||||
|
print("Graph API-Token wird abgerufen...")
|
||||||
|
access_token = get_graph_api_token()
|
||||||
|
if not access_token:
|
||||||
|
return
|
||||||
|
|
||||||
|
headers = {"Authorization": f"Bearer {access_token}"}
|
||||||
|
|
||||||
|
try:
|
||||||
|
print(f"Suche nach der ID für den Ordner '{PROCESSED_FOLDER_NAME}'...")
|
||||||
|
processed_folder_id = get_folder_id(access_token, PROCESSED_FOLDER_NAME)
|
||||||
|
print("Ordner-ID erfolgreich abgerufen.")
|
||||||
|
except requests.exceptions.HTTPError as e:
|
||||||
|
print(f"Fehler beim Abrufen der Ordner-ID: {e}")
|
||||||
|
if e.response.status_code == 403:
|
||||||
|
print("Mögliche Ursache: Fehlende oder unzureichende Graph API-Berechtigungen. Bitte stellen Sie sicher, dass die Anwendung die erforderlichen 'Application Permissions' (z.B. Mail.Read, Mail.ReadWrite) in Azure AD hat und dass der Administrator die Zustimmung erteilt hat.")
|
||||||
|
return
|
||||||
|
except ValueError as e:
|
||||||
|
print(f"Fehler beim Abrufen der Ordner-ID: {e}")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Nur ungelesene E-Mails mit Anhängen abfragen
|
||||||
|
# $select=id,subject -> Nur die notwendigen Felder für mehr Effizienz abfragen
|
||||||
|
messages_url = (
|
||||||
|
f"{GRAPH_API_ENDPOINT}/users/{USER_EMAIL}/mailFolders/inbox/messages?"
|
||||||
|
f"$filter=isRead eq false and hasAttachments eq true&"
|
||||||
|
f"$select=id,subject"
|
||||||
|
)
|
||||||
|
|
||||||
|
response = requests.get(messages_url, headers=headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
messages = response.json().get("value", [])
|
||||||
|
|
||||||
|
if not messages:
|
||||||
|
print("Keine neuen E-Mails zur Verarbeitung gefunden.")
|
||||||
|
return
|
||||||
|
|
||||||
|
print(f"{len(messages)} neue E-Mail(s) mit Anhängen gefunden.")
|
||||||
|
|
||||||
|
for message in messages:
|
||||||
|
msg_id = message["id"]
|
||||||
|
subject = message.get("subject", "N/A")
|
||||||
|
print(f"\n--- In Verarbeitung: '{subject}' (ID: {msg_id}) ---")
|
||||||
|
|
||||||
|
attachments_url = f"{GRAPH_API_ENDPOINT}/users/{USER_EMAIL}/messages/{msg_id}/attachments"
|
||||||
|
response = requests.get(attachments_url, headers=headers)
|
||||||
|
if response.status_code != 200:
|
||||||
|
print(f" Fehler beim Abrufen der Anhänge: {response.json()}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
attachments = response.json().get("value", [])
|
||||||
|
pdf_found = False
|
||||||
|
|
||||||
|
for att in attachments:
|
||||||
|
filename = att.get("name", "unknown")
|
||||||
|
content_type = att.get("contentType", "")
|
||||||
|
|
||||||
|
# --- DEBUGGING SORTS START ---
|
||||||
|
print(f" DEBUG: Melléklet neve: '{filename}', Content-Type: '{content_type}'")
|
||||||
|
print(f" DEBUG: filename endswith .pdf: {filename.lower().endswith('.pdf')}")
|
||||||
|
print(f" DEBUG: content_type is application/pdf: {content_type == 'application/pdf'}")
|
||||||
|
# --- DEBUGGING SORTS END ---
|
||||||
|
|
||||||
|
if filename == "Safe Attachments Scan In Progress" and content_type is None:
|
||||||
|
print(f" Placeholder melléklet kihagyása: '{filename}'")
|
||||||
|
continue
|
||||||
|
|
||||||
|
if filename.lower().endswith(".pdf") or content_type == "application/pdf":
|
||||||
|
print(f" PDF-Anhang gefunden: {filename}")
|
||||||
|
|
||||||
|
# Der Inhalt des Anhangs befindet sich im Feld 'contentBytes' und ist Base64-kodiert
|
||||||
|
file_content = base64.b64decode(att["contentBytes"])
|
||||||
|
|
||||||
|
# Dateinamen bereinigen
|
||||||
|
safe_filename = "".join(c if c.isalnum() or c in (" ", ".", "_", "-") else "_" for c in filename)
|
||||||
|
|
||||||
|
# Ellenőrizze, hogy a fájl létezik-e, és szükség esetén adjon hozzá sorszámot
|
||||||
|
base_name, extension = os.path.splitext(safe_filename)
|
||||||
|
counter = 0
|
||||||
|
while True:
|
||||||
|
if counter == 0:
|
||||||
|
final_filename = safe_filename
|
||||||
|
else:
|
||||||
|
final_filename = f"{base_name} ({counter}){extension}"
|
||||||
|
|
||||||
|
filepath = os.path.join(DOWNLOAD_DIR, final_filename)
|
||||||
|
if not os.path.exists(filepath):
|
||||||
|
break
|
||||||
|
counter += 1
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(filepath, "wb") as f:
|
||||||
|
f.write(file_content)
|
||||||
|
print(f" PDF erfolgreich gespeichert: {filepath}")
|
||||||
|
pdf_found = True
|
||||||
|
except Exception as e:
|
||||||
|
print(f" Fehler beim Speichern der Datei: {e}")
|
||||||
|
|
||||||
|
if pdf_found:
|
||||||
|
print(f" E-Mail wird in den Ordner '{PROCESSED_FOLDER_NAME}' verschoben...")
|
||||||
|
move_url = f"{GRAPH_API_ENDPOINT}/users/{USER_EMAIL}/messages/{msg_id}/move"
|
||||||
|
move_payload = {"destinationId": processed_folder_id}
|
||||||
|
|
||||||
|
response = requests.post(move_url, headers=headers, json=move_payload)
|
||||||
|
if response.status_code == 201:
|
||||||
|
print(" E-Mail erfolgreich verschoben.")
|
||||||
|
# Az áthelyezett e-mail új ID-jának lekérése a válaszból
|
||||||
|
moved_message_id = response.json().get("id")
|
||||||
|
if moved_message_id:
|
||||||
|
print(f" E-Mail új ID-ja: {moved_message_id}")
|
||||||
|
# E-Mail mint olvasottként való megjelölés az új ID-val
|
||||||
|
print(f" Markiere E-Mail '{subject}' (ID: {moved_message_id}) als gelesen...")
|
||||||
|
mark_as_read_url = f"{GRAPH_API_ENDPOINT}/users/{USER_EMAIL}/messages/{moved_message_id}"
|
||||||
|
mark_as_read_payload = {"isRead": True}
|
||||||
|
|
||||||
|
mark_response = requests.patch(mark_as_read_url, headers=headers, json=mark_as_read_payload)
|
||||||
|
if mark_response.status_code == 200:
|
||||||
|
print(" E-Mail erfolgreich als gelesen markiert.")
|
||||||
|
else:
|
||||||
|
print(f" Fehler beim Markieren der E-Mail als gelesen: {mark_response.status_code} - {mark_response.text}")
|
||||||
|
else:
|
||||||
|
print(" Hiba: Nem sikerült lekérni az áthelyezett e-mail új ID-ját a válaszból.")
|
||||||
|
else:
|
||||||
|
# Für das Verschieben ist die Berechtigung Mail.ReadWrite erforderlich!
|
||||||
|
print(f" Fehler beim Verschieben der E-Mail: {response.status_code} - {response.text}")
|
||||||
|
|
||||||
|
# Az eredeti olvasottként jelölési kód eltávolítva, mivel feljebb már megcsináljuk
|
||||||
|
|
||||||
|
|
||||||
|
print("\nVerarbeitung abgeschlossen.")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if not os.path.exists(DOWNLOAD_DIR):
|
||||||
|
print(f"Fehler: Der Download-Ordner existiert nicht: {DOWNLOAD_DIR}")
|
||||||
|
else:
|
||||||
|
main()
|
||||||
13
Scripts/python/access_token.py
Normal file
13
Scripts/python/access_token.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import webbrowser
|
||||||
|
from msal import ConfidentialClientApplication, PublicClientApplication
|
||||||
|
|
||||||
|
client_secret = 'Rk-8Q~nJ.sZ-xUiNxtEDdzVgoFFosODLVHX~jdrh'
|
||||||
|
app_id = '3a08b279-1fc3-419f-a77e-31f12a0f65f7'
|
||||||
|
SCOPES = ['Mail.ReadWrite']
|
||||||
|
|
||||||
|
client = ConfidentialClientApplication(client_id=app_id, client_credential=client_secret)
|
||||||
|
authorization_url = client.get_authorization_request_url(SCOPES)
|
||||||
|
print(authorization_url)
|
||||||
|
# webbrowser.open(authorization_url)
|
||||||
|
|
||||||
|
|
||||||
58
Scripts/python/atttachment.py
Normal file
58
Scripts/python/atttachment.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import os
|
||||||
|
import requests
|
||||||
|
from ms_graph import generate_access_token
|
||||||
|
|
||||||
|
def download_email_attachments(message_id, headers, save_folder=os.getcwd()):
|
||||||
|
try:
|
||||||
|
response = requests.get(
|
||||||
|
GRAPH_API_ENDPOINT + '/me/messages/{0}/attachments'.format(message_id),
|
||||||
|
headers=headers
|
||||||
|
)
|
||||||
|
|
||||||
|
attachment_items = response.json()['value']
|
||||||
|
for attachment in attachment_items:
|
||||||
|
file_name = attachment['name']
|
||||||
|
attachment_id = attachment['id']
|
||||||
|
attachment_content = requests.get(
|
||||||
|
GRAPH_API_ENDPOINT + '/me/messages/{0}/attachments/{1}/$value'.format(message_id, attachment_id)
|
||||||
|
)
|
||||||
|
print('Saving file {0}...'.format(file_name))
|
||||||
|
with open(os.path.join(save_folder, file_name), 'wb') as _f:
|
||||||
|
_f.write(attachment_content.content)
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Step 1. Get the access token
|
||||||
|
APP_ID = '<app id>'
|
||||||
|
SCOPES = ['Mail.ReadWrite']
|
||||||
|
GRAPH_API_ENDPOINT = 'https://graph.microsoft.com/v1.0'
|
||||||
|
|
||||||
|
access_token = generate_access_token(app_id=APP_ID, scopes=SCOPES)
|
||||||
|
headers = {
|
||||||
|
'Authorization': 'Bearer ' + access_token['access_token']
|
||||||
|
}
|
||||||
|
|
||||||
|
# Step 2. Retrieve emails
|
||||||
|
params = {
|
||||||
|
'top': 3, # max is 1000 messages per request
|
||||||
|
'select': 'subject,hasAttachments',
|
||||||
|
'filter': 'hasAttachments eq true',
|
||||||
|
'count': 'true'
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.get(GRAPH_API_ENDPOINT + '/me/mailFolders/inbox/messages', headers=headers, params=params)
|
||||||
|
if response.status_code != 200:
|
||||||
|
raise Exception(response.json())
|
||||||
|
|
||||||
|
response_json = response.json()
|
||||||
|
response_json.keys()
|
||||||
|
|
||||||
|
response_json['@odata.count']
|
||||||
|
|
||||||
|
emails = response_json['value']
|
||||||
|
for email in emails:
|
||||||
|
if email['hasAttachments']:
|
||||||
|
email_id = email['id']
|
||||||
|
download_email_attachments(email_id, headers, r'C:\Tools\')
|
||||||
92
Scripts/python/check_file_age.py
Normal file
92
Scripts/python/check_file_age.py
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Fájl kor ellenőrző script n8n automatizáláshoz.
|
||||||
|
Használat: python3 check_file_age.py <mappa_utvonal> <max_perc>
|
||||||
|
|
||||||
|
Kimenet: JSON formátum (n8n barát)
|
||||||
|
Exit kód: 0 (ha minden rendben), 1 (ha régi fájlt talált vagy hiba történt)
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
def check_files(directory, max_age_minutes=40):
|
||||||
|
now = time.time()
|
||||||
|
max_age_seconds = max_age_minutes * 60
|
||||||
|
too_old_files = []
|
||||||
|
|
||||||
|
# Mappa létezésének ellenőrzése
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
return {
|
||||||
|
"status": "error",
|
||||||
|
"alert": True,
|
||||||
|
"message": f"A megadott könyvtár nem létezik: {directory}",
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Fájlok listázása
|
||||||
|
files_in_dir = os.listdir(directory)
|
||||||
|
|
||||||
|
for filename in files_in_dir:
|
||||||
|
filepath = os.path.join(directory, filename)
|
||||||
|
|
||||||
|
# Csak a fájlokat ellenőrizzük (mappákat nem)
|
||||||
|
if os.path.isfile(filepath):
|
||||||
|
file_age_seconds = now - os.path.getmtime(filepath)
|
||||||
|
|
||||||
|
if file_age_seconds > max_age_seconds:
|
||||||
|
age_min = round(file_age_seconds / 60, 1)
|
||||||
|
too_old_files.append({
|
||||||
|
"file": filename,
|
||||||
|
"age_minutes": age_min,
|
||||||
|
"last_modified": time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(os.path.getmtime(filepath)))
|
||||||
|
})
|
||||||
|
|
||||||
|
if too_old_files:
|
||||||
|
return {
|
||||||
|
"status": "alert",
|
||||||
|
"alert": True,
|
||||||
|
"message": f"Találtam {len(too_old_files)} db fájlt, ami régebbi mint {max_age_minutes} perc!",
|
||||||
|
"directory": directory,
|
||||||
|
"limit_minutes": max_age_minutes,
|
||||||
|
"files": too_old_files
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"alert": False,
|
||||||
|
"message": "Minden fájl friss.",
|
||||||
|
"directory": directory,
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
return {
|
||||||
|
"status": "error",
|
||||||
|
"alert": True,
|
||||||
|
"message": f"Hiba történt az ellenőrzés közben: {str(e)}",
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# Paraméterek átvétele a parancssorból
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print(json.dumps({"status": "error", "message": "Hiányzó paraméter! Használat: python3 check_file_age.py <mappa> <perc>"}))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
dir_to_check = sys.argv[1]
|
||||||
|
age_limit = int(sys.argv[2]) if len(sys.argv) > 2 else 40
|
||||||
|
|
||||||
|
result = check_files(dir_to_check, age_limit)
|
||||||
|
|
||||||
|
# JSON kimenet az n8n számára
|
||||||
|
print(json.dumps(result, indent=2))
|
||||||
|
|
||||||
|
# Exit code beállítása az n8n SSH Node számára
|
||||||
|
if result.get("alert"):
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
sys.exit(0)
|
||||||
92
Scripts/python/check_file_age_de.py
Normal file
92
Scripts/python/check_file_age_de.py
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Skript zur Überprüfung des Dateialters für n8n-Automatisierung.
|
||||||
|
Verwendung: python3 check_file_age_de.py <verzeichnispfad> <max_minuten>
|
||||||
|
|
||||||
|
Ausgabe: JSON-Format (n8n-freundlich)
|
||||||
|
Exit-Code: 0 (wenn alles ok), 1 (wenn eine alte Datei gefunden wurde oder ein Fehler auftrat)
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
def check_files(directory, max_age_minutes=40):
|
||||||
|
now = time.time()
|
||||||
|
max_age_seconds = max_age_minutes * 60
|
||||||
|
too_old_files = []
|
||||||
|
|
||||||
|
# Überprüfung, ob das Verzeichnis existiert
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
return {
|
||||||
|
"status": "error",
|
||||||
|
"alert": True,
|
||||||
|
"message": f"Das angegebene Verzeichnis existiert nicht: {directory}",
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Dateien auflisten
|
||||||
|
files_in_dir = os.listdir(directory)
|
||||||
|
|
||||||
|
for filename in files_in_dir:
|
||||||
|
filepath = os.path.join(directory, filename)
|
||||||
|
|
||||||
|
# Nur Dateien prüfen (keine Verzeichnisse)
|
||||||
|
if os.path.isfile(filepath):
|
||||||
|
file_age_seconds = now - os.path.getmtime(filepath)
|
||||||
|
|
||||||
|
if file_age_seconds > max_age_seconds:
|
||||||
|
age_min = round(file_age_seconds / 60, 1)
|
||||||
|
too_old_files.append({
|
||||||
|
"file": filename,
|
||||||
|
"age_minutes": age_min,
|
||||||
|
"last_modified": time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(os.path.getmtime(filepath)))
|
||||||
|
})
|
||||||
|
|
||||||
|
if too_old_files:
|
||||||
|
return {
|
||||||
|
"status": "alert",
|
||||||
|
"alert": True,
|
||||||
|
"message": f"{len(too_old_files)} Datei(en) gefunden, die älter als {max_age_minutes} Minuten sind!",
|
||||||
|
"directory": directory,
|
||||||
|
"limit_minutes": max_age_minutes,
|
||||||
|
"files": too_old_files
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"alert": False,
|
||||||
|
"message": "Alle Dateien sind aktuell.",
|
||||||
|
"directory": directory,
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
return {
|
||||||
|
"status": "error",
|
||||||
|
"alert": True,
|
||||||
|
"message": f"Fehler während der Überprüfung aufgetreten: {str(e)}",
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# Parameter aus der Befehlszeile übernehmen
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print(json.dumps({"status": "error", "message": "Fehlender Parameter! Verwendung: python3 check_file_age_de.py <verzeichnis> <minuten>"}))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
dir_to_check = sys.argv[1]
|
||||||
|
age_limit = int(sys.argv[2]) if len(sys.argv) > 2 else 40
|
||||||
|
|
||||||
|
result = check_files(dir_to_check, age_limit)
|
||||||
|
|
||||||
|
# JSON-Ausgabe für n8n
|
||||||
|
print(json.dumps(result, indent=2))
|
||||||
|
|
||||||
|
# Exit-Code für den n8n SSH-Node festlegen
|
||||||
|
if result.get("alert"):
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
sys.exit(0)
|
||||||
75
Scripts/python/get_app_permissions.py
Normal file
75
Scripts/python/get_app_permissions.py
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import msal
|
||||||
|
import json
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# KONFIGURATION
|
||||||
|
# ==============================================================================
|
||||||
|
TENANT_ID = "caee3499-03f8-4175-9fa8-a935248d0ece"
|
||||||
|
CLIENT_ID = "3a08b279-1fc3-419f-a77e-31f12a0f65f7"
|
||||||
|
CLIENT_SECRET = "Rk-8Q~nJ.sZ-xUiNxtEDdzVgoFFosODLVHX~jdrh"
|
||||||
|
|
||||||
|
GRAPH_API_ENDPOINT = "https://graph.microsoft.com/v1.0"
|
||||||
|
AUTHORITY_URL = f"https://login.microsoftonline.com/{TENANT_ID}"
|
||||||
|
SCOPES = ["https://graph.microsoft.com/.default"]
|
||||||
|
|
||||||
|
def get_access_token():
|
||||||
|
"""Acquires an access token using client credentials flow."""
|
||||||
|
app = msal.ConfidentialClientApplication(
|
||||||
|
CLIENT_ID,
|
||||||
|
authority=AUTHORITY_URL,
|
||||||
|
client_credential=CLIENT_SECRET
|
||||||
|
)
|
||||||
|
result = app.acquire_token_for_client(scopes=SCOPES)
|
||||||
|
if "access_token" in result:
|
||||||
|
return result["access_token"]
|
||||||
|
else:
|
||||||
|
raise Exception(f"Could not acquire access token: {result.get('error_description')}")
|
||||||
|
|
||||||
|
def get_application_permissions(access_token, app_id):
|
||||||
|
"""
|
||||||
|
Retrieves the appRoles (permissions) for a given application (service principal).
|
||||||
|
"""
|
||||||
|
headers = {
|
||||||
|
'Authorization': 'Bearer ' + access_token,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
# Construct the URL to query the service principal by appId and select appRoles
|
||||||
|
url = (f"{GRAPH_API_ENDPOINT}/servicePrincipals?"
|
||||||
|
f"$filter=appId+eq+'{app_id}'&"
|
||||||
|
f"$select=displayName,appId,appRoles")
|
||||||
|
|
||||||
|
response = requests.get(url, headers=headers)
|
||||||
|
response.raise_for_status() # Raise an exception for HTTP errors
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
print("Acquiring access token...")
|
||||||
|
token = get_access_token()
|
||||||
|
print("Access token acquired.")
|
||||||
|
|
||||||
|
print(f"Retrieving permissions for application (Client ID: {CLIENT_ID})...")
|
||||||
|
service_principal_data = get_application_permissions(token, CLIENT_ID)
|
||||||
|
|
||||||
|
if service_principal_data and service_principal_data.get('value'):
|
||||||
|
for sp in service_principal_data['value']:
|
||||||
|
print(f"\nApplication Display Name: {sp.get('displayName')}")
|
||||||
|
print(f"Application ID: {sp.get('appId')}")
|
||||||
|
app_roles = sp.get('appRoles', [])
|
||||||
|
if app_roles:
|
||||||
|
print("Application Permissions (appRoles):")
|
||||||
|
for role in app_roles:
|
||||||
|
print(f" - Display Name: {role.get('displayName')}")
|
||||||
|
print(f" Description: {role.get('description')}")
|
||||||
|
print(f" Value: {role.get('value')}")
|
||||||
|
print(f" ID: {role.get('id')}")
|
||||||
|
print(f" IsEnabled: {role.get('isEnabled')}")
|
||||||
|
else:
|
||||||
|
print("No application permissions (appRoles) found for this service principal.")
|
||||||
|
else:
|
||||||
|
print("No service principal found with the given Client ID or no data returned.")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An error occurred: {e}")
|
||||||
92
Scripts/python/get_app_permissions_de.py
Normal file
92
Scripts/python/get_app_permissions_de.py
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import msal
|
||||||
|
import json
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# KONFIGURATION
|
||||||
|
# ==============================================================================
|
||||||
|
TENANT_ID = "caee3499-03f8-4175-9fa8-a935248d0ece"
|
||||||
|
CLIENT_ID = "3a08b279-1fc3-419f-a77e-31f12a0f65f7"
|
||||||
|
CLIENT_SECRET = "Rk-8Q~nJ.sZ-xUiNxtEDdzVgoFFosODLVHX~jdrh"
|
||||||
|
|
||||||
|
GRAPH_API_ENDPOINT = "https://graph.microsoft.com/v1.0"
|
||||||
|
AUTHORITY_URL = f"https://login.microsoftonline.com/{TENANT_ID}"
|
||||||
|
SCOPES = ["https://graph.microsoft.com/.default"]
|
||||||
|
|
||||||
|
def get_access_token():
|
||||||
|
"""Ruft ein Zugriffstoken mittels Client-Anmeldeinformationen-Fluss ab."""
|
||||||
|
app = msal.ConfidentialClientApplication(
|
||||||
|
CLIENT_ID,
|
||||||
|
authority=AUTHORITY_URL,
|
||||||
|
client_credential=CLIENT_SECRET
|
||||||
|
)
|
||||||
|
result = app.acquire_token_for_client(scopes=SCOPES)
|
||||||
|
if "access_token" in result:
|
||||||
|
return result["access_token"]
|
||||||
|
else:
|
||||||
|
raise Exception(f"Zugriffstoken konnte nicht abgerufen werden: {result.get('error_description')}")
|
||||||
|
|
||||||
|
def get_application_permissions(access_token, app_id):
|
||||||
|
"""
|
||||||
|
Ruft die appRoles (Berechtigungen) für eine gegebene Anwendung (Dienstprinzipal) ab.
|
||||||
|
"""
|
||||||
|
headers = {
|
||||||
|
'Authorization': 'Bearer ' + access_token,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
# Erstellt die URL, um den Dienstprinzipal anhand der appId abzufragen und appRoles auszuwählen
|
||||||
|
url = (f"{GRAPH_API_ENDPOINT}/servicePrincipals?"
|
||||||
|
f"$filter=appId+eq+'{app_id}'&"
|
||||||
|
f"$select=displayName,appId,appRoles,requiredResourceAccess")
|
||||||
|
|
||||||
|
response = requests.get(url, headers=headers)
|
||||||
|
response.raise_for_status() # Löst eine Ausnahme für HTTP-Fehler aus
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
print("Zugriffstoken wird abgerufen...")
|
||||||
|
token = get_access_token()
|
||||||
|
print("Zugriffstoken erfolgreich abgerufen.")
|
||||||
|
|
||||||
|
print(f"Berechtigungen für Anwendung (Client ID: {CLIENT_ID}) werden abgerufen...")
|
||||||
|
service_principal_data = get_application_permissions(token, CLIENT_ID)
|
||||||
|
|
||||||
|
if service_principal_data and service_principal_data.get('value'):
|
||||||
|
for sp in service_principal_data['value']:
|
||||||
|
print(f"\nAnzeigename der Anwendung: {sp.get('displayName')}")
|
||||||
|
print(f"Anwendungs-ID: {sp.get('appId')}")
|
||||||
|
app_roles = sp.get('appRoles', [])
|
||||||
|
if app_roles:
|
||||||
|
print("Anwendungsberechtigungen (appRoles):")
|
||||||
|
for role in app_roles:
|
||||||
|
print(f" - Anzeigename: {role.get('displayName')}")
|
||||||
|
print(f" Beschreibung: {role.get('description')}")
|
||||||
|
print(f" Wert: {role.get('value')}")
|
||||||
|
print(f" ID: {role.get('id')}")
|
||||||
|
print(f" Aktiviert: {role.get('isEnabled')}")
|
||||||
|
else:
|
||||||
|
print("Keine Anwendungsberechtigungen (appRoles) für diesen Dienstprinzipal gefunden.")
|
||||||
|
|
||||||
|
required_resource_access = sp.get('requiredResourceAccess', [])
|
||||||
|
if required_resource_access:
|
||||||
|
print("\nKonfigurierte API-Zugriffsberechtigungen (requiredResourceAccess):")
|
||||||
|
for resource_access in required_resource_access:
|
||||||
|
resource_app_id = resource_access.get('resourceAppId')
|
||||||
|
print(f" Resource App ID: {resource_app_id}")
|
||||||
|
for ra in resource_access.get('resourceAccess', []):
|
||||||
|
type_of_perm = "Unbekannt"
|
||||||
|
if ra.get('type') == 'Scope':
|
||||||
|
type_of_perm = "Delegierte Berechtigung"
|
||||||
|
elif ra.get('type') == 'Role':
|
||||||
|
type_of_perm = "Anwendungsberechtigung"
|
||||||
|
|
||||||
|
print(f" - Berechtigungs ID: {ra.get('id')} (Typ: {type_of_perm})")
|
||||||
|
else:
|
||||||
|
print("Keine konfigurierten API-Zugriffsberechtigungen (requiredResourceAccess) gefunden.")
|
||||||
|
else:
|
||||||
|
print("Kein Dienstprinzipal mit der angegebenen Client ID gefunden oder keine Daten zurückgegeben.")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Ein Fehler ist aufgetreten: {e}")
|
||||||
70
Scripts/python/md_to_pdf_recursive.py
Normal file
70
Scripts/python/md_to_pdf_recursive.py
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
"""
|
||||||
|
Használati útmutató / Usage:
|
||||||
|
|
||||||
|
1. Telepítés / Installation:
|
||||||
|
pip install markdown-pdf
|
||||||
|
|
||||||
|
2. Futtatás / Execution:
|
||||||
|
- Aktuális könyvtár bejárása:
|
||||||
|
python Scripts/python/md_to_pdf_recursive.py
|
||||||
|
- Konkrét könyvtár megadása:
|
||||||
|
python Scripts/python/md_to_pdf_recursive.py Dev/APS-SFTP01
|
||||||
|
|
||||||
|
A script rekurzívan végigjárja a megadott könyvtárat, és minden .md fájl mellé
|
||||||
|
létrehoz egy azonos nevű .pdf fájlt. A .git, .venv és __pycache__ könyvtárakat kihagyja.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from markdown_pdf import Section, MarkdownPdf
|
||||||
|
|
||||||
|
def convert_md_to_pdf(root_dir):
|
||||||
|
"""
|
||||||
|
Rekurzívan végigjárja a megadott könyvtárat és minden .md fájlból PDF-et készít.
|
||||||
|
"""
|
||||||
|
print(f"Keresés indítása a következő könyvtárban: {root_dir}")
|
||||||
|
|
||||||
|
# Kizárandó könyvtárak (pl. git, virtuális környezet)
|
||||||
|
exclude_dirs = {'.git', '.venv', '__pycache__', 'node_modules'}
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
for root, dirs, files in os.walk(root_dir):
|
||||||
|
# Alkönyvtárak szűrése (helyben módosítva a dirs listát)
|
||||||
|
dirs[:] = [d for d in dirs if d not in exclude_dirs]
|
||||||
|
|
||||||
|
for file in files:
|
||||||
|
if file.endswith(".md"):
|
||||||
|
md_path = os.path.join(root, file)
|
||||||
|
pdf_path = os.path.splitext(md_path)[0] + ".pdf"
|
||||||
|
|
||||||
|
print(f"Konvertálás: {md_path} -> {pdf_path}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Markdown olvasása
|
||||||
|
with open(md_path, "r", encoding="utf-8") as f:
|
||||||
|
md_content = f.read()
|
||||||
|
|
||||||
|
# PDF generálása
|
||||||
|
pdf = MarkdownPdf(toc_level=2)
|
||||||
|
pdf.add_section(Section(md_content, toc=False))
|
||||||
|
pdf.save(pdf_path)
|
||||||
|
|
||||||
|
count += 1
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Hiba a fájl feldolgozása közben ({md_path}): {e}")
|
||||||
|
|
||||||
|
print(f"\nKész! Összesen {count} fájl lett konvertálva.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# Ha nincs megadva útvonal, az aktuális könyvtárat használja
|
||||||
|
target_path = sys.argv[1] if len(sys.argv) > 1 else "."
|
||||||
|
|
||||||
|
# Ellenőrizzük a függőséget
|
||||||
|
try:
|
||||||
|
import markdown_pdf
|
||||||
|
except ImportError:
|
||||||
|
print("Hiba: A 'markdown-pdf' könyvtár nincs telepítve.")
|
||||||
|
print("Telepítés: pip install markdown-pdf")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
convert_md_to_pdf(target_path)
|
||||||
54
Scripts/python/mysql_cleaning/delete_old_records.py
Normal file
54
Scripts/python/mysql_cleaning/delete_old_records.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import mysql.connector
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
# MySQL connection details
|
||||||
|
MYSQL_HOST = "10.102.1.65"
|
||||||
|
MYSQL_USER = "svc.emailtopdf"
|
||||||
|
MYSQL_PASSWORD = "zZUHrps62skLKfr9yQwQ"
|
||||||
|
MYSQL_DATABASE = "emailtopdf"
|
||||||
|
MYSQL_TABLE = "emailtopdf"
|
||||||
|
DATE_COLUMN = "timestamp"
|
||||||
|
|
||||||
|
def delete_old_records():
|
||||||
|
"""
|
||||||
|
Deletes records older than one week from the specified MySQL table.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
# Connect to the MySQL database
|
||||||
|
conn = mysql.connector.connect(
|
||||||
|
host=MYSQL_HOST,
|
||||||
|
user=MYSQL_USER,
|
||||||
|
password=MYSQL_PASSWORD,
|
||||||
|
database=MYSQL_DATABASE
|
||||||
|
)
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
# Calculate the date one week ago
|
||||||
|
one_week_ago = datetime.now() - timedelta(days=7)
|
||||||
|
formatted_date = one_week_ago.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
|
# SQL query to delete old records
|
||||||
|
query = f"DELETE FROM {MYSQL_TABLE} WHERE {DATE_COLUMN} < %s"
|
||||||
|
|
||||||
|
# Execute the query
|
||||||
|
cursor.execute(query, (formatted_date,))
|
||||||
|
|
||||||
|
# Get the number of deleted rows
|
||||||
|
deleted_rows = cursor.rowcount
|
||||||
|
|
||||||
|
# Commit the transaction
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
print(f"Successfully deleted {deleted_rows} records older than one week.")
|
||||||
|
|
||||||
|
except mysql.connector.Error as err:
|
||||||
|
print(f"Error: {err}")
|
||||||
|
finally:
|
||||||
|
# Close the connection
|
||||||
|
if 'conn' in locals() and conn.is_connected():
|
||||||
|
cursor.close()
|
||||||
|
conn.close()
|
||||||
|
print("MySQL connection is closed.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
delete_old_records()
|
||||||
1
Scripts/python/mysql_cleaning/requirements.txt
Normal file
1
Scripts/python/mysql_cleaning/requirements.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
mysql-connector-python
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user