Windows Terminal Profiles.json

Das Windows Terminal

Windows-Terminal ist eine neue, moderne leistungsstarke und produktive Terminalanwendung für Befehlszeilentools wie Command Prompt, PowerShell und das Windows-Subsystem für Linux (WSL) sowie Git-Bash. Zu den Hauptfunktionen gehören, Terminal Ausführung in Taps, Unicode- und UTF-8 Zeichenunterstützung, eine GPU-Accelerated Text Rendering-Engine, sowie die Möglichkeit für benutzerdefinierte Themen und Stiles zu Konfigurieren.

Profile für eine Vielzahl von Befehlszeilenanwendungen

Alle Anwendung, die über eine Befehlszeilenschnittstelle verfügen, können in Windows Terminal ausgeführt werden. Dies umfasst alles von PowerShell und der Eingabeaufforderung und Git-Bash bis hin zu Azure Cloud Shell und beliebigen WSL-Distributionen wie Ubuntu.

Angepasste Schemas Konfigurationen

Es können Windows Terminal so konfiguriert werden, dass es über eine Vielzahl von Farbschemas und Einstellungen verfügt.

Die Konfiguration wird mittels JSON in der Konfigurationsdatei profiles.json gespeichert. Hier ein Beispiel mit Profile für PowerShell, Command Prompt, Git-Bash und das Windows Linux Subsystem (WSL).

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation

{
    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "alwaysShowTabs" : true,
    "initialCols" : 144,
    "initialRows" : 43,
    "copyOnSelect": true,

    "profiles":
    [
        {
            // Make changes here to the powershell.exe profile
            "guid" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name" : "Windows PowerShell",
            "tabTitle": "Windows PowerShell",
            "commandline" : "powershell.exe",
            "colorScheme" : "Campbell Powershell",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "hidden" : false
        },
        {
            // Make changes here to the cmd.exe profile
            "guid" : "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name" : "cmd Classic",
            "commandline" : "cmd.exe",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "hidden" : false
        },
        {
            // Make changes here to the cmd.exe profile
            "guid" : "{27fc4584-088c-452d-ae31-00f041ab4d7a}",
            "name" : "cmd Acrylic",
            "tabTitle": "Command Prompt",
            "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
            "commandline" : "cmd.exe",
            "colorScheme" : "One Half Dark",
            "closeOnExit" : true,
            "startingDirectory" : "%USERPROFILE%",
            "useAcrylic" : true,
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "hidden" : false
        },
        {
            // Make changes here to the git-bash profile
            "guid" : "{e950864a-e41d-4268-936f-dd9e7010c86c}",
            "name" : "Git Bash Classic",
            "tabTitle": "Git Bash",
            "icon" : "ms-appdata:///local/git-logo-black.png",
            "commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l",
            "startingDirectory" : "%USERPROFILE%",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "hidden" : false
        },
        {
            // Make changes here to the git-bash profile
            "guid" : "{00000000-0000-0000-ba54-000000000002}",
            "name" : "Git Bash Acrylic",
            "tabTitle": "Git Bash",
            "icon" : "ms-appdata:///local/git-logo-red.png",
            "commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l",
            "startingDirectory" : "%USERPROFILE%",
            "closeOnExit" : true,
            "snapOnInput" : true,
            "colorScheme" : "Vintage",
            "cursorColor" : "#7ddd00",
            "cursorShape" : "vintage",
            "historySize" : 9001,
            "acrylicOpacity" : 0.75,
            "useAcrylic" : true,
            "fontFace" : "Consolas",
            "fontSize": 10,
            "padding" : "6, 0, 0, 0",
            "hidden" : false
        },
        {
            // Make changes here to the wsl profile
            "guid" : "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
            "name" : "Debian",
            "icon" : "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.scale-200.png",
            "commandline" : "wsl.exe -d Debian",
            "startingDirectory" : "%USERPROFILE%\\wslhome",
            "closeOnExit" : true,
            "snapOnInput" : true,
            "colorScheme" : "Campbell",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "acrylicOpacity" : 0.75,
            "useAcrylic" : true,
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "padding" : "6, 0, 0, 0",
            "hidden" : false
        },
        {
            "guid" : "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "name" : "Azure Cloud Shell",
            "source" : "Windows.Terminal.Azure",
            "hidden" : true
        }
    ],

    // Add custom color schemes to this array
    "schemes": [],

    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings":
    [
    { "command": { "action": "splitPane", "split": "vertical" }, "keys": "ctrl+shift+-" },
    { "command": { "action": "splitPane", "split": "horizontal" }, "keys": "alt+shift+-" },
    { "command": { "action": "splitPane", "split": "auto" }, "keys": "alt+shift+|" },
    // Press Ctrl+Shift+F to open the search box
    { "command": "find", "keys": "ctrl+f" },
    // Open New Tab
    { "command": "newTab", "keys": "ctrl+t" }
    ]
}

  Mit der Option copyOnSelect true, werden markierte Texte in die Zwischenablage kopiert, wie es in Linux Bash oder von PuTTY bekannt ist.

Die Datei profiles.json befindet sich in folgendem Pfad:

%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
Windows Explorer

Windows Terminal Settings

Windows Terminal Settings öffnen über die Pfeilspitze nach unten, oder über den Tastatur Hotkey Ctrl+,

Windows Terminal Settings

  Ein Windows-Terminal referenziert über die GUID (Globally Unique Identifier) in seiner Sektion (guid) in profiles.json, wer eine neue GUID erzeugen möchte, kann folgendes Command in der PowerShell ausführen.

PS C:\> [guid]::NewGuid()

Guid
----
ebe11d6b-36cc-46e3-a580-459fa0c3a06c

PS C:\>

Git for Windows Arbeitsumgebung gibt es im Download

Git Icons werden in den LocalState Ordner gespeichert.

Windows Terminal Splitting

Windows Terminal erlaubt das splitting der Terminal Fenster mit Ctrl+- Horizontal, mit Crtl+. in Vertikaler Aufteilung der Fenster.

Windows Terminal Split Horizontal Ctrl+- / Split Vertikal Ctrl+

Windows Terminal OpenSSH

Secure Shell zu einem Remote Host aus dem Windows Terminal wird emöglicht, wenn unter Windows 10, Apps & Features – Optionale Features, das Paket OpenSSH Client installiert wurde.

In der Zeile commandLine wird SSH zu einem Host aufgerufen, in einer Profile Sektion in der Datei profiles.json:

"commandline" : "ssh.exe fedora",

Dabei muss die Authentifizierung mittels SSH-Key angewandt werden, der mit ssh-keygen erzeugte Public Key befindet sich hier auf dem Host fedora.foo.bar unter User home neutrino ~/.ssh/authorized_keys.

Die SSH-Konfigurationsdatei hierfür auf dem lokalen Host hat folgenden Inhalt in ~/.ssh/config

Host fedora.foo.bar
    HostName fedora
    User neutrino
    IdentityFile ~/.ssh/hostkey
    ServerAliveInterval 60

  IdentityFile ist der in Datei ~/.ssh/hostkey beinhaltete Privatkey dieser mit ssh-keygen generiert wurde.

„commandline“ : „ssh.exe fedora“

Kopano Fail2ban Filter

Kopano Server Attacken Schutz mit Fail2ban Filter

Dieses Howto beschreibt die Installation und Konfiguration von Fail2ban für die Kopano Groupware auf Ubuntu. Fail2ban bietet effektiven schutz gegen Brute-Force Attacken, in dem aus Syslog und Apache Protokoll fehlgeschlagene Versuche von Authentifizierungen herausgefiltert werden, um anschliessend den Host für eine bestimmte Zeit mittels Kernel Firewall zu blockieren.

Installation Fail2ban auf Kopano Server

Das Paket Fail2ban wird auf Ubuntu als root wie folgt installiert. Fail2ban ist auf Python entwickelt, weshalb die erforderlichen Bibliotheken nachgeladen werden.

$ apt-get update
$ apt-get install fail2ban -y

Nach der Installation wird Fail2ban ausgeführt und in systemd für den autostart aktiviert.

$ systemctl start fail2ban
$ systemctl enable fail2ban

Fail2ban Filter für Kopano bereitstellen

Ein Filter für Kopano bereitstellen, wir erstellen die Datei kopano-webapp-auth.conf

$ vi /etc/fail2ban/filter.d/kopano-webapp-auth.conf

Den Inhalt mit folgenden Zeilen in die Filter Datei einfügen:

# Fail2Ban kopano-webbapp-auth filter
# /etc/fail2ban/filter.d/kopano-webapp-auth.conf

[INCLUDES]
before = apache-common.conf

[Definition]
failregex = ^%(_apache_error_client)s Kopano WebApp user:.* authentication failure at MAPI

ignoreregex =

Fail2ban Filter in jail.conf aktivieren

Aktiviere den Fail2ban Filter für Kopano, mit erstellen der Konfigurationsdatei jail.local.

$ vi /etc/fail2ban/jail.local

Und den folgenden Inhalt einfügen:

[sshd]
port    = ssh
logpath = %(sshd_log)s

[kopano-webapp]
enabled = true
port    = https
filter  = kopano-webapp-auth
logpath = %(apache_error_log)s

[apache-auth]
enabled = true
port    = http,https
logpath = %(apache_error_log)s

Hier wird error.log ausgelesen mit der Variable %(apache_error_log), /var/log/apache2/error.log

Fail2ban erneut starten um die änderungen zu aktivieren.

$ systemctl restart fail2ban

Fail2ban Client Status überprüfen

Den Status von Fail2ban kann wie folgt überprüft werden.

$ fail2ban-client status
Status
|- Number of jail:      3
`- Jail list:   apache-auth, kopano-webapp, sshd
 
root@kopano:~# fail2ban-client status kopano-webapp
Status for the jail: kopano-webapp
|- Filter
|  |- Currently failed: 0
|  |- Total failed:     7
|  `- File list:        /var/log/apache2/mattermost-error.log /var/log/apache2/error.log
`- Actions
   |- Currently banned: 4
   |- Total banned:     52
   `- Banned IP list: 10.10.10.101 172.17.88.91 172.31.16.3 10.32.57.98

Die Firewall gibt Aufschluss über den Status der aktuell durch Fail2ban geblockten Quellen, mit einer iptables Abfrage:

$ iptables -vnL | egrep "f2b-kopano-webapp|apache-auth|sshd"

Fail2ban intrusion prevention software framework

Fail2ban is an intrusion prevention software framework. Written in the Python programming language, it is designed to prevent brute-force attacks. It is able to run on POSIX systems that have an interface to a packet-control system or firewall installed locally, such as iptables or TCP Wrapper.

Fail2ban operates by monitoring log files (e.g. /var/log/auth.log, /var/log/apache/access.log, etc.) for selected entries and running scripts based on them. Most commonly this is used to block selected IP addresses that may belong to hosts that are trying to breach the system’s security. It can ban any host IP address that makes too many login attempts or performs any other unwanted action within a time frame defined by the administrator.

It includes support for both IPv4 and IPv6. Optionally longer bans can be custom-configured for „recidivist“ abusers that keep coming back. Fail2ban is typically set up to unban a blocked host within a certain period, so as to not „lock out“ any genuine connections that may have been temporarily misconfigured. However, an unban time of several minutes is usually enough to stop a network connection being flooded by malicious connections, as well as reducing the likelihood of a successful dictionary attack.

Copy
Die mobile Version verlassen