<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[SomoIT.net]]></title><description><![CDATA[IT Systems and Security - Learn and Share]]></description><link>https://somoit.net/</link><image><url>https://somoit.net/favicon.png</url><title>SomoIT.net</title><link>https://somoit.net/</link></image><generator>Ghost 5.88</generator><lastBuildDate>Mon, 06 Apr 2026 00:08:14 GMT</lastBuildDate><atom:link href="https://somoit.net/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[How to Enable SSH Access to WSL2]]></title><description><![CDATA[Learn how to enable persistent SSH access to WSL2 system]]></description><link>https://somoit.net/windows/enable-ssh-into-wsl/</link><guid isPermaLink="false">6773ac32282ec80001000738</guid><category><![CDATA[windows]]></category><category><![CDATA[sysadmin]]></category><category><![CDATA[linux]]></category><category><![CDATA[powershell]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Tue, 31 Dec 2024 08:48:22 GMT</pubDate><content:encoded><![CDATA[<h3 id></h3><p>Accessing your WSL2 instance remotely via SSH can be incredibly useful. <br>Here&#x2019;s a quick guide to set it up:</p><hr><h4 id="1-install-openssh-server">1. Install OpenSSH Server</h4><p>Run the following commands in your WSL2 instance (valid for Debian-like distros):</p><pre><code>sudo apt update
sudo apt install openssh-server
sudo nano /etc/ssh/sshd_config</code></pre><p>Edit your <code>sshd_config</code> file as needed (e.g., ensure <code>PermitRootLogin</code> is set to <code>no</code>, etc...)</p><hr><h4 id="2-allow-ssh-through-windows-firewall">2. Allow SSH Through Windows Firewall</h4><p><br>Run the following command:</p><pre><code>netsh advfirewall firewall add rule name=&quot;WSL SSH Access&quot; dir=in action=allow protocol=TCP localport=22
</code></pre><p>Or via the GUI, open <strong>Windows Defender Firewall</strong> settings.<br>Navigate to <strong>Advanced Settings &gt; Inbound Rules</strong>.<br>Add a new rule:</p><ol><ul><li><strong>Type:</strong> Port</li><li><strong>Port:</strong> 22 (or your custom SSH port)</li><li><strong>Action:</strong> Allow the connection</li><li><strong>Profile:</strong> All</li><li><strong>Name:</strong> WSL SSH Access</li></ul></ol><hr><h4 id="3-forward-ports-from-windows-to-wsl">3. Forward Ports From Windows to WSL</h4><p>Run the following PowerShell commands:</p><pre><code>$wslIP = wsl hostname -I | ForEach-Object { $_.Trim() }
netsh interface portproxy add v4tov4 listenaddress=* listenport=22 connectaddress=$wslIP connectport=22</code></pre><p>This ensures SSH connections to your Windows IP are forwarded to WSL.</p><hr><h4 id="4-start-the-ssh-service">4. Start the SSH Service</h4><p>Given that standard methods like enabling it via systemctl do not work, we have to start the SSH server manually.</p><p>From the Linux WSL:</p><pre><code>sudo /usr/sbin/service ssh start</code></pre><hr><p>Now, you can SSH into your WSL2 instance using your Windows IP address!</p><pre><code>ssh user@&lt;windows_ip&gt;</code></pre><p></p><h4 id="make-the-solution-persistent-across-restarts">Make the Solution Persistent Across Restarts</h4><p></p><p>But the access will not work after a restart of the windows machine given that the WSL IP address would change.<br>To make SSH access persist after a system reboot, create a PowerShell script and configure it to run at boot:</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">The script will both:<br>- Create the updated forwarding rule with the current WSL IP address<br>- Start the SSH service</div></div><p></p><ol><li>Open <strong>Task Scheduler</strong> and create a new task:<ul><li><strong>General Tab:</strong><ul><li>Name: <code>WSL SSH Setup</code></li><li>Check <strong>Run with highest privileges</strong>.</li><li>Select <strong>Run whether user is logged on or not</strong>.</li></ul></li><li><strong>Triggers Tab:</strong><ul><li>Add a trigger with <strong>Begin the task</strong> set to <strong>At startup</strong>.</li></ul></li><li><strong>Actions Tab:</strong><ul><li>Add an action with:<ul><li><strong>Program/script:</strong> <code>powershell.exe</code></li><li><strong>Arguments:</strong> <code>-ExecutionPolicy Bypass -File &quot;C:\Scripts\wsl-ssh.ps1&quot;</code></li></ul></li></ul></li><li>Save the task and provide your Windows credentials if prompted.</li></ul></li></ol><p>Save the following script as <code>C:\Scripts\wsl-ssh-setup.ps1</code>:</p><pre><code>$wslIP = wsl hostname -I | ForEach-Object { $_.Trim() }
netsh interface portproxy delete v4tov4 listenaddress=* listenport=22
netsh interface portproxy add v4tov4 listenaddress=* listenport=22 connectaddress=$wslIP connectport=22
wsl -d Debian -- sudo /usr/sbin/service ssh start</code></pre>]]></content:encoded></item><item><title><![CDATA[BookStack to Outline Migration Tool]]></title><description><![CDATA[Migrate your content from BookStack to Outline with these tools, preserving hierarchy and automating image downloads]]></description><link>https://somoit.net/sysadmin/bookstack-to-outline-migration/</link><guid isPermaLink="false">66bc6e9fb71c680001b831f9</guid><category><![CDATA[sysadmin]]></category><category><![CDATA[tools]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Wed, 14 Aug 2024 09:58:04 GMT</pubDate><content:encoded><![CDATA[<h2 id="overview">Overview</h2><p>This toolset facilitates the migration of content from <a href="https://www.bookstackapp.com/" rel="noreferrer">BookStack</a> to <a href="https://github.com/outline/outline" rel="noreferrer">Outline</a>, a modern knowledge base. The tool includes two Python scripts:</p><ol><li><code>export_from_bookstack.py</code>: Exports content from BookStack into a JSON file.</li><li><code>import_to_outline.py</code>: Imports the exported JSON file into Outline</li></ol><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/08/Bookstack-Outline-Migration.png" class="kg-image" alt loading="lazy" width="436" height="332"></figure><p></p><h2 id="features">Features</h2><ul><li>Converts BookStack shelves to Outline collections.</li><li>Converts BookStack books, chapters, and pages to Outline documents.</li><li>Maintains document hierarchy during the migration.</li><li>Automatically downloads and saves images into the Outline storage during the import process.</li><li>Orphaned books (books not placed in a shelf) are imported under &quot;Orphaned books&quot; collection</li></ul><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/08/image-5.png" class="kg-image" alt loading="lazy" width="1137" height="487" srcset="https://somoit.net/content/images/size/w600/2024/08/image-5.png 600w, https://somoit.net/content/images/size/w1000/2024/08/image-5.png 1000w, https://somoit.net/content/images/2024/08/image-5.png 1137w" sizes="(min-width: 720px) 720px"></figure><h2 id="installation">Installation</h2><ol><li>Clone the repository: <br><code>git clone https://github.com/somoit-net/bookstack_outline_migrator.git </code> </li><li><code>cd bookstack_outline_migrator</code> </li><li>Install the necessary Python packages<br><code>pip3 install -r requirements</code></li></ol><h2 id="configuration">Configuration</h2><p>A sample <code>config.txt</code> file is included in the repository. You need to update this file with your specific BookStack and Outline credentials and URLs.</p><pre><code># Bookstack and Outline config

# Bookstack
BOOKSTACK_BASE_URL=https://bookstack.mydomain.com
BOOKSTACK_API_TOKEN_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BOOKSTACK_API_TOKEN_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
BOOKSTACK_EXPORT_FILENAME=bookstack_export.json

# Outline
OUTLINE_BASE_URL=https://outline.mydomain.com
OUTLINE_API_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code></pre><ul><li><strong>BOOKSTACK_BASE_URL</strong>: URL of your BookStack instance.</li><li><strong>BOOKSTACK_API_TOKEN_ID</strong>: Your BookStack API token ID.</li><li><strong>BOOKSTACK_API_TOKEN_SECRET</strong>: Your BookStack API token secret.</li><li><strong>BOOKSTACK_EXPORT_FILENAME</strong>: Name of the file where the exported data will be saved (default is <code>bookstack_export.json</code>).</li><li><strong>OUTLINE_BASE_URL</strong>: URL of your Outline instance.</li><li><strong>OUTLINE_API_TOKEN</strong>: Your Outline API token.</li></ul><h2 id="usage">Usage</h2><h3 id="1-export-from-bookstack">1. Export from BookStack</h3><p>To export content from BookStack, run the following command:</p><pre><code>python3 export_from_bookstack.py</code></pre><p>This will generate a JSON file named as specified in <code>BOOKSTACK_EXPORT_FILENAME</code>.</p><p><strong>Note:</strong> Ensure that the BookStack site is accessible and the <code>config.txt</code> file is correctly configured.</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/08/image-2.png" class="kg-image" alt loading="lazy" width="600" height="359" srcset="https://somoit.net/content/images/2024/08/image-2.png 600w"></figure><h3 id="2-import-to-outline">2. Import to Outline</h3><p>To import the exported content into Outline, use the following command:</p><pre><code>python3 import_to_outline.py</code></pre><p>The output is similar to the import process</p><p><strong>Note:</strong> The Bookstack site must still be accessible so the script can automatically download the images.</p>]]></content:encoded></item><item><title><![CDATA[Checkpoint - Script to monitor VPN tunnel state with Icinga]]></title><description><![CDATA[Monitor VPN tunnel states in Check Point VSX using a Bash script with SNMP. Integrate with Icinga for continuous oversight.]]></description><link>https://somoit.net/checkpoint/checkpoint-script-to-monitor-vpn-tunnel-states-with-icinga/</link><guid isPermaLink="false">665987133575210001ec20eb</guid><category><![CDATA[checkpoint]]></category><category><![CDATA[icinga]]></category><category><![CDATA[firewall]]></category><category><![CDATA[monitor]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Mon, 03 Jun 2024 11:39:52 GMT</pubDate><content:encoded><![CDATA[<p>In this post we&apos;ll walk through a practical solution&#x2014;a Bash script that uses SNMP to monitor the state of VPN tunnels in a Check Point VSX environment, specifically designed to integrate with Icinga.</p>
<p>Our Bash script leverages SNMP to check the status of VPN tunnels. Although this example focuses on a VSX environment, the script can be adapted for a standard Check Point deployment with minimal changes.</p>
<p>Below is the complete script:</p>
<pre><code class="language-bash">#!/bin/bash

HOST=$1
VS=$2
PEER_GW=$3
SNMP_USER=$4
SNMP_PASS=$5

SNMP=$(snmpwalk -v 3 -l authNoPriv -u $SNMP_USER -A $SNMP_PASS -n ctxname_vsid$VS $HOST .iso.org.dod.internet.private.enterprises.checkpoint.tables.tunnelTable.tunnelEntry.tunnelState.$PEER_GW.0 2&gt; /dev/null)

if [ -z &quot;$SNMP&quot; ]; then
    echo &quot;UNKNOWN: No SNMP response from $HOST&quot;
    exit 3
fi

RESULT=$(echo $SNMP | awk &apos;{ print $9 }&apos; 2&gt; /dev/null)

case $RESULT in
    3)
        echo &quot;OK - VPN tunnel is active (state $RESULT)&quot;
        exit 0
        ;;
    4)
        echo &quot;Critical - VPN tunnel is destroyed (state $RESULT)&quot;
        exit 2
        ;;
    129)
        echo &quot;Warning - VPN tunnel is idle (state $RESULT)&quot;
        exit 1
        ;;
    130)
        echo &quot;Critical - VPN tunnel is during Phase1 (state $RESULT)&quot;
        exit 2
        ;;
    131)
        echo &quot;Critical - VPN tunnel is down (state $RESULT)&quot;
        exit 2
        ;;
    132)
        echo &quot;Critical - VPN tunnel is initializing (state $RESULT)&quot;
        exit 2
        ;;
    *)
        echo &quot;Unknown - VPN tunnel state unknown&quot;
        exit 3
        ;;
esac</code></pre>
<h3 id></h3>
<ul><li><strong>Input Parameters</strong>: The script takes five input parameters: the host (IP address or hostname of the Check Point device), the VSID (Virtual System ID), and the peer gateway ID, and the SNMP credentials (USER + PASS)</li><li><strong>SNMP Query</strong>: Using <code>snmpwalk</code>, the script queries the Check Point device for the VPN tunnel state. The SNMPv3 protocol ensures secure querying.</li><li><strong>State Evaluation</strong>: The script evaluates the returned state and provides corresponding output messages:<ul><li><code>3</code>: VPN tunnel is active.</li><li><code>4</code>: VPN tunnel is destroyed.</li><li><code>129</code>: VPN tunnel is idle.</li><li><code>130</code>: VPN tunnel is in Phase 1.</li><li><code>131</code>: VPN tunnel is down.</li><li><code>132</code>: VPN tunnel is initializing.</li></ul></li><li><strong>Exit Codes</strong>: The script uses standard Icinga plugin exit codes (<code>0</code> for OK, <code>1</code> for Warning, <code>2</code> for Critical, and <code>3</code> for Unknown).</li></ul>
<p></p>
<h3 id="prerequisites">Prerequisites</h3>
<p>Before using this script, ensure SNMP is enabled and properly configured on your Check Point gateway. In this example, SNMP v3 with user/password authentication is configured and used to authenticate and query the SNMP.</p>
<p></p>
<h3 id="test-it">Test it</h3>
<p>After granting proper execution permissions, an example test:</p>
<pre><code>$ ./check_fw_tunnelstate.sh myvsx 2 195.95.95.95 snmp_user snmp_password
OK - VPN tunnel is active (state 3)</code></pre>
<p>Finally, some additional steps are needed to configure it in Icinga, like the command definition, the service definition and reloading the Icinga services so the tunnel is finally monitored:</p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/05/image.png" class="kg-image" alt loading="lazy" width="372" height="219"></figure>
<p></p>]]></content:encoded></item><item><title><![CDATA[Linux - mssql-cli and sqlcmd error 0x2746]]></title><description><![CDATA[Troubleshoot sqlcmd and mssql-cli client 0x2746 error in Linux by adjusting OpenSSL settings]]></description><link>https://somoit.net/linux/linux-mssql-cli-error/</link><guid isPermaLink="false">664354433575210001ec20be</guid><category><![CDATA[linux]]></category><category><![CDATA[security]]></category><category><![CDATA[python]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Fri, 17 May 2024 06:47:23 GMT</pubDate><content:encoded><![CDATA[<p></p>
<p>When trying to use the SQL server linux command-line clients, mssql-cli in a continuous loop without connecting to the SQL server succesfully without any output and sqlcmd returned this error:</p>
<pre><code>Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Client unable to establish connection.</code></pre>
<p>Network traces showed that the server returned a FYN packet on both cases:</p>
<pre><code>14:09:49.913302 IP 10.98.13.2.55743 &gt; 10.100.10.40.60725: Flags [S], seq 1942944609, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
14:09:49.913731 IP 10.100.10.40.60725 &gt; 10.98.13.2.55743: Flags [S.], seq 3664072506, ack 1942944610, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
14:09:49.914092 IP 10.98.13.2.55743 &gt; 10.100.10.40.60725: Flags [.], ack 1, win 1026, length 0
14:09:49.914501 IP 10.98.13.2.55743 &gt; 10.100.10.40.60725: Flags [P.], seq 1:89, ack 1, win 1026, length 88
14:09:49.914813 IP 10.100.10.40.60725 &gt; 10.98.13.2.55743: Flags [P.], seq 1:49, ack 89, win 513, length 48
14:09:49.926536 IP 10.98.13.2.55743 &gt; 10.100.10.40.60725: Flags [P.], seq 89:397, ack 49, win 1026, length 308
14:09:49.927209 IP 10.100.10.40.60725 &gt; 10.98.13.2.55743: Flags [F.], seq 49, ack 397, win 512, length 0
14:09:49.927379 IP 10.98.13.2.55743 &gt; 10.100.10.40.60725: Flags [.], ack 50, win 1026, length 0
14:09:49.927610 IP 10.98.13.2.55743 &gt; 10.100.10.40.60725: Flags [F.], seq 397, ack 50, win 1026, length 0
14:09:49.927868 IP 10.100.10.40.60725 &gt; 10.98.13.2.55743: Flags [.], ack 398, win 512, length 0</code></pre>
<p>After some research, i found a forum in someone suffered this problem commenting it was related to the configuration of openssl.</p>
<p>This was my configuration:</p>
<pre><code class="language-properties">[default_conf]
ssl_conf = ssl_sect

[ssl_sect]
system_default = system_default_sect

[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=2</code></pre>
<p>After changing the CipherString...</p>
<pre><code class="language-properties">CipherString = DEFAULT@SECLEVEL=0</code></pre>
<p>... both clients started to work.</p>]]></content:encoded></item><item><title><![CDATA[F5 BigIP - Backup into SMB share]]></title><description><![CDATA[Automate F5 UCS backups to SMB share effortlessly with a simple bash script. Simplify network management and ensure configuration safety.]]></description><link>https://somoit.net/f5/backup-and-save-to-smb-share/</link><guid isPermaLink="false">6633a1373575210001ec2088</guid><category><![CDATA[F5]]></category><category><![CDATA[sysadmin]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Thu, 02 May 2024 19:26:44 GMT</pubDate><content:encoded><![CDATA[<p>This time I present a simple yet powerful solution: A bash script that automates the process of backing up F5 configurations to an SMB share. </p>
<p>I was doing it from an external machine via SSH and SCP, but i have decided to run it locally in the F5 system:</p>
<pre><code class="language-bash">#!/bin/bash

DEVICE_NAME=&quot;bigip1&quot;
SHARE=&quot;//my_fileserver/myshare&quot;
SHARE_PATH=&quot;F5_backups&quot;
SHARE_CREDENTIALS_FILE=&quot;/opt/scripts/.smbcredentials.txt&quot;


TODAY=$(date +%Y%m%d)
LOCAL_FILE=&quot;${DEVICE_NAME}_$TODAY&quot;
LOCAL_PATH=&quot;/dev/shm&quot;

tmsh save /sys ucs $LOCAL_PATH/$LOCAL_FILE &gt; /dev/null

cd $LOCAL_PATH
smbclient -A $SHARE_CREDENTIALS_FILE $SHARE -c &quot;cd $SHARE_PATH; put $LOCAL_FILE.ucs&quot; 2&gt; /dev/null
cd -

rm $LOCAL_PATH/$LOCAL_FILE.ucs</code></pre>
<p>It needs and smb credentials file (of a user with permissions in the SMB share) with the format showed below:</p>
<pre><code class="language-properties">username=myuser
password=mypassword
domain=mydomain.com</code></pre>
<p>(the domain in case it is necessary)</p>
<p>Just configure the execution in the cron (for example weekly, or daily) and the backups are ready for any disaster</p>]]></content:encoded></item><item><title><![CDATA[Checkpoint - API service not running, error 503]]></title><description><![CDATA[Fix Check Point Management API error 503: The management API service is not available ]]></description><link>https://somoit.net/checkpoint/api-service-not-running-error-503/</link><guid isPermaLink="false">6603d1bd3842440001399bac</guid><category><![CDATA[checkpoint]]></category><category><![CDATA[firewall]]></category><category><![CDATA[networking]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Wed, 03 Apr 2024 11:33:58 GMT</pubDate><content:encoded><![CDATA[<p>When trying to call the Checkpoint management API i received a generic 503 error like this:</p>
<pre><code>[Expert@mgmt_server:0]# mgmt_cli login user &quot;myuser&quot; password mypassword&quot; -f json
{
   &quot;code&quot; : &quot;generic_error&quot;,
   &quot;message&quot; : &quot;Error 503. The Management API service is not available. Please check that the Management API server is up and running.&quot;
}</code></pre>
<p>The API status only confirmed that the API was not running but no more clues:</p>
<pre><code>[Expert@mgmt_server:0]# api status

API Settings:
---------------------
Accessibility:                      Require all granted
Automatic Start:                    Enabled

Processes:

Name      State     PID       More Information
-------------------------------------------------
API       Stopped
CPM       Started   29253     Check Point Security Management Server is running and ready
FWM       Started   27142
APACHE    Started   8772

Port Details:
-------------------
JETTY Internal Port:
APACHE Gaia Port:         443

Profile:
------------
Machine profile:  24800-35800 with SME
CPM heap size:    2048m
API heap size:



--------------------------------------------
Overall API Status: The API Server Is Not Running!
--------------------------------------------

Notes:
------------
To collect troubleshooting data, please run &apos;api status -s &lt;comment&gt;&apos;
</code></pre>
<p>Checking the &quot;api.elg&quot; log file took me to the correct path:</p>
<pre><code>[Expert@mgmt_server:0]# tail -20 /opt/CPsuite-R80.40/fw1/log/api.elg | grep -i error
2024-03-27 08:58:09,072  WARN org.eclipse.jetty.xml.XmlParser.fatalError:404 [main] - FATAL@null line:-1 col:-1 : org.xml.sax.SAXParseException: Premature end of file.</code></pre>
<p>Seems that $FWDIR/api/conf/jetty.xml file is empty:</p>
<pre><code>[Expert@mgmt_server:0]# cat $FWDIR/api/conf/jetty.xml
[Expert@mgmt_server:0]#</code></pre>
<p>With a bit more research i found this official article:<a href="https://support.checkpoint.com/results/sk/sk144332">https://support.checkpoint.com/results/sk/sk144332</a><br></p>
<p></p>
<p>I had to <strong><em>recover the contents of the file </em></strong>by installing another management server in a different machine. (check this post https://somoit.net/checkpoint/checkpoint-recover-sms-disaster/ the steps &quot;install checkpoint 1&quot; and &quot;install checkpoint 2&quot;). After installing and copying the file into the production server, i started the api server succesfully:</p>
<pre><code>[Expert@mgmt_server:0]# api start
2024-Mar-27 09:04:01 - Starting API...
. . . . . . . .
2024-Mar-27 09:04:48 - API started successfully.</code></pre>
<p>And again i was able to use it and make calls:</p>
<pre><code>[Expert@mgmt_server:0]# mgmt_cli login user &quot;myuser&quot; password &quot;mypassword&quot; -f json
{
  &quot;uid&quot; : &quot;*******************************&quot;,
  &quot;sid&quot; : &quot;********************************************&quot;,
  &quot;url&quot; : &quot;https://127.0.0.1:443/web_api&quot;,
  &quot;session-timeout&quot; : 600,
  &quot;api-server-version&quot; : &quot;*.*.*&quot;
}</code></pre>
<p></p>]]></content:encoded></item><item><title><![CDATA[Exchange - Duplicated "Exchange Delegation Federation" certificates]]></title><description><![CDATA[Learn how to optimize Exchange Server certificate management  by removing redundant "Exchange Delegation Federation" certificates]]></description><link>https://somoit.net/exchange/duplicated-exchange-delegation-federation-certificates/</link><guid isPermaLink="false">65fb515a3842440001399b55</guid><category><![CDATA[exchange]]></category><category><![CDATA[email]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Wed, 20 Mar 2024 21:44:33 GMT</pubDate><content:encoded><![CDATA[<p></p>
<p>Recently, I encountered an interesting scenario in which an &quot;Exchange Delegation Federation&quot; certificate on one of our Exchange servers appeared to be duplicated. </p>
<pre><code class="language-powershell">Get-ExchangeCertificate | select-object Thumbprint,SerialNumber,Services,Subject | where { $_.Subject -eq &quot;CN=Federation&quot; }

Thumbprint                               SerialNumber                             Services Subject
----------                               ------------                             -------- -------
1ABC4623DE565ABBAECE1ABC4623DE565ABBAECE A156734AB54685EF673EFAABFE7864 SMTP, Federation CN=Federation
43FABC56DE565ABBAECE1ABC4623DE565BCA42A1 F2BCFA4AB54685EF673EFAABBABA21 SMTP CN=Federation</code></pre>
<p><br>This certificate is necessary for the hybrid environment and the redundancy raised concerns about unnecessary overhead and potential complications in certificate management. To address this issue, I decided to investigate further and take appropriate action. </p>
<p>First, I carefully examined the certificate details and its associated services using the <code>Get-ExchangeCertificate</code> cmdlet. This revealed that the certificate assigned to both federation and SMTP services was effectively serving all necessary functions. Conversely, the second certificate, assigned only to SMTP, seemed redundant (no send or receive connectors were using this certificate).</p>
<p>So i decided to remove it (previously exporting it as &apos;backup&apos;):</p>
<pre><code class="language-powershell">Remove-ExchangeCertificate 43FABC56DE565ABBAECE1ABC4623DE565BCA42A1</code></pre>
<pre><code class="language-powershell">Get-ExchangeCertificate | select-object Thumbprint,SerialNumber,Services,Subject | where { $_.Subject -eq &quot;CN=Federation&quot; }

Thumbprint                               SerialNumber                             Services Subject
----------                               ------------                             -------- -------
1ABC4623DE565ABBAECE1ABC4623DE565ABBAECE A156734AB54685EF673EFAABFE7864 SMTP, Federation CN=Federation</code></pre>
<p>Fortunately, the removal process went smoothly without any adverse effects on Exchange functionality. With the redundant certificate removed potential points of failure are reduced and streamlined certificate maintenance tasks.</p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image-28.png" class="kg-image" alt loading="lazy" width="1186" height="492" srcset="https://somoit.net/content/images/size/w600/2024/03/image-28.png 600w, https://somoit.net/content/images/size/w1000/2024/03/image-28.png 1000w, https://somoit.net/content/images/2024/03/image-28.png 1186w" sizes="(min-width: 720px) 720px"></figure>
<p></p>]]></content:encoded></item><item><title><![CDATA[Pentesting - Crack Windows password hashes]]></title><description><![CDATA[<p></p>
<p>However, despite efforts to create strong passwords, sometimes they can be compromised. In this blog post, we&apos;ll delve into the process of cracking Windows machine passwords, shedding light on the methods used and the tools involved.</p>
<h2 id="tools-we-will-use">Tools we will use</h2>
<ul><li><strong>pwdump:</strong> A utility for dumping password hashes from</li></ul>]]></description><link>https://somoit.net/pentesting/crack-windows-password-hashes/</link><guid isPermaLink="false">65f1ba9e3bc8330001200c4d</guid><category><![CDATA[pentesting]]></category><category><![CDATA[security]]></category><category><![CDATA[windows]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Wed, 13 Mar 2024 15:02:27 GMT</pubDate><content:encoded><![CDATA[<p></p>
<p>However, despite efforts to create strong passwords, sometimes they can be compromised. In this blog post, we&apos;ll delve into the process of cracking Windows machine passwords, shedding light on the methods used and the tools involved.</p>
<h2 id="tools-we-will-use">Tools we will use</h2>
<ul><li><strong>pwdump:</strong> A utility for dumping password hashes from the SAM database on Windows systems.<br>Link: <a href="https://www.openwall.com/passwords/windows-pwdump">website</a><a href="https://www.openwall.com/passwords/windows-pwdump"></a><br>Link: <a href="https://download.openwall.net/pub/projects/john/contrib/pwdump/pwdump8-8.2.zip">pdump8-8.2.zip </a><a href="https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt"></a></li><li><strong>John the Ripper</strong>: A powerful password cracking tool that supports various cracking techniques and hash formats. Usually used under linux, in this example we are using the windows version.<br>Link: <a href="https://www.openwall.com/john/">website</a><br>Link: <a href="https://www.openwall.com/john/k/john-1.9.0-jumbo-1-win64.zip">john-1.9.0-jumbo-1-win64.zip</a><br></li><li><strong>&quot;rockyou&quot; wordlist</strong>: A commonly used wordlist containing millions of passwords, useful for dictionary attacks. You can find it in many sites.<br>Link: <a href="https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt">rockyou.txt<br></a><a href="https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt"></a></li><li><strong>Test users</strong>: This is not a tool but i created some users in my windows machine as test users to try to crack their passwords. The first 3 ones are weak passwords. The last one is an strong password.</li></ul>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image-9.png" class="kg-image" alt loading="lazy" width="587" height="318"></figure>
<h2 id="extracting-password-hashes">Extracting Password Hashes</h2>
<p>The first step in cracking Windows machine passwords involves extracting the password hashes from the system. One common tool for this purpose is pwdump. This utility allows users to dump the password hashes stored in the Security Account Manager (SAM) database on a Windows system. Obviously you need to be Administrator of the machine.</p>
<p>To extract the password hashes using pwdump, follow these steps:</p>
<ol><li>Download and unzip the pwdump zip file on your Windows machine.</li><li>Open a command prompt with administrative privileges.</li><li>Navigate to the directory where pwdump was unzipped.</li><li>Run the command &quot;pwdump8.exe&quot; (8 because this is the version i am using the moment i am publishing this post) to extract the password hashes.</li></ol>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image-8.png" class="kg-image" alt loading="lazy" width="1076" height="415" srcset="https://somoit.net/content/images/size/w600/2024/03/image-8.png 600w, https://somoit.net/content/images/size/w1000/2024/03/image-8.png 1000w, https://somoit.net/content/images/2024/03/image-8.png 1076w" sizes="(min-width: 720px) 720px"></figure>
<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">In the image you can see i have run the command twice. The first one to show the output and the second one to save the output to a file we will use in the next step.</div></div>
<h2 id="cracking-password-hashes">Cracking Password Hashes</h2>
<p>Once the password hashes have been extracted, the next step is to crack them using a password cracking tool. One of the most popular tools for this purpose is John the Ripper. This powerful tool supports various password hash formats and employs different cracking techniques, including dictionary attacks, brute force attacks, and hybrid attacks.</p>
<p>Run John the Ripper with the appropriate options and specify the path to the password hash file. Use the &quot;rockyou&quot; wordlist for more comprehensive cracking.</p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image-10.png" class="kg-image" alt loading="lazy" width="942" height="318" srcset="https://somoit.net/content/images/size/w600/2024/03/image-10.png 600w, https://somoit.net/content/images/2024/03/image-10.png 942w" sizes="(min-width: 720px) 720px"></figure>
<p>Check the path and the options in the example:</p>
<ul><li>The executable &quot;john.exe&quot; is under the run subfolder of the unzipped file you have downloaded</li><li>--format-NT parameter to crack windows hashes</li><li>--wordlist &lt;path to rockyou.txt file&gt; to use the wordlist</li><li>last parameter is the hashes file we have generated in the previous step</li></ul>
<p>As you can see, the passwords of user1, user2 and user3 have been cracked.<br>It was not possible to crack the strong password of user4.</p>
<p>It&apos;s important to note that the success of password cracking depends on various factors, including the strength of the passwords, the quality of the password cracking dictionary (such as &quot;rockyou&quot;), and the computational resources available.</p>
<h2 id="conclusion">Conclusion</h2>
<p>In this blog post, we&apos;ve explored the process of cracking Windows machine passwords, from extracting the password hashes using pwdump to cracking them using John the Ripper with the &quot;rockyou&quot; wordlist. </p>
<p>While password cracking can be a powerful tool for security professionals and penetration testers, it&apos;s essential to use these techniques responsibly and ethically. Additionally, organizations and individuals should prioritize strong password practices to mitigate the risk of password compromise.</p>]]></content:encoded></item><item><title><![CDATA[F5 BigIP - IRule to log HTTP headers]]></title><description><![CDATA[Learn how to create an F5 BIG-IP custom iRule to log HTTP request and response headers for troubleshooting and analysis]]></description><link>https://somoit.net/f5/irule-log-http-headers/</link><guid isPermaLink="false">65f06d783bc8330001200c21</guid><category><![CDATA[F5]]></category><category><![CDATA[scripting]]></category><category><![CDATA[web]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Tue, 12 Mar 2024 15:09:41 GMT</pubDate><content:encoded><![CDATA[<p>Today, we&apos;re going to delve into a particularly useful iRule that enables the logging of HTTP request and response headers. This functionality can be invaluable for troubleshooting, monitoring, and security analysis. </p><h3 id="understanding-the-irule">Understanding the iRule</h3><p>The iRule provided captures HTTP request and response headers and logs them for analysis. Let&apos;s break down its structure:</p><pre><code class="language-bash">when HTTP_REQUEST {
   set LogString &quot;Client [IP::client_addr]:[TCP::client_port] [TCP::local_port] -&gt; [HTTP::host][HTTP::uri]&quot;
   log local0. &quot;#DEBUG# =============================================&quot;
   log local0. &quot;#DEBUG# $LogString (request)&quot;
   foreach aHeader [HTTP::header names] {
      log local0. &quot;#DEBUG# $aHeader: [HTTP::header value $aHeader]&quot;
   }
   log local0. &quot;#DEBUG# =============================================&quot;
}
when HTTP_RESPONSE {
   log local0. &quot;#DEBUG# &quot;
   log local0. &quot;#DEBUG# =============================================&quot;
   log local0. &quot;#DEBUG# $LogString (response) - status: [HTTP::status]&quot;
   foreach aHeader [HTTP::header names] {
      log local0. &quot;#DEBUG# $aHeader: [HTTP::header value $aHeader]&quot;
   }
   log local0. &quot;#DEBUG# =============================================&quot;   
}</code></pre><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">Note the starting &quot;#DEBUG#&quot; at the beginning of each log line.<br>I have used this to avoid mixing these debug logs with the system ones. Take a look at my old post: <a href="https://somoit.net/f5/f5-bigip-send-logs-to-custom-syslog-file/">https://somoit.net/f5/f5-bigip-send-logs-to-custom-syslog-file/</a></div></div><ul><li><strong>HTTP_REQUEST Block</strong>: This block is triggered whenever an HTTP request is received. It constructs a log string containing information about the client, ports, host, and URI. Then, it iterates over each HTTP header, logging its name and value.</li><li><strong>HTTP_RESPONSE Block</strong>: Similarly, this block is triggered upon receiving an HTTP response. It logs the same client information along with the response status and iterates over response headers for logging.</li></ul><h2 id="example">Example</h2><p>This is how the result looks like:</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image-5.png" class="kg-image" alt loading="lazy" width="1414" height="414" srcset="https://somoit.net/content/images/size/w600/2024/03/image-5.png 600w, https://somoit.net/content/images/size/w1000/2024/03/image-5.png 1000w, https://somoit.net/content/images/2024/03/image-5.png 1414w" sizes="(min-width: 720px) 720px"></figure><pre><code>#DEBUG#  ====================== Request Headers ============================
#DEBUG# Client xxx.xxx.xxx.xxx:60749 443 -&gt; &lt;URL&gt; (request)
#DEBUG# sensorid: 4148
#DEBUG# Host: &lt;DOMAIN&gt;
#DEBUG# Accept: text/html,*/*
#DEBUG# User-Agent: Mozilla/5.0 (compatible; xxxxxxxxxxx; Windows)
#DEBUG# Proxy-Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#DEBUG# X-Forwarded-For: xxx.xxx.xxx.xxx
#DEBUG# X-Forwarded-Proto: https
#DEBUG# Access-Control-Allow-Credentials: true
#DEBUG# =============================================

#DEBUG#  ====================== Response Headers ============================
#DEBUG# Client xxx.xxx.xxx.xxx%1:60749 443 -&gt; &lt;URL&gt; (response) - status: 200
#DEBUG# Cache-Control: no-cache, must-revalidate, no-transform, no-store
#DEBUG# X-XSS-Protection: 1; mode=block
#DEBUG# X-Frame-Options: SAMEORIGIN
#DEBUG# Referrer-Policy: no-referrer
#DEBUG# Content-Security-Policy: frame-src &apos;self&apos;; frame-ancestors &apos;self&apos;; object-src &apos;none&apos;;
#DEBUG# Date: Tue, 12 Mar 2024 15:04:19 GMT
#DEBUG# Connection: keep-alive
#DEBUG# X-Robots-Tag: none
#DEBUG# Strict-Transport-Security: max-age=31536000; includeSubDomains
#DEBUG# X-Content-Type-Options: nosniff
#DEBUG# Content-Type: text/html;charset=utf-8
#DEBUG# Content-Length: 2740
#DEBUG# =============================================</code></pre><h2 id="conclusion">Conclusion</h2><p>Custom iRules like the one we&apos;ve explored here exemplify the power and flexibility of the F5 BIG-IP platform. By logging HTTP request and response headers, administrators can gain valuable visibility into traffic patterns, diagnose issues efficiently, and enhance security posture.</p><p>Do you use custom iRules in your F5 deployments? Share your experiences and insights in the comments below!</p>]]></content:encoded></item><item><title><![CDATA[Check Point - SmartConsole stuck "Loading SmartView"]]></title><description><![CDATA[Troubleshoot perpetual loading in SmartConsole's showing "Loading Smartview"]]></description><link>https://somoit.net/checkpoint/smartconsole-stuck-loading-smartview/</link><guid isPermaLink="false">65e585543bc8330001200bed</guid><category><![CDATA[checkpoint]]></category><category><![CDATA[Apache]]></category><category><![CDATA[firewall]]></category><category><![CDATA[sysadmin]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Mon, 04 Mar 2024 16:09:10 GMT</pubDate><content:encoded><![CDATA[<p>I came accross a problem in which a perpetual loading screen with the message &quot;Loading SmartView&quot; was shown when attempting to open a new tab in the &quot;Logs &amp; Monitor&quot; section of the SmartConsole. </p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image.png" class="kg-image" alt loading="lazy" width="965" height="578" srcset="https://somoit.net/content/images/size/w600/2024/03/image.png 600w, https://somoit.net/content/images/2024/03/image.png 965w" sizes="(min-width: 720px) 720px"></figure>
<p>Additionally, you might find that attempting to access SmartView directly via &quot;<a href="https://management-server/smartview">https://management-server/smartview</a>&quot; redirects you to the Gaia portal instead of opening SmartView.</p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image-2.png" class="kg-image" alt loading="lazy" width="824" height="473" srcset="https://somoit.net/content/images/size/w600/2024/03/image-2.png 600w, https://somoit.net/content/images/2024/03/image-2.png 824w" sizes="(min-width: 720px) 720px"></figure>
<h2 id="diagnosing-the-cause"><strong>Diagnosing the Cause</strong></h2>
<p>After some investigation, it was discovered that the root of the issue lay within the <strong>/web/conf/extra/httpd2-smartview.conf</strong> configuration file, which was found to be empty. This configuration file is crucial for enabling proper communication and functionality between the SmartConsole and the SmartView component.</p>
<h2 id="implementing-the-solution"><strong>Implementing the Solution</strong></h2>
<p>To rectify the problem, the following configuration was added to the <strong>/web/conf/extra/httpd2-smartview.conf</strong> file:</p>
<pre><code class="language-html">LoadModule proxy_module modules/libmod_proxy.so
LoadModule proxy_http_module modules/libmod_proxy_http.so
LoadModule proxy_wstunnel_module modules/libmod_proxy_wstunnel.so

ProxyErrorOverride On

&lt;Location /smartview/PUSH/&gt;
  ProxyPass ws://127.0.0.1:8082/smartview/PUSH/
  ProxyPassReverse ws://127.0.0.1:8082/smartview/PUSH/
&lt;/Location&gt;

&lt;Location /smartview/embedded/PUSH/&gt;
  ProxyPass ws://127.0.0.1:8082/smartview/embedded/PUSH/
  ProxyPassReverse ws://127.0.0.1:8082/smartview/embedded/PUSH/
&lt;/Location&gt;

&lt;Location /smartview/editor/PUSH/&gt;
  ProxyPass ws://127.0.0.1:8082/smartview/editor/PUSH/
  ProxyPassReverse ws://127.0.0.1:8082/smartview/editor/PUSH/
&lt;/Location&gt;

&lt;Location /smartview/viewer/PUSH/&gt;
  ProxyPass ws://127.0.0.1:8082/smartview/viewer/PUSH/
  ProxyPassReverse ws://127.0.0.1:8082/smartview/viewer/PUSH/
&lt;/Location&gt;

&lt;Location /smartview&gt;
  &lt;LimitExcept HEAD POST GET&gt;
    Require all denied
  &lt;/LimitExcept&gt;

  ProxyPass http://127.0.0.1:8082/smartview
  ProxyPassReverse http://127.0.0.1:8082/smartview
&lt;/Location&gt;

&lt;Location /smartview/pdf/&gt;
  Require all denied
&lt;/Location&gt;</code></pre>
<p>After inserting the configuration, the HTTPD2 daemon was restarted using the following commands:</p>
<p>To stop: <code>tellpm process:httpd2</code>  <br>To start: <code>tellpm process:httpd2 t<br></code></p>
<h2 id="fixed"><strong>Fixed</strong></h2>
<p>Following these steps, the SmartConsole should now be able to load SmartView without encountering any further issues. The added configuration ensures proper proxying and routing of requests to the SmartView component, resolving the loading problem and allowing users to seamlessly access SmartView functionalities.</p>
<p></p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image-4.png" class="kg-image" alt loading="lazy" width="1214" height="533" srcset="https://somoit.net/content/images/size/w600/2024/03/image-4.png 600w, https://somoit.net/content/images/size/w1000/2024/03/image-4.png 1000w, https://somoit.net/content/images/2024/03/image-4.png 1214w" sizes="(min-width: 720px) 720px"></figure>
<p></p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/03/image-3.png" class="kg-image" alt loading="lazy" width="826" height="479" srcset="https://somoit.net/content/images/size/w600/2024/03/image-3.png 600w, https://somoit.net/content/images/2024/03/image-3.png 826w" sizes="(min-width: 720px) 720px"></figure>
<p></p>]]></content:encoded></item><item><title><![CDATA[ESXi VM Power State Management via SSH]]></title><description><![CDATA[Simplify ESXi VM management with vms-power-state.sh. List VMs, check power states, and perform actions from the command line.]]></description><link>https://somoit.net/vmware/esxi-vm-power-management-script/</link><guid isPermaLink="false">65d7c3fbd1fe2e00012868f1</guid><category><![CDATA[vmware]]></category><category><![CDATA[scripting]]></category><category><![CDATA[bash]]></category><category><![CDATA[sysadmin]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Thu, 22 Feb 2024 22:38:40 GMT</pubDate><content:encoded><![CDATA[<p>In an ESXi environment, managing virtual machines (VMs) via SSH can be a powerful way to automate tasks and streamline administration. In this guide, we&apos;ll walk through the process of listing VMs, checking their power state, powering them on, gracefully shutting down their guest OS, and finally powering them off using command-line tools.</p><h2 id="vmware-commands">VMWare commands</h2><h3 id="listing-vms"><strong>Listing VMs</strong></h3><p>This command provides a list of VMs along with their IDs, making it easy to identify the VMs we want to manage.<br><code>vim-cmd vmsvc/getallvms</code></p><h3 id="getting-power-state"><strong>Getting Power State</strong></h3><p>This command returns whether the VM is powered on, off, suspended, etc., allowing us to determine its current state before taking further action.<br><code>vim-cmd vmsvc/power.getstate VMID</code> </p><h3 id="powering-on-a-vm"><strong>Powering On a VM</strong></h3><p>This command initiates the boot process for the VM, allowing its guest OS to start up<br><code>vim-cmd vmsvc/power.on VMID</code></p><h3 id="shutting-down-a-vm"><strong>Shutting Down a VM</strong></h3><p>This command sends a shutdown signal to the VM, allowing its guest OS to perform a clean shutdown before the VM powers off.<br><code>vim-cmd vmsvc/power.shutdown VMID</code></p><h3 id="powering-off-a-vm"><strong>Powering Off a VM</strong></h3><p>This command immediately powers off the VM without waiting for its guest OS to shut down<br><code>vim-cmd vmsvc/power.off VMID</code>.  </p><h2 id="script-to-simplify-powering-onoff-vms">Script to simplify powering on/off VMs</h2><p>I&apos;ve created a simple but handy bash script called <code>vms-power-state.sh</code> that simplifies VM management via the command line.</p><h3 id="download"><strong>Download</strong></h3><p>You can download it in <a href="https://github.com/somoit-net/vmware-tools" rel="noreferrer">Github</a></p><h3 id="overview"><strong>Overview</strong></h3><p>The script offers several commands to interact with VMs:</p><ul><li><code>vms-power-state.sh</code> Prints help text, providing an overview of available commands.</li><li><code>vms-power-state.sh list</code> Displays a list of VMs along with their powering states.</li><li><code>vms-power-state.sh &lt;poweron|shutdown|poweroff&gt; &lt;VM_NAME|ALL&gt;</code>:<ul><li><code>poweron</code> Powers on the specified VM or all VMs.</li><li><code>shutdown</code> Initiates a graceful shutdown of the guest OS of the specified VM or all VMs.</li><li><code>poweroff</code> Immediately powers off the specified VM.</li></ul></li></ul><h3 id="usage-examples"><strong>Usage Examples</strong></h3><p>Let&apos;s walk through some usage examples of the script:</p><ul><li><strong>Listing VMs and Powering States:</strong><br>Running <code>vms-power-state.sh list</code> provides a clear overview of all VMs and their current powering states, making it easy to identify which VMs are powered on or off.</li></ul><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-21.png" class="kg-image" alt loading="lazy" width="458" height="83"></figure><ul><li><strong>Powering On a VM:</strong><br>To power on a VM, simply run <code>vms-power-state.sh on &lt;VM_NAME|ALL&gt;</code>.</li></ul><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-22.png" class="kg-image" alt loading="lazy" width="516" height="48"></figure><ul><li><strong>Gracefully Shutting Down a VM:</strong><br>To initiate a graceful shutdown to perform a clean shutdown of a VM&apos;s guest OS, use <code>vms-power-state.sh shutdown &lt;VM_NAME|ALL&gt;</code>. </li></ul><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-23.png" class="kg-image" alt loading="lazy" width="503" height="36"></figure><ul><li><strong>Powering Off a VM:</strong><br>To power off immediately a VM, use <code>vms-power-state.sh shutdown &lt;VM_NAME&gt;</code>. </li></ul><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-24.png" class="kg-image" alt loading="lazy" width="530" height="34"></figure><p>Whether you need to power on/off VMs or gracefully shut down their guest OS, this script provides a convenient way to perform these tasks directly from the command line.</p>]]></content:encoded></item><item><title><![CDATA[F5 BIG-IP - Add HSTS Strict Transport Security using IRules]]></title><description><![CDATA[Learn how to configure HSTS headers using iRules on F5 for robust web security. Ensure HTTPS-only connections for your site.]]></description><link>https://somoit.net/f5/hsts-header-irule/</link><guid isPermaLink="false">646e07a2cb37070001a74632</guid><category><![CDATA[F5]]></category><category><![CDATA[security]]></category><category><![CDATA[web]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Mon, 19 Feb 2024 18:27:07 GMT</pubDate><content:encoded><![CDATA[<p>HTTP Strict Transport Security (HSTS) is a security feature that allows websites to specify that browsers should only interact with them over secure HTTPS connections. By sending an HSTS header with a specified max-age directive, websites instruct browsers to automatically convert all HTTP requests to HTTPS, thereby enhancing security and protecting against various attacks, such as SSL-stripping attacks.</p><p>You can check your site by using a site like SSL Labs (<a>https://www.ssllabs.com/ssltest/</a>) or SecurityHeaders (<a href="https://securityheaders.com/">https://securityheaders.com/</a>) to perform a comprehensive security assessment of your website that evaluates various security aspects of the SSL/TLS configuration, including the presence and correctness of HSTS headers.</p><p>For example, this is the result of checking an example site I published using F5:</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2019/07/img_5d1b07ea7c301.png" class="kg-image" alt loading="lazy" width="1011" height="422" srcset="https://somoit.net/content/images/size/w600/2019/07/img_5d1b07ea7c301.png 600w, https://somoit.net/content/images/size/w1000/2019/07/img_5d1b07ea7c301.png 1000w, https://somoit.net/content/images/2019/07/img_5d1b07ea7c301.png 1011w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2019/07/img_5d1b08129e4e1.png" class="kg-image" alt loading="lazy" width="517" height="43"></figure><p>As you can see, it returns an invalid HSTS header: &quot;Required directive missing: max-age&quot;</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2019/07/img_5d1b0851abda0.png" class="kg-image" alt loading="lazy" width="459" height="343"></figure><p>That header was sent by the web backend behind the F5 device.</p><p>The official article <a href="https://my.f5.com/manage/s/article/K04436209">https://support.f5.com/csp/article/K04436209</a> shows &#xA0;the way to make F5 insert the HSTS header.</p><pre><code>when HTTP_RESPONSE_RELEASE {
	if {!([HTTP::header exists &#x201C;Strict-Transport-Security&#x201D;])} 
	{
		HTTP::header insert &#x201C;Strict-Transport-Security&#x201D; &#x201C;max-age=16070400; includeSubDomains&#x201D;
	}
}</code></pre><p>But that was not valid for the scenario I came across because the F5 header was already sent by another device and without the required max-age value.</p><p>Instead of inserting, by using this irule the HSTS was correctly set...</p><pre><code>when HTTP_RESPONSE_RELEASE {
	HTTP::header replace &#x201C;Strict-Transport-Security&#x201D; &#x201C;max-age=16070400; includeSubDomains&#x201D;
}</code></pre><p>...as confirmed afterwards:</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2019/07/img_5d1b0926ef7fd.png" class="kg-image" alt loading="lazy" width="527" height="339"></figure><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2019/07/img_5d1b0df020dea.png" class="kg-image" alt loading="lazy" width="1000" height="473" srcset="https://somoit.net/content/images/size/w600/2019/07/img_5d1b0df020dea.png 600w, https://somoit.net/content/images/2019/07/img_5d1b0df020dea.png 1000w" sizes="(min-width: 720px) 720px"></figure>]]></content:encoded></item><item><title><![CDATA[Checkpoint - Identity Awareness/AD continuous "Failed Login" errors]]></title><description><![CDATA[Discover solutions for persistent AD login errors when using Check Point Identity Awareness module integration with Active Directory]]></description><link>https://somoit.net/checkpoint/identity-awareness-failed-login-errors/</link><guid isPermaLink="false">65cb8a2ad1fe2e0001286866</guid><category><![CDATA[checkpoint]]></category><category><![CDATA[firewall]]></category><category><![CDATA[security]]></category><category><![CDATA[sysadmin]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Wed, 14 Feb 2024 22:12:58 GMT</pubDate><content:encoded><![CDATA[<p>Check Point Identity Awareness module provides visibility into network traffic, allowing organizations to enforce security policies based granular control over user access. </p>
<p>Recently, I encountered a puzzling issue where the Identity Awareness module integrated with Active Directory (AD) began generating persistent errors, disrupting network operations. Upon investigation, I discovered that these errors were evident in the logs, revealing a continuous stream of &quot;Failed Login&quot; events. Here&apos;s how I tackled the problem and restored functionality.</p>
<h2 id="identifying-the-issue"><strong>Identifying the Issue</strong></h2>
<p>The first step was to scrutinize the logs, where I found a plethora of &quot;Failed Login&quot; entries, indicating authentication challenges. This prompted a deeper dive into the configuration settings to pinpoint the root cause.</p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-15.png" class="kg-image" alt loading="lazy" width="906" height="265" srcset="https://somoit.net/content/images/size/w600/2024/02/image-15.png 600w, https://somoit.net/content/images/2024/02/image-15.png 906w" sizes="(min-width: 720px) 720px"></figure>
<p></p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-16.png" class="kg-image" alt loading="lazy" width="770" height="557" srcset="https://somoit.net/content/images/size/w600/2024/02/image-16.png 600w, https://somoit.net/content/images/2024/02/image-16.png 770w" sizes="(min-width: 720px) 720px"></figure>
<p></p>
<h2 id="troubleshooting-and-solution"><strong>Troubleshooting and Solution</strong></h2>
<p>After meticulous investigation, I determined that several settings defined in the Account Unit required attention to rectify the issue:</p>
<ol><li><strong>Check Username/Password</strong>: Ensure that the credentials are accurate and up-to-date. Incorrect credentials can lead to authentication failures and subsequent errors.</li><li><strong>Verify Branch Configuration</strong>: Validate that the Branch configuration under the &quot;Object Management&quot; tab is correctly configured. Misconfigurations here can impede communication with AD and result in authentication issues.</li><li><strong>LDAPS Certificate Verification</strong>: If LDAPS (LDAP over SSL/636) is utilized, verify whether the certificate has changed. In case of certificate modifications, re-fetch the fingerprint to ensure secure communication:<ul><li>Navigate to the Servers tab.</li><li>Access the servers and proceed to the Encryption tab.</li><li>Click &quot;Fetch&quot; to retrieve the updated fingerprint.</li><li>Repeat this process for all relevant servers.</li><li>After refetching all servers, install the relevant policies</li></ul></li></ol>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-18.png" class="kg-image" alt loading="lazy" width="615" height="406" srcset="https://somoit.net/content/images/size/w600/2024/02/image-18.png 600w, https://somoit.net/content/images/2024/02/image-18.png 615w"></figure>
<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">It&apos;s worth noting that the fingerprint of Domain Controllers (DCs) can change due to certificate modifications, potentially triggering authentication errors. While refetching mitigates this issue, an alternative approach involves leaving the fingerprint field empty to bypass verification, albeit at the expense of Man-in-the-Middle (MitM) protection.</div></div>
<p></p>
<h2 id="resolution-and-mitigation"><strong>Resolution and Mitigation</strong></h2>
<p>Upon performing the necessary steps, including the re-fetching of fingerprints and policy installations, the persistent errors were successfully resolved. </p>
<figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-19.png" class="kg-image" alt loading="lazy" width="965" height="116" srcset="https://somoit.net/content/images/size/w600/2024/02/image-19.png 600w, https://somoit.net/content/images/2024/02/image-19.png 965w" sizes="(min-width: 720px) 720px"></figure>
<p></p>]]></content:encoded></item><item><title><![CDATA[Cisco ESA - Sender based SMTP routes]]></title><description><![CDATA[Learn how to configure Cisco ESA to efficiently route SMTP traffic based on sender information in our latest blog post]]></description><link>https://somoit.net/ironport/sender-based-smtp-routes/</link><guid isPermaLink="false">65ca1991d1fe2e00012867c8</guid><category><![CDATA[Ironport]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Tue, 13 Feb 2024 14:02:00 GMT</pubDate><content:encoded><![CDATA[<p>Email routing traditionally relies on recipient domain as the primary factor for directing messages. </p><p>Cisco ESA / Ironport manages it using SMTP routes, where you match the receiving domains with the destination hosts:</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-9.png" class="kg-image" alt loading="lazy" width="635" height="441" srcset="https://somoit.net/content/images/size/w600/2024/02/image-9.png 600w, https://somoit.net/content/images/2024/02/image-9.png 635w"></figure><p>While logical, this approach can present challenges in specific scenarios. For example, I encountered a situation where I needed to selectively route outgoing emails to different relay servers during testing or migration processes. </p><p>This would allow to gain the flexibility to direct emails to either the existing relay or the new one, depending on the sender&apos;s address/domain, providing greater control and helping to keep the flow uninterrupted. To address this challenge, I researched how routing based on the sender can be achieved on Cisco ESAs. Here is how i managed to do it:</p><h2 id="create-dictionary">Create dictionary</h2><p>Using a dictionary allows granularity to add patterns to which the new route will be applied:</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-11.png" class="kg-image" alt loading="lazy" width="896" height="512" srcset="https://somoit.net/content/images/size/w600/2024/02/image-11.png 600w, https://somoit.net/content/images/2024/02/image-11.png 896w" sizes="(min-width: 720px) 720px"></figure><p>Later we will associate the dictionary to envelope sender address condition so, in this example, it would apply to:</p><ul><li>address -&gt; test@mydomain.com</li><li>domain -&gt; @test.mydomain.ocm</li></ul><h2 id="configure-fake-smtp-route">Configure &quot;fake&quot; SMTP route</h2><p>Using a fake domain name (in this example newrelay.mydomain.com), create a new smtp route.<br>That hostname does not need to be created, exist, or even be registered in DNS... it&apos;s a fake name.</p><p>The destination (or destinations) must be the hostname of the relay server (or servers, in case of round robin) where you are going to send emails that matches certain conditions (like the sender based one we want).</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-12.png" class="kg-image" alt loading="lazy" width="894" height="361" srcset="https://somoit.net/content/images/size/w600/2024/02/image-12.png 600w, https://somoit.net/content/images/2024/02/image-12.png 894w" sizes="(min-width: 720px) 720px"></figure><h2 id="configure-outgoing-content-filter">Configure outgoing content-filter</h2><p>Open &quot;Outgoing Content-Filters&quot; section and create a new one:</p><h3 id="name">Name</h3><p>As you want, f.e. &quot;CF_Route_NewRelay&quot;</p><h3 id="conditions">Conditions</h3><p>Based on which conditions do you want to route the outgoing emails through the new relay? Here you will define it.</p><p>We can use the &quot;Envelope sender&quot; - &quot;contains&quot;. But this does not offer enough flexibility. For that reason, as commented before, let&apos;s use the dictionary containing the patterns that, in case of matching the sender, will cause the CF to be applied.</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-13.png" class="kg-image" alt loading="lazy" width="285" height="281"></figure><h3 id="actions">Actions</h3><p>This is what causes the magic to happen. Set the &quot;Send to Alternate Destination Host&quot; action pointing to the fake name we have used in a previous step:</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-7.png" class="kg-image" alt loading="lazy" width="386" height="118"></figure><p>This will cause to match the SMTP route with that domain name and use the relay configured in that entry.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">You might think, why not directly put the relay server in alt mail host? That doesn&apos;t work, apparently it tries to match it in the &apos;receiving domain&apos; values of the routes and doesn&apos;t find it, causing it not to work this way.</div></div><p>The rule would be as follows:</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/02/image-14.png" class="kg-image" alt loading="lazy" width="886" height="522" srcset="https://somoit.net/content/images/size/w600/2024/02/image-14.png 600w, https://somoit.net/content/images/2024/02/image-14.png 886w" sizes="(min-width: 720px) 720px"></figure><h3 id></h3><h2 id="enable-cf-on-the-outgoing-policies">Enable CF on the outgoing policies</h2><p>Access &quot;Outgoing Policies&quot; section and edit the policies in which you want to apply the content-filter.  <br><br>In the list of CFs of the policy, check the newly created one to enable it:</p><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/08/image-7.png" class="kg-image" alt loading="lazy" width="1077" height="210" srcset="https://somoit.net/content/images/size/w600/2024/08/image-7.png 600w, https://somoit.net/content/images/size/w1000/2024/08/image-7.png 1000w, https://somoit.net/content/images/2024/08/image-7.png 1077w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card"><img src="https://somoit.net/content/images/2024/08/image-6.png" class="kg-image" alt loading="lazy" width="844" height="72" srcset="https://somoit.net/content/images/size/w600/2024/08/image-6.png 600w, https://somoit.net/content/images/2024/08/image-6.png 844w" sizes="(min-width: 720px) 720px"></figure><h2 id="apply-and-commit-changes">Apply and Commit changes</h2><p>Apply and commit the changes and verify that it&apos;s working.</p>]]></content:encoded></item><item><title><![CDATA[Nginx - Hide Server Header Information]]></title><description><![CDATA[Enhance security on Nginx servers by hardening server headers. Learn how to minimizing information disclosure.]]></description><link>https://somoit.net/nginx/hide-server-header-information/</link><guid isPermaLink="false">647ba945cb37070001a74f00</guid><category><![CDATA[nginx]]></category><dc:creator><![CDATA[SomoIT]]></dc:creator><pubDate>Thu, 08 Feb 2024 17:00:00 GMT</pubDate><content:encoded><![CDATA[<p></p><p>In the realm of web servers, one crucial aspect of server security is minimizing the amount of information disclosed about the web server software powering your site. This practice, known as &quot;server header hardening&quot; or &quot;server banner suppression&quot; can significantly bolster your server&apos;s defenses against potential threats. </p><p>For example, let&apos;s take a look at this received headers...</p><pre><code>$ curl --head testsite.com
HTTP/1.1 200 OK
Server: nginx/1.18.0
Date: Thu, 08 Mar 2023 08:56:35 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 12920
Connection: keep-alive
X-Powered-By: Express
Cache-Control: public, max-age=0</code></pre><p>Sensitive information that we obtain:</p><ul><li>Web server is an Nginx version 1.18.0</li><li>It&apos;s publishing a site developed using ExpressJS</li></ul><p>Let&apos;s delve into how you can hide this information in Debian using Nginx.</p><h2 id="installing-additional-modules">Installing additional modules</h2><p>For those looking to customize server headers without the bulk of the nginx-extras package, consider installing the <code>libnginx-mod-http-headers-more-filter</code> module:</p><pre><code>sudo apt-get install libnginx-mod-http-headers-more-filter</code></pre><p>This lightweight module empowers you to manipulate HTTP headers within Nginx configurations, providing flexibility while keeping resource usage low.</p><p></p><h2 id="reducing-information-disclosure">Reducing Information Disclosure</h2><p>In your <code>nginx.conf</code> file (typically located in <code>/etc/nginx/</code>), locate the <code>http</code> block. Here, you&apos;ll make modifications to minimize information disclosure. Uncomment the <code>server_tokens off;</code> directive if present. This directive disables the version number from being displayed in server responses, a critical step in reducing the attack surface:</p><pre><code>http { 
	# Other configurations... 

	server_tokens off; 

	# Other configurations... 
}</code></pre><p></p><h2 id="customizing-server-headers">Customizing Server Headers</h2><p>With the <code>libnginx-mod-http-headers-more-filter</code> module installed, you can customize the server header to obscure specific details. Add the following line within the <code>http</code> block to replace the default server header with a custom one, such as &quot;SomoIT webserver&quot;:</p><pre><code>more_set_headers &apos;Server: My own webserver&apos;;</code></pre><h2 id="hide-the-sites-x-powered-by">Hide the sites X-Powered-By</h2><p>To remove the &quot;X-Powered-By&quot; header in Nginx, you can use the <code>proxy_hide_header</code> directive in your Nginx configuration. <br>Probably you would have to configure it at site level in any of the config files located in /etc/nginx/sites-available/:</p><pre><code>server { 
	# Other server configurations... 
    
    location / { 
    	# Other location directives... 
        proxy_hide_header X-Powered-By; 
	} 
    
    # Other server blocks and configurations... 
}</code></pre><h2 id="restarting-nginx">Restarting Nginx</h2><p>After making these crucial adjustments, save the <code>nginx.conf</code> file and restart the Nginx service to apply the new configuration:</p><pre><code>sudo systemctl restart nginx</code></pre><h2 id="checking-the-result">Checking the result</h2><p></p><p>Let&apos;s repeat the curl command to obtain the headers and check...</p><pre><code>$ curl --head testsite.com
HTTP/1.1 200 OK
Server: My own webserver
Date: Thu, 08 Mar 2023 09:12:11 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 12920
Connection: keep-alive
Cache-Control: public, max-age=0</code></pre><ul><li>Server header value now is &quot;My own webserver&quot;</li><li>No X-Powered-By header is shown</li></ul><h2 id="conclusion">Conclusion</h2><p>Minimizing information disclosure one aspect of a comprehensive security strategy. It does not only reduces the attack surface but also contributes to user privacy. </p><p></p>]]></content:encoded></item></channel></rss>