Azure Linux
Overview
Azure Virtual Machines service is developed and managed by Microsoft Corp.
Related Built-in Rules
Benefit from SEKOIA.IO built-in rules and upgrade Azure Linux with the following detection capabilities out-of-the-box.
SEKOIA.IO x Azure Linux on ATT&CK Navigator
Address Space Layout Randomization (ASLR) Alteration
ASLR is a security feature used by the Operating System to mitigate memory exploit, attacker might want to disable it
- Effort: intermediate
Advanced IP Scanner
Detects the use of Advanced IP Scanner. Seems to be a popular tool for ransomware groups.
- Effort: master
Audio Capture via PowerShell
Detects audio capture via PowerShell Cmdlet
- Effort: intermediate
BazarLoader Persistence Using Schtasks
Detects possible BazarLoader persistence using schtasks. BazarLoader will create a Scheduled Task using a specific command line to establish its persistence.
- Effort: intermediate
Blue Mockingbird Malware
Attempts to detect system changes made by Blue Mockingbird
- Effort: elementary
Change Default File Association
When a file is opened, the default program used to open the file (also called the file association or handler) is checked. File association selections are stored in the Windows Registry and can be edited by users, administrators, or programs that have Registry access or by administrators using the built-in assoc utility. Applications can modify the file association for a given file extension to call an arbitrary program when a file with the given extension is opened.
- Effort: advanced
Clear EventLogs Through CommandLine
Detects a command that clears event logs which could indicate an attempt from an attacker to erase its previous traces.
- Effort: intermediate
Commonly Used Commands To Stop Services And Remove Backups
Detects specific commands used regularly by ransomwares to stop services or remove backups
- Effort: intermediate
Control Panel Items
Detects the malicious use of a control panel item
- Effort: advanced
DNS Exfiltration and Tunneling Tools Execution
Well-known DNS exfiltration tools execution
- Effort: intermediate
Data Compressed With Rar With Password
An adversary may compress data in order to make it portable and minimize the amount of data sent over the network, this could be done the popular rar command line program. This is a more specific one for rar where the arguments allow to encrypt both file data and headers with a given password.
- Effort: intermediate
Debugging Software Deactivation
Deactivation of some debugging softwares using taskkill command. It was observed being used by Ransomware operators.
- Effort: elementary
Default Encoding To UTF-8 PowerShell
Detects PowerShell encoding to UTF-8, which is used by Sliver implants. The command line just sets the default encoding to UTF-8 in PowerShell.
- Effort: advanced
Disable Task Manager Through Registry Key
Detects commands used to disable the Windows Task Manager by modifying the proper registry key in order to impair security tools. This technique is used by the Agent Tesla RAT, among others.
- Effort: elementary
Disabled IE Security Features
Detects from the command lines or the registry, changes that indicate unwanted modifications to registry keys that disable important Internet Explorer security features. This has been used by attackers during Operation Ke3chang.
- Effort: advanced
Domain Trust Discovery Through LDAP
Detects attempts to gather information on domain trust relationships that may be used to identify lateral movement opportunities. "trustedDomain" which is detected here is a Microsoft Active Directory ObjectClass Type that represents a domain that is trusted by, or trusting, the local AD DOMAIN. Several tools are using LDAP queries in the end to get the information (DSQuery, sometimes ADFind as well, etc.)
- Effort: elementary
Dynamic Linker Hijacking From Environment Variable
LD_PRELOAD and LD_LIBRARY_PATH are environment variables used by the Operating System at the runtime to load shared objects (library.ies) when executing a new process, attacker can overwrite this variable to attempts a privileges escalation.
- Effort: advanced
ETW Tampering
Detects a command that clears or disables any ETW Trace log which could indicate a logging evasion
- Effort: intermediate
Exchange PowerShell Snap-Ins To Export Exchange Mailbox Data
Detects PowerShell SnapIn command line, often used with Get-Mailbox to export Exchange mailbox data.
- Effort: intermediate
Exfiltration Domain In Command Line
Detects commands containing a domain linked to http exfiltration.
- Effort: intermediate
HackTools Suspicious Process Names In Command Line
Detects the default process name of several HackTools and also check in command line. This rule is here for quickwins as it obviously has many blind spots.
- Effort: intermediate
High Privileges Network Share Removal
Detects high privileges shares being deleted with the net share command.
- Effort: intermediate
ICacls Granting Access To All
Detects suspicious icacls command granting access to all, used by the ransomware Ryuk to delete every access-based restrictions on files and directories. ICacls is a built-in Windows command to interact with the Discretionary Access Control Lists (DACLs) which can grand adversaries higher permissions on specific files and folders.
- Effort: elementary
KeePass Config XML In Command-Line
Detects a command-line interaction with the KeePass Config XML file. It could be used to retrieve informations or to be abused for persistence.
- Effort: intermediate
Lazarus Loaders
Detects different loaders used by the Lazarus Group APT
- Effort: elementary
MalwareBytes Uninstallation
Detects command line being used by attackers to uninstall Malwarebytes.
- Effort: intermediate
MavInject Process Injection
Detects process injection using the signed Windows tool Mavinject32.exe (which is a LOLBAS)
- Effort: intermediate
Msdt (Follina) File Browse Process Execution
Detects various Follina vulnerability exploitation techniques. This is based on the Compatability Troubleshooter which is abused to do code execution.
- Effort: elementary
NTDS.dit File Interaction Through Command Line
Detects interaction with the file NTDS.dit through command line. This is usually really suspicious and could indicate an attacker trying copy the file to then look for users password hashes.
- Effort: intermediate
NetSh Used To Disable Windows Firewall
Detects NetSh commands used to disable the Windows Firewall
- Effort: intermediate
Netsh Allowed Python Program
Detects netsh command that performs modification on Firewall rules to allow the program python.exe. This activity is most likely related to the deployment of a Python server or an application that needs to communicate over a network. Threat actors could use it for data extraction, hosting a webshell or else.
- Effort: intermediate
Netsh Port Forwarding
Detects netsh commands that enable a port forwarding between to hosts. This can be used by attackers to tunnel RDP or SMB shares for example.
- Effort: elementary
Netsh RDP Port Forwarding
Detects netsh commands that configure a port forwarding of port 3389 used for RDP. This is commonly used by attackers during lateralization on windows environments.
- Effort: elementary
New DLL Added To AppCertDlls Registry Key
Dynamic-link libraries (DLLs) that are specified in the AppCertDLLs value in the Registry key can be abused to obtain persistence and privilege escalation by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. Logging for Registry events is needed in the Sysmon configuration (events 12 and 13).
- Effort: intermediate
NlTest Usage
Detects attempts to gather information on domain trust relationships that may be used to identify lateral movement opportunities. These command lines were observed in numerous attacks, but also sometimes from legitimate administrators for debugging purposes. The rule does not cover very basics commands but rather the ones that are interesting for attackers to gather information on a domain.
- Effort: intermediate
Non-Legitimate Executable Using AcceptEula Parameter
Detects accepteula in command line with non-legitimate executable name. Some attackers are masquerading SysInternals tools with decoy names to prevent detection.
- Effort: intermediate
Outlook Registry Access
Detection of accesses to Microsoft Outlook registry hive, which might contain sensitive information.
- Effort: elementary
Phorpiex DriveMgr Command
Detects specific command used by the Phorpiex botnet to execute a copy of the loader during its self-spreading stage. As described by Microsoft, this behavior is unique and easily identifiable due to the use of folders named with underscores "__" and the PE name "DriveMgr.exe".
- Effort: elementary
Phorpiex Process Masquerading
Detects specific process executable path used by the Phorpiex botnet to masquerade its system process network activity. It looks for a pattern of a system process executable name that is not legitimate and running from a folder that is created via a random algorithm 13-15 numbers long.
- Effort: elementary
PowerCat Function Loading
Detect a basic execution of PowerCat. PowerCat is a PowerShell function allowing to do basic connections, file transfer, shells, relays, generate payloads.
- Effort: intermediate
PowerShell AMSI Deactivation Bypass Using .NET Reflection
Detects Request to amsiInitFailed that can be used to disable AMSI (Antimalware Scan Interface) Scanning. More information about Antimalware Scan Interface https://docs.microsoft.com/en-us/windows/win32/amsi/antimalware-scan-interface-portal.
- Effort: elementary
PowerShell EncodedCommand
Detects popular file extensions in commands obfuscated in base64 run through the EncodedCommand option.
- Effort: advanced
Powershell UploadString Function
Powershell's uploadXXX
functions are a category of methods which can be used to exfiltrate data through native means on a Windows host.
- Effort: intermediate
Process Memory Dump Using Comsvcs
Detects the use of comsvcs in command line to dump a specific proces memory. This techinique is widlely used by attackers for privilege escalation and pivot.
- Effort: elementary
Process Trace Alteration
PTrace syscall provides a means by which one process ("tracer") may observe and control the execution of another process ("tracee") and examine and change the tracee's memory and registers. Attacker might want to abuse ptrace functionnality to analyse memory process. It requires to be admin or set ptrace_scope to 0 to allow all user to trace any process.
- Effort: advanced
Python HTTP Server
Detects command used to start a Simple HTTP server in Python. Threat actors could use it for data extraction, hosting a webshell or else.
- Effort: intermediate
Qakbot Persistence Using Schtasks
Detects possible Qakbot persistence using schtasks.
- Effort: intermediate
RYUK Ransomeware - martinstevens Username
Detects user name "martinstevens". Wizard Spider is used to add the user name "martinstevens" to the AD of its victims. It was observed in several campaigns; in 2019 and 2020.
- Effort: elementary
Raccine Uninstall
Detects commands that indicate a Raccine removal from an end system. Raccine is a free ransomware protection tool.
- Effort: elementary
RedMimicry Winnti Playbook Registry Manipulation
Detects actions caused by the RedMimicry Winnti playbook. Logging for Registry events is needed in the Sysmon configuration (events 12 and 13).
- Effort: elementary
Rubeus Tool Command-line
Detects command line parameters used by Rubeus, a toolset to interact with Kerberos and abuse it.
- Effort: advanced
SEKOIA.IO Intelligence Feed
Detect threats based on indicators of compromise (IOCs) collected by SEKOIA's Threat and Detection Research team.
- Effort: elementary
SOCKS Tunneling Tool
Detects the usage of a SOCKS tunneling tool, often used by threat actors. These tools often use the socks5 commandline argument, however socks4 can sometimes be used as well. Unfortunately, socks alone (without any number) triggered too many false positives.
- Effort: intermediate
Socat Relaying Socket
Socat is a linux tool used to relay local socket or internal network connection, this technics is often used by attacker to bypass security equipment such as firewall
- Effort: intermediate
Socat Reverse Shell Detection
Socat is a linux tool used to relay or open reverse shell that is often used by attacker to bypass security equipment
- Effort: intermediate
Spyware Persistence Using Schtasks
Detects possible Agent Tesla or Formbook persistence using schtasks. The name of the scheduled task used by these malware is very specific (Updates/randomstring).
- Effort: intermediate
Suncrypt Parameters
Detects SunCrypt ransomware's parameters, most of which are unique.
- Effort: elementary
Suspicious Cmd File Copy Command To Network Share
Copy suspicious files through Windows cmd prompt to network share
- Effort: intermediate
Suspicious DLL Loading By Ordinal
Detects suspicious DLL Loading by ordinal number in a non legitimate or rare folders. For example, Sofacy (APT28) used this technique to load their Trojan in a campaign of 2018.
- Effort: intermediate
Suspicious Netsh DLL Persistence
Detects persitence via netsh helper. Netsh interacts with other operating system components using dynamic-link library (DLL) files. Adversaries may establish persistence by executing malicious content triggered by Netsh Helper DLLs.
- Effort: elementary
Suspicious Network Args In Command Line
Detection on suspicious network arguments in processes command lines using HTTP schema with port 443.
- Effort: intermediate
Suspicious PowerShell Invocations - Specific
Detects suspicious PowerShell invocation command parameters
- Effort: intermediate
Suspicious PrinterPorts Creation (CVE-2020-1048)
Detects new commands that add new printer port which point to suspicious file
- Effort: advanced
Suspicious Taskkill Command
Detects rare taskkill command being used. It could be related to Baby Shark malware.
- Effort: intermediate
Suspicious Windows Defender Exclusion Command
Detects PowerShell commands aiming to exclude path, process, IP address, or extension from scheduled and real-time scanning. These commands can be used by attackers or malware to avoid being detected by Windows Defender. Depending on the environment and the installed software, this detection rule could raise false positives. We recommend customizing this rule by filtering legitimate processes that use Windows Defender exclusion command in your environment.
- Effort: master
Suspicious Windows Installer Execution
Detects suspicious execution of the Windows Installer service (msiexec.exe) which could be used to install a malicious MSI package hosted on a remote server.
- Effort: intermediate
Usage Of Procdump With Common Arguments
Detects the usage of Procdump sysinternals tool with some common arguments and followed by common patterns.
- Effort: intermediate
WMI Install Of Binary
Detection of WMI used to install a binary on the host. It is often used by attackers as a signed binary to infect an host.
- Effort: elementary
WMIC Uninstall Product
Detects products being uninstalled using WMIC command.
- Effort: intermediate
WiFi Credentials Harvesting Using Netsh
Detects the harvesting of WiFi credentials using netsh.exe, used in particular by Agent Tesla (RAT) and Turla Mosquito (RAT)
- Effort: elementary
Windows Defender Disabled
The rule detects attempts to deactivate/disable Windows Defender through command line or registry. To fully use this rule Windows Registry logging is needed. This can be done for instance using Sysmon with Event IDs 12,13 and 14 (and adding the correct path in its configuration).
- Effort: intermediate
Windows Defender Disabled Base64 Encoded
Detects attempts to deactivate/disable Windows Defender through base64 encoded PowerShell command line.
- Effort: elementary
Windows Defender History Directory Deleted
Windows Defender history directory has been deleted. Could be an attempt by an attacker to remove its traces.
- Effort: elementary
Windows Defender Set-MpPreference Base64 Encoded
Detects changes of preferences for Windows Defender scan and updates. Configure Windows Defender using base64-encoded commands is suspicious and could be related to malicious activities.
- Effort: intermediate
Windows Defender Signatures Removed With MpCmdRun
Detects attempts to remove Windows Defender Signatures using MpCmdRun legitimate Windows Defender executable. No signatures mean Windows Defender will be less effective (or completely useless depending on the option used).
- Effort: elementary
Windows Firewall Changes
Detects changes on Windows Firewall configuration
- Effort: master
Wmic Service Call
Detects either remote or local code execution using wmic tool.
- Effort: intermediate
XCopy Suspicious Usage
Detects the usage of xcopy with suspicious command line options (used by Judgment Panda APT in the past). The rule is based on command line only in case xcopy is renamed.
- Effort: advanced
Event Categories
The following table lists the data source offered by this integration.
Data Source | Description |
---|---|
Authentication logs |
PAM authentication mechanism |
Process command-line parameters |
Common Linux processes (cron, ssh, sudo) |
Process use of network |
SSH and PAM daemon |
Event Samples
Find below few samples of events and how they are normalized by SEKOIA.IO.
{
"message": "{ \"time\" : \"2019-07-02T13:45:50.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"sudo\",\"Ignore\" : \"syslog\",\"Facility\" : \"authpriv\",\"Severity\" : \"err\",\"EventTime\" : \"2019-07-02T13:45:50+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"pam_unix(sudo:auth): conversation failed\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-07-02T13:45:50Z\"},\"category\" : \"authpriv\",\"level\" : \"err\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "error",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-07-02T13:45:50.0000000Z",
"azure_linux": {
"message": "pam_unix(sudo:auth): conversation failed"
},
"os": {
"family": "linux",
"platform": "linux"
},
"action": {
"name": "sudo:auth",
"type": "open",
"outcome": "failure"
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-07-02T13:46:32.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"sudo\",\"Ignore\" : \"syslog\",\"Facility\" : \"authpriv\",\"Severity\" : \"crit\",\"EventTime\" : \"2019-07-02T13:46:32+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"pam_unix(sudo:auth): auth could not identify password for [omsagent]\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-07-02T13:46:32Z\"},\"category\" : \"authpriv\",\"level\" : \"crit\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "critical",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-07-02T13:46:32.0000000Z",
"azure_linux": {
"message": "pam_unix(sudo:auth): auth could not identify password for [omsagent]"
},
"os": {
"family": "linux",
"platform": "linux"
},
"action": {
"name": "sudo:auth",
"type": "open",
"outcome": "failure"
},
"user": {
"name": "omsagent"
},
"related": {
"user": [
"omsagent"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-06-27T14:50:01.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"CROND\",\"pid\" : \"21188\",\"Ignore\" : \"syslog\",\"Facility\" : \"cron\",\"Severity\" : \"info\",\"EventTime\" : \"2019-06-27T14:50:01+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"(root) CMD (/usr/lib64/sa/sa1 1 1)\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-06-27T14:50:01Z\"},\"category\" : \"cron\",\"level\" : \"info\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "info",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-06-27T14:50:01.0000000Z",
"azure_linux": {
"message": "(root) CMD (/usr/lib64/sa/sa1 1 1)"
},
"process": {
"parent": {
"pid": 21188
},
"command_line": "/usr/lib64/sa/sa1 1 1",
"executable": "/usr/lib64/sa/sa1"
},
"os": {
"family": "linux",
"platform": "linux"
},
"user": {
"name": "root"
},
"related": {
"user": [
"root"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-06-27T14:29:01.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"CROND\",\"pid\" : \"16373\",\"Ignore\" : \"syslog\",\"Facility\" : \"cron\",\"Severity\" : \"info\",\"EventTime\" : \"2019-06-27T14:29:01+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"(root) CMD ([ -f /etc/krb5.keytab ] && [ \\\\( ! -f /etc/opt/omi/creds/omi.keytab \\\\) -o \\\\( /etc/krb5.keytab -nt /etc/opt/omi/creds/omi.keytab \\\\) ] && /opt/omi/bin/support/ktstrip /etc/krb5.keytab /etc/opt/omi/creds/omi.keytab >/dev/null 2>&1 || true)\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-06-27T14:29:01Z\"},\"category\" : \"cron\",\"level\" : \"info\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "info",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-06-27T14:29:01.0000000Z",
"azure_linux": {
"message": "(root) CMD ([ -f /etc/krb5.keytab ] && [ \\( ! -f /etc/opt/omi/creds/omi.keytab \\) -o \\( /etc/krb5.keytab -nt /etc/opt/omi/creds/omi.keytab \\) ] && /opt/omi/bin/support/ktstrip /etc/krb5.keytab /etc/opt/omi/creds/omi.keytab >/dev/null 2>&1 || true)"
},
"process": {
"parent": {
"pid": 16373
},
"command_line": "[ -f /etc/krb5.keytab ] && [ \\( ! -f /etc/opt/omi/creds/omi.keytab \\) -o \\( /etc/krb5.keytab -nt /etc/opt/omi/creds/omi.keytab \\) ] && /opt/omi/bin/support/ktstrip /etc/krb5.keytab /etc/opt/omi/creds/omi.keytab >/dev/null 2>&1 || true"
},
"os": {
"family": "linux",
"platform": "linux"
},
"user": {
"name": "root"
},
"related": {
"user": [
"root"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-06-27T14:50:51.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"sshd\",\"pid\" : \"14020\",\"Ignore\" : \"syslog\",\"Facility\" : \"authpriv\",\"Severity\" : \"info\",\"EventTime\" : \"2019-06-27T14:50:51+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"Received disconnect from 185.122.161.248 port 39070:11: disconnected by user\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-06-27T14:50:51Z\"},\"category\" : \"authpriv\",\"level\" : \"info\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "info",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-06-27T14:50:51.0000000Z",
"azure_linux": {
"message": "Received disconnect from 185.122.161.248 port 39070:11: disconnected by user"
},
"process": {
"pid": 14020
},
"os": {
"family": "linux",
"platform": "linux"
},
"source": {
"ip": "185.122.161.248",
"port": 39070,
"address": "185.122.161.248"
},
"related": {
"ip": [
"185.122.161.248"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-06-27T14:48:18.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"sudo\",\"Ignore\" : \"syslog\",\"Facility\" : \"authpriv\",\"Severity\" : \"notice\",\"EventTime\" : \"2019-06-27T14:48:18+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"omsagent : TTY=unknown ; PWD=/opt/microsoft/omsconfig/Scripts/2.6x-2.7x ; USER=root ; COMMAND=/opt/microsoft/omsconfig/Scripts/OMSYumUpdates.sh\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-06-27T14:48:18Z\"},\"category\" : \"authpriv\",\"level\" : \"notice\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "info",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-06-27T14:48:18.0000000Z",
"azure_linux": {
"message": "omsagent : TTY=unknown ; PWD=/opt/microsoft/omsconfig/Scripts/2.6x-2.7x ; USER=root ; COMMAND=/opt/microsoft/omsconfig/Scripts/OMSYumUpdates.sh"
},
"os": {
"family": "linux",
"platform": "linux"
},
"user": {
"name": "root"
},
"process": {
"command_line": "/opt/microsoft/omsconfig/Scripts/OMSYumUpdates.sh",
"executable": "/opt/microsoft/omsconfig/Scripts/OMSYumUpdates.sh",
"working_directory": "/opt/microsoft/omsconfig/Scripts/2.6x-2.7x"
},
"action": {
"outcome": "success"
},
"related": {
"user": [
"root"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-07-02T13:46:15.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"sudo\",\"Ignore\" : \"syslog\",\"Facility\" : \"authpriv\",\"Severity\" : \"notice\",\"EventTime\" : \"2019-07-02T13:46:15+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"omsagent : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/test -r /var/lib/docker/containers/bf64bddcdb7d18a3090980d2539e2c15c924138f489c280871941064850f7d16/bf64bddcdb7d18a3090980d2539e2c15c924138f489c280871941064850f7d16-json.log\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-07-02T13:46:15Z\"},\"category\" : \"authpriv\",\"level\" : \"notice\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "info",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-07-02T13:46:15.0000000Z",
"azure_linux": {
"message": "omsagent : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/test -r /var/lib/docker/containers/bf64bddcdb7d18a3090980d2539e2c15c924138f489c280871941064850f7d16/bf64bddcdb7d18a3090980d2539e2c15c924138f489c280871941064850f7d16-json.log"
},
"os": {
"family": "linux",
"platform": "linux"
},
"user": {
"name": "root"
},
"process": {
"command_line": "/bin/test -r /var/lib/docker/containers/bf64bddcdb7d18a3090980d2539e2c15c924138f489c280871941064850f7d16/bf64bddcdb7d18a3090980d2539e2c15c924138f489c280871941064850f7d16-json.log",
"executable": "/bin/test",
"working_directory": "/"
},
"action": {
"outcome": "success"
},
"related": {
"user": [
"root"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-06-27T14:48:28.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"sudo\",\"Ignore\" : \"syslog\",\"Facility\" : \"authpriv\",\"Severity\" : \"info\",\"EventTime\" : \"2019-06-27T14:48:28+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"pam_unix(sudo:session): session closed for user root\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-06-27T14:48:28Z\"},\"category\" : \"authpriv\",\"level\" : \"info\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "info",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-06-27T14:48:28.0000000Z",
"azure_linux": {
"message": "pam_unix(sudo:session): session closed for user root"
},
"os": {
"family": "linux",
"platform": "linux"
},
"action": {
"name": "sudo:session",
"type": "close",
"outcome": "success"
},
"user": {
"name": "root"
},
"related": {
"user": [
"root"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-06-27T14:48:28.0000000Z\",\"resourceId\" : \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"sudo\",\"Ignore\" : \"syslog\",\"Facility\" : \"authpriv\",\"Severity\" : \"info\",\"EventTime\" : \"2019-06-27T14:48:28+0000\",\"SendingHost\" : \"localhost\",\"Msg\" : \"pam_unix(sudo:session): session opened for user root by (uid=0)\",\"hostname\" : \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-06-27T14:48:28Z\"},\"category\" : \"authpriv\",\"level\" : \"info\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "info",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-06-27T14:48:28.0000000Z",
"azure_linux": {
"message": "pam_unix(sudo:session): session opened for user root by (uid=0)"
},
"os": {
"family": "linux",
"platform": "linux"
},
"action": {
"name": "sudo:session",
"type": "open",
"outcome": "success"
},
"user": {
"name": "root"
},
"related": {
"user": [
"root"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
{
"message": "{ \"time\" : \"2019-07-02T14:15:01.0000000Z\",\"resourceId\": \"/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/demo.sekoia.io/providers/Microsoft.Compute/virtualMachines/LinuxRedhatDesktop\",\"properties\" : {\"ident\" : \"systemd\",\"Ignore\" : \"syslog\",\"Facility\" : \"daemon\",\"Severity\" : \"info\",\"EventTime\" : \"2019-07-02T14:15:01+0000\",\"SendingHost\": \"localhost\",\"Msg\" : \"Started Session 13124 of user omsagent.\",\"hostname\": \"LinuxRedhatDesktop\",\"FluentdIngestTimestamp\" : \"2019-07-02T14:15:01Z\"},\"category\" : \"daemon\",\"level\" : \"info\",\"operationName\" : \"LinuxSyslogEvent\"}",
"log": {
"level": "info",
"hostname": "LinuxRedhatDesktop"
},
"@timestamp": "2019-07-02T14:15:01.0000000Z",
"azure_linux": {
"message": "Started Session 13124 of user omsagent."
},
"os": {
"family": "linux",
"platform": "linux"
},
"user": {
"name": "omsagent"
},
"action": {
"type": "open",
"name": "systemd:session",
"outcome": "success"
},
"related": {
"user": [
"omsagent"
]
},
"host": {
"name": "LinuxRedhatDesktop"
}
}
Extracted Fields
The following table lists the fields that are extracted, normalized under the ECS format, analyzed and indexed by the parser. It should be noted that infered fields are not listed.
Name | Type | Description |
---|---|---|
@timestamp |
date |
Date/time when the event originated. |
azure_linux.message |
keyword |
The linux message |
log.level |
keyword |
Log level of the log event. |
process.command_line |
wildcard |
Full command line that started the process. |
process.executable |
keyword |
Absolute path to the process executable. |
process.parent.pid |
long |
Process id. |
process.pid |
long |
Process id. |
process.working_directory |
keyword |
The working directory of the process. |
source.domain |
keyword |
The domain name of the source. |
source.ip |
ip |
IP address of the source. |
source.port |
long |
Port of the source. |
user.name |
keyword |
Short name or login of the user. |
Configure
This setup guide will show you how to forward events produced by a Linux Virtual Machine hosted on Azure platform to SEKOIA.IO.
Theses changes have to be made from the Azure Web Portal.
Azure Event Hubs
As a prerequisite, you need to choose an existing “resource group”, or create a new one (e.g. company-resource-group
).
Retrieve your Subscription ID
You also need your “Subscription ID” if you don't have a default one. In Azure Web Portal, navigate to: “Home”, “Cost Management + Billing”, ”Subscriptions”. From there, copy the relevant “Subscription ID” that will be used in the command line (e.g. uuid
)
Create the Event Hubs
Use Azure PowerShell (within Cloud Shell interface for example) to create a namespace (e.g. company-eventhub
) and a specific Event Hub
(e.g. linux-event
) within your “resource group” (e.g. company-resource-group
)
PS Azure:\> az eventhubs namespace create --name company-eventhub --resource-group company-resource-group --enable-kafka true --subscription uuid
PS Azure:\> az eventhubs eventhub create --resource-group company-resource-group --namespace-name company-eventhub --name linux-event --message-retention 3 --partition-count 4 --subscription uuid
Info
Please replace :
company-resource-group
with the name of your “resource group”.uuid
with your subscription ID retrieved previously (see below).
Create “Shared Access Policies”
- Navigate to “Home”, “Event Hubs”, “company-eventhub - Shared access policies”. From there, you can create a policy (e.g.
RootManageSharedAccessKey
) with the claimsManage
,Send
andListen
, and note thePrimary Key
that will be used as theSharedAccessKey
. - Navigate to “Home”, “Event Hubs”, “company-eventhub”, “linux-event - Shared access policies”. From there, you can create a policy (e.g.
sekoiaio
) with the claimsListen
. Once created, click on the policy and save theConnection string-primary key
, to be sent to SEKOIA.IO. - Navigate to “Home”, “Event Hubs”, “company-eventhub”, ”linux-event - Consumer groups”. From there, you can create a consumer group (e.g.
sekoiaio
).
Create a Blob Storage for Checkpointing
In order to allow SEKOIA.IO keep track of the consumed events, the next step consists in creating a dedicated Azure Blob Storage.
To proceed, you can use Azure PowerShell:
PS Azure:\> az storage account create --name "sekoiaiocheckpoint" --resource-group "company-resource-group"
PS Azure:\> az storage container create --name "linux-event" --account-name "sekoiaiocheckpoint"
Info
The container name, here linux-event
should be the same as the Event Hub’s one.
You also need to replace company-resource-group
with the name of your “resource group”.
Finally, you have to retrieve the connection string from Azure Web Portal by going in “Storage Accounts”, then in the created storage (sekoiaiocheckpoint
) and finally in the “Access Keys” section. After clicking on “Show keys”, you can copy the first of the two connection strings.
Linux Virtual Machine
You need to activate and configure the diagnostic extension LinuxDiagnostic
.
- Navigate to “Home”, “Virtual machines”, “virtual machine name (e.g. company-linux)”, “Settings” and “Extensions”. Install it and note the new
StorageAccount
name created (e.g.company-storage-account
). - Navigate to “Home”, “Storage accounts”, “company-storage-account”, “Access keys”. From there you can note the key value later used as the
storageAccountKey
. - Navigate to “Home”, “Storage accounts”, “company-storage-account”, “Shared access signature”. From there set the expiration date with caution, then click on “Generate SAS and connection string”. You should note the
SAS token
value later used (starting withsv?=
).
Navigate to “Home”, “All resources”. From there you can note the resourceId
associated to your linux virtual machine.
You need to create two configuration files public_settings.json
and protected_settings.json
.
Once again you need Azure PowerShell to do it using your favorite text editor:
PS Azure:\> vim public_settings.json
Adapt the public settings configuration file with the value of theses variables: StorageAccount
, resourceId
and sinks
and the syslog configuration.
{
"StorageAccount": "company-storage-account",
"ladCfg": {
"diagnosticMonitorConfiguration": {
"eventVolume": "Medium",
"metrics": {
"metricAggregation": [
{
"scheduledTransferPeriod": "PT1H"
},
{
"scheduledTransferPeriod": "PT1M"
}
],
"resourceId": "/subscriptions/128ed5ce-4f50-4b5f-a3b0-08233b5a86b6/resourceGroups/company-resource-group/providers/Microsoft.Compute/virtualMachines/company-linux"
},
"performanceCounters": {
"performanceCounterConfiguration": []
},
"syslogEvents": {
"sinks": "linux-event",
"syslogEventConfiguration": {
"LOG_AUTH": "LOG_INFO",
"LOG_AUTHPRIV": "LOG_INFO",
"LOG_CRON": "LOG_INFO",
"LOG_DAEMON": "LOG_INFO",
"LOG_FTP": "LOG_INFO",
"LOG_KERN": "LOG_INFO",
"LOG_LOCAL0": "LOG_INFO",
"LOG_LOCAL1": "LOG_INFO",
"LOG_LOCAL2": "LOG_INFO",
"LOG_LOCAL3": "LOG_INFO",
"LOG_LOCAL4": "LOG_INFO",
"LOG_LOCAL5": "LOG_INFO",
"LOG_LOCAL6": "LOG_INFO",
"LOG_LOCAL7": "LOG_INFO",
"LOG_LPR": "LOG_INFO",
"LOG_MAIL": "LOG_INFO",
"LOG_NEWS": "LOG_INFO",
"LOG_SYSLOG": "LOG_INFO",
"LOG_USER": "LOG_INFO",
"LOG_UUCP": "LOG_INFO"
}
}
},
"sampleRateInSeconds": 15
}
}
You need to generate an authentication token for the access to the linux-event
hub.
First we'll convert the expiration date we set before into a unix timestamp. Extract the se=
value from storageAccountSasTokenv
and use it as a parameter to this command:
PS Azure:\> date -d '2021-07-09T23:09:19' +%s
1625872159
Then you could create this python script:
PS Azure:\> vim get_token.py
Adapt theses variables: sb_name
, eh_name
, Url
, sas_name
, sas_value
, and expiry
:
from urllib.parse import quote_plus, quote
import hmac
import hashlib
import base64
def get_auth_token(sb_name, eh_name, sas_name, sas_value, expiry):
"""
Returns an authorization token dictionary
for making calls to Event Hubs REST API.
"""
uri = quote_plus("https://{}.servicebus.windows.net/{}" \
.format(sb_name, eh_name))
sas = sas_value.encode('utf-8')
string_to_sign = (uri + '\n' + expiry).encode('utf-8')
signed_hmac_sha256 = hmac.HMAC(sas, string_to_sign, hashlib.sha256)
signature = quote(base64.b64encode(signed_hmac_sha256.digest()))
return {"sb_name": sb_name,
"eh_name": eh_name,
"token":'SharedAccessSignature sr={}&sig={}&se={}&skn={}' \
.format(uri, signature, expiry, sas_name)
}
print(get_auth_token(sb_name="company-eventhub", eh_name="linux-event", sas_name="RootManageSharedAccessKey", sas_value="base64string", expiry="unix_timestamp"))
Execute this python script and note the token
variable value only from the sr=
.
PS Azure:\> python get_token.py
{'token': 'SharedAccessSignature sr=https%3A%2F%2Fcompany-eventhub.servicebus.windows.net%2Flinux-event&sig=9%2BOwFlfqBVEcVg2c5G1wztIjG22GtsMZN5g4NYEu6p0%3D&se=1561569146&skn=RootManageSharedAccessKey', 'eh_name': 'linux-event', 'sb_name': 'company-eventhub'}
Then edit the protected settings configuration file:
PS Azure:\> vim protected_settings.json
Adapt the public protected settings configuration file with the value of theses variables: storageAccountName
, storageAccountSasToken
(starting with sv= and previously refered as SAS token
), sasURL
(replace the different values, company-eventhub, linux-event, sr=, and RootManageSharedAccessKey), and SharedAccessKeyName
:
{
"storageAccountName": "company-storage-account",
"storageAccountSasToken": "sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-06-21T15:52:44Z&st=2019-06-21T07:52:44Z&spr=https&sig=Dewc7mP63E4xrwqttVcOrChgDIpm6Trp%2FR4dfvSo4vg%3D",
"sinksConfig": {
"sink": [
{
"name": "SyslogJsonBlob",
"type": "JsonBlob"
},
{
"name": "linux-event",
"type": "EventHub",
"sasURL": "https://company-eventhub.servicebus.windows.net/linux-event?sr=https%3A%2F%2Fcompany-eventhub.servicebus.windows.net%2Flinux-event&sig=W86ldfWlPKW0sutGWM7shYGlg%2BbwnbtyVJ7eMsBs840%3D&se=1561137701&skn=RootManageSharedAccessKey"
}
]
}
}
Finally you could push the change of the diagnostic extension configuration (adapt the parameters resource-group, vm-name):
PS Azure:\> az vm extension set --publisher Microsoft.Azure.Diagnostics --name LinuxDiagnostic --version 3.0 --resource-group company-resource-group --vm-name company-linux --protected-settings protected_settings.json --settings public_settings.json --subscription uuid
Forward the Connection Keys to SEKOIA.IO
Finally, please send to SEKOIA.IO the following information:
- Azure Event Hub’s “Connection string-primary key” (e.g.
"Endpoint=sb://company-eventhub.servicebus.windows.net/;SharedAccessKeyName=sekoiaio;SharedAccessKey=XXXXXX;EntityPath=linux-event"
). - Azure Event Hub’s consumer group name (e.g.
sekoiaio
). - Azure Blob Storage’s connection string (e.g.
"DefaultEndpointsProtocol=https;AccountName=sekoiaiocheckpoint;AccountKey=XXXXX"
).