<?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[MeviTech]]></title><description><![CDATA[The Best Way and The Right Way]]></description><link>https://blog.mevi.tech/</link><image><url>https://blog.mevi.tech/favicon.png</url><title>MeviTech</title><link>https://blog.mevi.tech/</link></image><generator>Ghost 5.85</generator><lastBuildDate>Tue, 07 Apr 2026 16:21:12 GMT</lastBuildDate><atom:link href="https://blog.mevi.tech/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Setup Azure Virtual WAN - P2S OpenVPN with AD Integration]]></title><description><![CDATA[<p></p><h2 id="why-do-we-use-azure-virtual-wan-instead-of-azure-virtual-network-gateway">Why do we use Azure Virtual WAN instead of Azure Virtual Network Gateway?</h2><p>Azure Virtual Network Gateway won&apos;t allow us to connect to the internet through the VPN connection.</p><h2 id="how-to-setup-azure-virtual-wan-for-vpn">How to setup Azure Virtual WAN for VPN?</h2><p>The following are the major steps included in setting up Virtual</p>]]></description><link>https://blog.mevi.tech/setup-azure-virtual-wan-openvpn-with-ad-integration/</link><guid isPermaLink="false">65ad8f86d8b8710001f8d85a</guid><category><![CDATA[OpenVPN]]></category><category><![CDATA[Virtual WAN]]></category><category><![CDATA[Active Directory]]></category><category><![CDATA[AD]]></category><category><![CDATA[P2S]]></category><category><![CDATA[Point2Site]]></category><category><![CDATA[Point-To-Site]]></category><category><![CDATA[azure]]></category><category><![CDATA[Windows]]></category><category><![CDATA[macOS]]></category><dc:creator><![CDATA[Ananthram]]></dc:creator><pubDate>Mon, 22 Jan 2024 10:59:06 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2024/01/AzureWANOpenVPNAD.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2024/01/AzureWANOpenVPNAD.png" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration"><p></p><h2 id="why-do-we-use-azure-virtual-wan-instead-of-azure-virtual-network-gateway">Why do we use Azure Virtual WAN instead of Azure Virtual Network Gateway?</h2><p>Azure Virtual Network Gateway won&apos;t allow us to connect to the internet through the VPN connection.</p><h2 id="how-to-setup-azure-virtual-wan-for-vpn">How to setup Azure Virtual WAN for VPN?</h2><p>The following are the major steps included in setting up Virtual WAN.</p><p>&#x2705;Create Virtual WAN</p><p>&#x2705;Create Virtual Hub</p><p>&#x2705;Setup Azure Firewall</p><p>&#x2705;Create Azure Firewall Policy</p><p>&#x2705;Associate Virtual Hub with Firewall Policy</p><p>&#x2705;Update Routing Intent &amp; Routing Policies</p><p>&#x2705;Update Route Tables</p><p>&#x2705;Download VPN Configuration</p><p>&#x2705;Modify VPN Configuration</p><p>&#x2705;VPN Client Setup - Apple macOS</p><p>&#x2705;VPN Client Setup - Microsoft Windows</p><p></p><h3 id="create-virtual-wan">Create Virtual WAN</h3><p>Login to Azure Portal and navigate to Azure Virtual WAN and click on create. Choose the Resource Group and Region and provide a Name. Click on Review+create and create the resource.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWAN1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1312" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWAN1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWAN1.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWAN1.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWAN1.png 2400w" sizes="(min-width: 720px) 720px"></figure><h3 id="create-virtual-hub">Create Virtual Hub</h3><p>Once the Virtual WAN is created, choose the created resource and click on Hubs under Connectivity and click on New Hub.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWANHub2.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1333" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWANHub2.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWANHub2.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWANHub2.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWANHub2.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Choose the Region. Provide Name, Hub private address space, Virtual hub capacity, Hub routing preference as in the screenshot below. Modify as required.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWANHubBasics3.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1305" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWANHubBasics3.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWANHubBasics3.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWANHubBasics3.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWANHubBasics3.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Provide Gateway scale units, and click on create new under Point to server configuration</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWAN4-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1327" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWAN4-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWAN4-1.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWAN4-1.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWAN4-1.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Provide a Name for new user configuration and choose tunnel type as OpenVPN in the Basics tab.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWANUserProfile5.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1317" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWANUserProfile5.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWANUserProfile5.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWANUserProfile5.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWANUserProfile5.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Got to Azure Active Directory tab and provide the same value as in the screenshot for Audience. For Issuer https://sts.windows.net/TENANT_ID/ and for AAD Tenant  https://login.microsoftonline.com/TENANT_ID/</p><p>You can find you Tenant ID by visiting Azure Active Directory home page.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWANUserProfile6.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1321" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWANUserProfile6.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWANUserProfile6.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWANUserProfile6.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWANUserProfile6.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Now click on Review+create and create after validation.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWANUserProfile8-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1314" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWANUserProfile8-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWANUserProfile8-1.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWANUserProfile8-1.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWANUserProfile8-1.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Provide custom DNS as required and click on configure in Address Pools under Configure User Groups to Address Pools Mapping</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWANHub9.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1311" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWANHub9.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWANHub9.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWANHub9.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWANHub9.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Provide a Client address pool such as 10.0.0.0/24 and click on Add. Click Review+create and create Virtual Hub.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/VirtualWANHubAddressPool10.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1315" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/VirtualWANHubAddressPool10.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/VirtualWANHubAddressPool10.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/VirtualWANHubAddressPool10.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/VirtualWANHubAddressPool10.png 2400w" sizes="(min-width: 720px) 720px"></figure><h3 id="setup-azure-firewall">Setup Azure Firewall</h3><p>Wait for the Virtual Hub to get created. Once created, choose the Virtual Hub and click on Create under Azure Firewall.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/11.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1276" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/11.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/11.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/11.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/11.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>In convert existing hubs, choose the Hub Name if it is not chosen already and choose Azure Firewall tab.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/12-2.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1144" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/12-2.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/12-2.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/12-2.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/12-2.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Enable Azure Firewall and choose the tier as Standard. Provide required number of IP addresses in Specify number of Public IP addresses. We are providing 2 in this case. Click on Next.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/13-2.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1137" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/13-2.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/13-2.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/13-2.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/13-2.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Skip modifying this section. Now click on Review+confirm to validate and create.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/14-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1142" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/14-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/14-1.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/14-1.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/14-1.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>Click confirm to create.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/15.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1144" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/15.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/15.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/15.png 1600w, https://blog.mevi.tech/content/images/size/w2400/2024/01/15.png 2400w" sizes="(min-width: 720px) 720px"></figure><h3 id="create-azure-firewall-policy">Create Azure Firewall Policy</h3><p>Visit Firewall Manager console. Click on Azure Firewall Policies.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/firewall1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1344" height="569" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/firewall1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/firewall1.png 1000w, https://blog.mevi.tech/content/images/2024/01/firewall1.png 1344w" sizes="(min-width: 720px) 720px"></figure><p>Choose the Resource group, provide policy name and region. Choose Policy tier as Standard.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/fw11.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1353" height="584" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/fw11.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/fw11.png 1000w, https://blog.mevi.tech/content/images/2024/01/fw11.png 1353w" sizes="(min-width: 720px) 720px"></figure><p>Click on Rules tab and add a rule collection. Provide a Name. Choose Rule collection type as Network and set Priority as required. Create a rule by providing Name, source as *, destination as * and choose all protocols in protocols section. Click on Add.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/fiewall5.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="633" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/fiewall5.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/fiewall5.png 1000w, https://blog.mevi.tech/content/images/2024/01/fiewall5.png 1366w" sizes="(min-width: 720px) 720px"></figure><p>Click on Review+create and create the policy.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/firewall7-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="631" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/firewall7-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/firewall7-1.png 1000w, https://blog.mevi.tech/content/images/2024/01/firewall7-1.png 1366w" sizes="(min-width: 720px) 720px"></figure><h3 id="associate-virtual-hub-with-firewall-policy">Associate Virtual Hub with Firewall Policy</h3><p>We need to associate the created policy to the Virtual Hub. For that click on Azure Firewall Policies and choose the newly created policy. Click on Manage associations and click Associate hubs.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/firewall8-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="592" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/firewall8-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/firewall8-1.png 1000w, https://blog.mevi.tech/content/images/2024/01/firewall8-1.png 1366w" sizes="(min-width: 720px) 720px"></figure><p>Select the hub that we created previously and click on Add.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/firewall9-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="571" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/firewall9-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/firewall9-1.png 1000w, https://blog.mevi.tech/content/images/2024/01/firewall9-1.png 1366w" sizes="(min-width: 720px) 720px"></figure><h3 id="update-routing-intent-routing-policies">Update Routing Intent &amp; Routing Policies</h3><p>Visit Virtual WAN console and click on Hubs.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/rt1-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="575" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/rt1-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/rt1-1.png 1000w, https://blog.mevi.tech/content/images/2024/01/rt1-1.png 1366w" sizes="(min-width: 720px) 720px"></figure><p>Click on the previously created Hub.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/rt2.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="573" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/rt2.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/rt2.png 1000w, https://blog.mevi.tech/content/images/2024/01/rt2.png 1366w" sizes="(min-width: 720px) 720px"></figure><p>Click on Routing intent and Routing Policies from the left side menu. Choose internet traffic as Azure Firewall and Next Hop Resource as the Virtual Hub that is created previously. Click on Save.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vwan2-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="588" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vwan2-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vwan2-1.png 1000w, https://blog.mevi.tech/content/images/2024/01/vwan2-1.png 1366w" sizes="(min-width: 720px) 720px"></figure><h3 id="update-route-tables">Update Route Tables</h3><p>Click on Route Tables from the left side menu. Click on the Default Route Table. </p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/rt3.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="591" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/rt3.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/rt3.png 1000w, https://blog.mevi.tech/content/images/2024/01/rt3.png 1366w" sizes="(min-width: 720px) 720px"></figure><p>VPN configurations are over now. To download the VPN client configurations, follow these steps.</p><h3 id="download-vpn-configuration">Download VPN Configuration</h3><p>Visit Virtual WAN console and click on User VPN configurations. Choose the User VPN configurations. Click on Download virtual WAN user VPN profile.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vwan3-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="598" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vwan3-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vwan3-1.png 1000w, https://blog.mevi.tech/content/images/2024/01/vwan3-1.png 1366w" sizes="(min-width: 720px) 720px"></figure><p>Choose Authentication type and click on Generate and download profile.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vwan4-1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1366" height="590" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vwan4-1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vwan4-1.png 1000w, https://blog.mevi.tech/content/images/2024/01/vwan4-1.png 1366w" sizes="(min-width: 720px) 720px"></figure><h3 id="modify-vpn-configuration">Modify VPN Configuration</h3><p>In Windows, VPN won&apos;t work properly with route 0.0.0.0/0. We need to add routes 0.0.0.0/1 and 128.0.0.0/1 in the vpnconfig xml file.</p><p>Unzip the downloaded file and navigate to AzureVPN folder.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/image.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="822" height="74" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/image.png 600w, https://blog.mevi.tech/content/images/2024/01/image.png 822w" sizes="(min-width: 720px) 720px"></figure><p>Open the file using any text editor. Check whether there are routes and DNS added or not. If they are not added, you need to update it manually.</p><p>Find and remove  remove the line</p><pre><code class="language-XML">  &lt;clientconfig i:nil=&quot;true&quot; /&gt;</code></pre><p>Add the following configurations after &lt;/clientauth&gt;</p><pre><code class="language-XML">&lt;clientconfig&gt;
    &lt;includeroutes&gt;
        &lt;route&gt;
            &lt;destination&gt;0.0.0.0&lt;/destination&gt;&lt;mask&gt;1&lt;/mask&gt;
        &lt;/route&gt;
        &lt;route&gt;
             &lt;destination&gt;128.0.0.0&lt;/destination&gt;&lt;mask&gt;1&lt;/mask&gt;
        &lt;/route&gt;
    &lt;/includeroutes&gt;
&lt;/clientconfig&gt;</code></pre><p>Save the xml file.</p><h3 id="vpn-client-setupapple-macos">VPN Client Setup - Apple macOS</h3><p>To connect to the VPN from the client macOs machine, following are the steps.</p><p>Find Azure VPN client in App Store</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vpnclient1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="2000" height="1092" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vpnclient1.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vpnclient1.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2024/01/vpnclient1.png 1600w, https://blog.mevi.tech/content/images/2024/01/vpnclient1.png 2190w" sizes="(min-width: 720px) 720px"></figure><p>Once installed, open the application.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vpnclient2.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1404" height="1210" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vpnclient2.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vpnclient2.png 1000w, https://blog.mevi.tech/content/images/2024/01/vpnclient2.png 1404w" sizes="(min-width: 720px) 720px"></figure><p>Click on Import to import VPN xml file that we downloaded. Choose the xml file and click Open.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vpnclient3.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1594" height="1222" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vpnclient3.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vpnclient3.png 1000w, https://blog.mevi.tech/content/images/2024/01/vpnclient3.png 1594w" sizes="(min-width: 720px) 720px"></figure><p>Click on Save.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vpnclien4.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1406" height="1215" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vpnclien4.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vpnclien4.png 1000w, https://blog.mevi.tech/content/images/2024/01/vpnclien4.png 1406w" sizes="(min-width: 720px) 720px"></figure><p>Click on Allow if  &quot;Azure VPN Client&quot; Would Like to Add VPN Configurations comes. Click on Connect.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vpnclient5.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1400" height="1211" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vpnclient5.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vpnclient5.png 1000w, https://blog.mevi.tech/content/images/2024/01/vpnclient5.png 1400w" sizes="(min-width: 720px) 720px"></figure><p>Verify the access to VNet and Internet resources.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/vpnclient6.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1390" height="1207" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/vpnclient6.png 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/vpnclient6.png 1000w, https://blog.mevi.tech/content/images/2024/01/vpnclient6.png 1390w" sizes="(min-width: 720px) 720px"></figure><h3 id="vpn-client-setupmicrosoft-windows">VPN Client Setup - Microsoft Windows</h3><p>To connect to the VPN from the client Windows 11 machine, following are the steps.</p><p>Find Azure VPN Client from Microsoft Store.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/windowsvpn1.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="798" height="685" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/windowsvpn1.png 600w, https://blog.mevi.tech/content/images/2024/01/windowsvpn1.png 798w" sizes="(min-width: 720px) 720px"></figure><p>Once installed, open the application. Click on Import to import VPN xml file that we downloaded. Choose the xml file and click Open.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/windowsvpn2.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="797" height="627" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/windowsvpn2.png 600w, https://blog.mevi.tech/content/images/2024/01/windowsvpn2.png 797w" sizes="(min-width: 720px) 720px"></figure><p>Click on Save.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/windowsvpn3.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="803" height="628" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/windowsvpn3.png 600w, https://blog.mevi.tech/content/images/2024/01/windowsvpn3.png 803w" sizes="(min-width: 720px) 720px"></figure><p>Click on Connect.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/windowsvpn4.png" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="800" height="629" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/windowsvpn4.png 600w, https://blog.mevi.tech/content/images/2024/01/windowsvpn4.png 800w" sizes="(min-width: 720px) 720px"></figure><p>Verify the access to VNet and Internet resources.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2024/01/windowsvpnconnected.jpeg" class="kg-image" alt="Setup Azure Virtual WAN - P2S OpenVPN with AD Integration" loading="lazy" width="1205" height="932" srcset="https://blog.mevi.tech/content/images/size/w600/2024/01/windowsvpnconnected.jpeg 600w, https://blog.mevi.tech/content/images/size/w1000/2024/01/windowsvpnconnected.jpeg 1000w, https://blog.mevi.tech/content/images/2024/01/windowsvpnconnected.jpeg 1205w" sizes="(min-width: 720px) 720px"></figure>]]></content:encoded></item><item><title><![CDATA[Set up Zabbix Server on Amazon Linux 2 ARM EC2 Instance]]></title><description><![CDATA[Zabbix Server on Amazon Linux 2 ARM EC2]]></description><link>https://blog.mevi.tech/set-up-zabbix-server-on-amazon-linux-2-arm-ec2-instance/</link><guid isPermaLink="false">64a6a3f2417b5a000172611e</guid><category><![CDATA[Amazon Linux 2]]></category><category><![CDATA[Amazon web services]]></category><category><![CDATA[zabbix]]></category><category><![CDATA[EC2]]></category><dc:creator><![CDATA[Ananthram]]></dc:creator><pubDate>Thu, 06 Jul 2023 12:08:42 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2023/07/zabbix-al2.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2023/07/zabbix-al2.png" alt="Set up Zabbix Server on Amazon Linux 2 ARM EC2 Instance"><p></p>
<p>In this blog, we will be installing Zabbix Server, Zabbix UI in Amazon Linux 2 arm64 instance. As of now there is no Zabbix package(rpm package) available for arm64 RHEL based OS. The only option is to build zabbix from source.</p>
<p>Launch an Amazon Linux 2 arm64 instance. In this case, I&#x2019;m launching a t4g.small instance.</p>
<p>Depending on the number of hosts and requests, you may modify the instance type, include RDS instance if necessary, etc.</p>
<p>SSH in to the EC2 instance and issue the following commands to create Zabbix user and group.</p>
<pre><code>sudo groupadd --system zabbix
sudo useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c &quot;Zabbix Monitoring System&quot; zabbix</code></pre>
<p>Create a directory for zabbix source build</p>
<pre><code>sudo mkdir -m u=rwx,g=rwx,o= -p /usr/lib/zabbix</code></pre>
<p>Download latest available version of Zabbix source from Zabbix&apos;s official repository</p>
<pre><code>https://cdn.zabbix.com/zabbix/sources/stable/</code></pre>
<p>In this case we are dowloading Zabbix 6.0 LTS. If you want to setup Zabbix 6.0, run below commands. Else modify the URL.</p>
<pre><code>wget https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.5.tar.gz -O /tmp/zabbix-6.0.5.tar.gz
tar -xvf /tmp/zabbix-6.0.5.tar.gz -C /tmp
sudo mv /tmp/zabbix-6.0.5/* /usr/lib/zabbix</code></pre>
<p>Modify the ownership of the source files copied to /usr/lib/zabbix</p>
<pre><code>sudo chown -R zabbix:zabbix /usr/lib/zabbix</code></pre>
<p>Now we need to install MariaDB Server in the EC2 instance. If you would like to setup an RDS instance instead of this, skip this step.</p>
<pre><code>sudo amazon-linux-extras install mariadb10.5=latest -y</code></pre>
<p>Start and enable MariaDB Server.</p>
<pre><code>sudo systemctl start mariadb
sudo systemctl enable mariadb</code></pre>
<p>Set root password for MariaDB Server by issuing the below command. Provide a secure password and skip all other settings if you are not aware of it.</p>
<pre><code>sudo mysql_secure_installation</code></pre>
<p>Login to MariaDB server.</p>
<pre><code>mysql -uroot -p</code></pre>
<p>Create a database and user for Zabbix Server.</p>
<pre><code>create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user &apos;zabbix&apos;@&apos;localhost&apos; identified by &apos;PASSWORD&apos;;
grant all privileges on zabbix.* to &apos;zabbix&apos;@&apos;localhost&apos;;</code></pre>
<p>Restore Zabbix Server schema to the database.</p>
<pre><code>mysql -uroot -p zabbix &lt;/usr/lib/zabbix/databases/mysql/schema.sql
mysql -uroot -p zabbix &lt;/usr/lib/zabbix/databases/mysql/images.sql
mysql -uroot -p zabbix &lt;/usr/lib/zabbix/databases/mysql/data.sql</code></pre>
<p>Install the necessary packages to build Zabbix Server.</p>
<pre><code>sudo yum group install &quot;Development Tools&quot; -y
sudo yum install pcre-devel.aarch64 libevent-devel.aarch64 glibc-static.aarch64 zlib-devel.aarch64 OpenIPMI ipmitool libssh2-devel.aarch64 fping libcurl-devel.aarch64 libxml2-devel.aarch64 net-snmp gnutls gcc automake autoconf OpenIPMI-devel mariadb-devel net-snmp-devel </code></pre>
<p>Install the necessary packages to build Zabbix UI.</p>
<pre><code>sudo amazon-linux-extras install php7.2 -y
sudo yum install php-gd php-bcmath php-ctype php-libXML php-xmlreader php-xmlwriter php-session php-sockets  php-mbstring  php-gettext php-ldap php-openssl php-mysqli php-oci8 php-mbstring go </code></pre>
<p>Here we are installing Apache as web server for Zabbix UI. Install and enable the service.</p>
<pre><code>sudo yum install httpd
sudo systemctl start httpd &amp;&amp; systemctl enable httpd</code></pre>
<p>It&apos;s time to build Zabbix from the source. In the following configuration file add DBName, DBUser, DBPassword and save the file.</p>
<pre><code>sudo vim /usr/lib/zabbix/conf/zabbix_server.conf</code></pre>
<p>Build Zabbix by issuing the following commands.</p>
<pre><code>sudo /usr/lib/zabbix/configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi
sudo make install</code></pre>
<p>After the build is successful, create a systemd service for Zabbix server. Add the following lines in /etc/systemd/system/zabbix-server.service.</p>
<pre><code>[Unit]
Description=Zabbix Server
After=syslog.target network.target mariadb.service
 
[Service]
Type=oneshot
User=zabbix
ExecStart=/usr/local/sbin/zabbix_server
ExecReload=/usr/local/sbin/zabbix_server -R config_cache_reload
RemainAfterExit=yes
PIDFile=/var/run/zabbix/zabbix_server.pid

[Install]
WantedBy=multi-user.target</code></pre>
<p>Reload the newly created systemd file. </p>
<pre><code>sudo systemctl daemon-reload</code></pre>
<p>Start and enable Zabbix Service</p>
<pre><code>sudo systemctl start zabbix-server.service &amp;&amp; sudo systemctl enable zabbix-server.service</code></pre>
<p>Now deploy Zabbix UI</p>
<pre><code>sudo mkdir /var/www/html/zabbix
sudo cp -r /usr/lib/zabbix/ui/* /var/www/html/zabbix
sudo chown -R apache:apache /var/www/html/zabbix</code></pre>
<p>Restart php-fpm and apache to complete the deployment</p>
<pre><code>sudo systemctl restart php-fpm
sudo systemctl restart httpd</code></pre>
<p>Zabbix server setup is now complete. You can now access your Zabbix UI from http://IP_ADDRESS/zabbix</p>
<p>If you receive connection timeout error from the browser, please check your instance&apos;s security group and confirm whether 80 port is open to your IP address or not.</p>]]></content:encoded></item><item><title><![CDATA[AWS Nitro System]]></title><description><![CDATA[If you want to know more about AWS Nitro System read this blog.]]></description><link>https://blog.mevi.tech/aws-nitro-system/</link><guid isPermaLink="false">649d0cc248a0030001b0655e</guid><category><![CDATA[Amazon web services]]></category><category><![CDATA[cloud]]></category><category><![CDATA[nitro]]></category><category><![CDATA[AWS]]></category><category><![CDATA[EC2]]></category><category><![CDATA[virtualization]]></category><category><![CDATA[security]]></category><dc:creator><![CDATA[Jisna C John]]></dc:creator><pubDate>Mon, 03 Jul 2023 12:48:04 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2023/07/fl22613353925-image-kp4w1lpp.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2023/07/fl22613353925-image-kp4w1lpp.jpg" alt="AWS Nitro System"><p><strong>Why AWS Nitro System ?</strong></p><p>Before the invention of the AWS Nitro system, there were several challenges and limitations that users faced in the realm of cloud computing. Major issues are ,</p><!--kg-card-begin: markdown--><ul>
<li>Traditional virtualization technologies used in cloud computing often suffered from limited hardware utilization.</li>
<li>The hypervisor layer introduced performance overhead due to the additional processing required for virtualization.</li>
<li>Traditional virtualization architectures often had shared networking and storage resources, which could become bottlenecks when multiple VMs competed for these resources and this leads to network and storage performance.</li>
<li>Traditional virtualization approaches creates some security risks, as any vulnerabilities in the hypervisor could potentially compromise all the VMs running on the server.</li>
</ul>
<!--kg-card-end: markdown--><p>Many of these issues were resolved with the advent of the AWS Nitro system, which offloaded a number of virtualisation operations to Specialised hardware accelerators. This made it possible for resource allocation in AWS cloud instances to be done more effectively while also enhancing security and speed.</p><p><strong>What is AWS Nitro System?</strong></p><p>AWS introduced nitro system to learn more about the underlying architecture of an EC2 instances at the virtualisation level. It was introduced in 2017 as a part of continuous innovation of AWS. Initially it was introduced in C5 instance types. The nitro system essentially is the platform that powers the latest and greatest of the next generation EC2 instance types and it effectively operates as a cluster of components. It was launched back in 2017, and all-new instance types since then have been using the AWS Nitro System.</p><p>Since Nitro is only used by AWS, it is actually a combination of many parts that uses both custom hardware and software. In addition to being able to satisfy the demands of their customers, it was created to enable AWS to accelerate their rate of innovation. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2023/07/Nitro_architecture.drawio.png" class="kg-image" alt="AWS Nitro System" loading="lazy" width="602" height="333" srcset="https://blog.mevi.tech/content/images/size/w600/2023/07/Nitro_architecture.drawio.png 600w, https://blog.mevi.tech/content/images/2023/07/Nitro_architecture.drawio.png 602w"><figcaption>Fig 1 : Architecture of Nitro System</figcaption></figure><p><strong>Components of Nitro System</strong></p><!--kg-card-begin: markdown--><ol>
<li>Nitro cards</li>
</ol>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2023/07/Screenshot-from-2023-07-03-16-22-09.png" class="kg-image" alt="AWS Nitro System" loading="lazy" width="103" height="76"><figcaption>Fig 2 : Nitro Cards</figcaption></figure><p>AWS Nitro Cards, also known as AWS Nitro Acceleration Cards, are specialized hardware components developed by Amazon Web Services (AWS) as part of their Nitro system architecture. These cards are designed to offload specific tasks related to virtualization, networking, and storage, thereby improving the performance, security, and efficiency of AWS EC2 instances. There are 4 different type of nitro cards,</p><!--kg-card-begin: markdown--><ul>
<li>VPC Networking Nitro card</li>
<li>EBS Nitro Card</li>
<li>Instance Storage Nitro card</li>
<li>Nitro Card controller, or systems controller card</li>
</ul>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><ol start="2">
<li>Nitro Security Chips</li>
</ol>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2023/07/Screenshot-from-2023-07-03-16-22-19.png" class="kg-image" alt="AWS Nitro System" loading="lazy" width="94" height="85"><figcaption>Fig 3 : Nitro Security Chips</figcaption></figure><p>The Nitro Security Chip, the second essential part of the Nitro System, is a unique micro-controller that is physically affixed to the host&apos;s motherboard and is used to safeguard hardware resources and enforce the hardware root of trust.The chip itself can only be manipulated and written to by the Nitro card controller, not an instance, and it traps all I/O to non-volatile storage, stores system boot information to enable measurement and validation checks, and traps all I/O to non-volatile storage. &#xA0;The security chip also needs to make sure that all hardware interfaces are being watched.</p><!--kg-card-begin: markdown--><ol start="3">
<li>Nitro Hypervisor</li>
</ol>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2023/07/Screenshot-from-2023-07-03-16-22-40.png" class="kg-image" alt="AWS Nitro System" loading="lazy" width="112" height="97"><figcaption>Fig 4 : Nitro Hypervisor</figcaption></figure><p>The Nitro Hypervisor which is KVM-based, and is the last key component of the Nitro system. The amount of work the data plane covers and controls, as well as the fact that they take on many of the virtualization responsibilities that a traditional hypervisor would typically handle, are two major advantages of these Nitro cards that I have just described. &#xA0;AWS has been able to reduce the Nitro hypervisor to its essential elements, leaving only features and components that are absolutely necessary thanks to the transfer of responsibility to the Nitro cards. &#xA0;As a result, the Nitro hypervisor is never active unless an instance requests it to act on the instance&apos;s behalf. As a result, the Hypervisor was created specifically for AWS for the Nitro system, and the work offloading to the Nitro cards has made the Nitro system more efficient.</p><p><strong>Benefits of AWS System</strong></p><p>The AWS Nitro system, which includes AWS Nitro Cards, provides several benefits for users of Amazon Web Services (AWS) EC2 instances. Some of the key benefits of AWS Nitro System are:</p><!--kg-card-begin: markdown--><ul>
<li>Enhanced Performance</li>
<li>Improved Security</li>
<li>Efficient Resource Utilization</li>
<li>Enhanced Network Performance</li>
<li>Accelerated Storage</li>
<li>Simplified Maintenance and Updates</li>
<li>Scalability and Agility</li>
</ul>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Install MySQL 8 server and client on Amazon Linux 2 Arm and x86_64]]></title><description><![CDATA[Install MySQL 8 server and client on Amazon Linux 2 aarch64 and x86_64]]></description><link>https://blog.mevi.tech/install-mysql-8-client-on-amazon-linux-2-arm-and-x86_64/</link><guid isPermaLink="false">63bf8f55a97dcb0001f136d2</guid><category><![CDATA[Amazon Linux 2]]></category><category><![CDATA[AWS]]></category><category><![CDATA[MySQL]]></category><category><![CDATA[Installation]]></category><category><![CDATA[AL2]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Thu, 12 Jan 2023 04:48:16 GMT</pubDate><content:encoded><![CDATA[<h3 id="install-the-epel-repo">Install the epel repo</h3><pre><code>sudo amazon-linux-extras install epel -y</code></pre><h3 id="install-the-mysql-community-repo">Install the MySQL Community repo</h3><pre><code>sudo yum install https://repo.mysql.com/mysql80-community-release-el7-5.noarch.rpm</code></pre><h3 id="install-the-mysql-8-server">Install the MySQL 8 server</h3><p>This will automatically install the client</p><pre><code>sudo yum install mysql-community-server</code></pre><h3 id="install-the-mysql-8-client">Install the MySQL 8 client</h3><p>This command will directly install the client without installing the server</p><pre><code>sudo yum install mysql-community-client</code></pre>]]></content:encoded></item><item><title><![CDATA[Taking a complete backup of Cassandra DB]]></title><description><![CDATA[Since there is no direct way to take the DB backup of entire Cassandra with all the key spaces, this blog will help.]]></description><link>https://blog.mevi.tech/taking-complete-backup-of-cassandra-db/</link><guid isPermaLink="false">62b00ec6f7c8ae0001d3678b</guid><category><![CDATA[Cassandra]]></category><category><![CDATA[backup]]></category><category><![CDATA[bash]]></category><category><![CDATA[Database]]></category><category><![CDATA[CSV]]></category><category><![CDATA[Apache Cassandra]]></category><category><![CDATA[NoSQL]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Mon, 20 Jun 2022 06:18:53 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2022/06/Apache_Cassandra-Logo.wine.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2022/06/Apache_Cassandra-Logo.wine.png" alt="Taking a complete backup of Cassandra DB"><p>Cassandra by default provides a way to take backups of individual keyspaces with the following command.</p><pre><code>COPY table_name to &apos;table_name.csv&apos; WITH HEADER=TRUE</code></pre><p>Doing this for for an entire Cassandra cluster with multiple keyspaces (tables) will be difficult. Following set of commands can make this easier for you</p><p>First, create a folder to store the backup CSV files</p><pre><code>mkdir cassandrabkp</code></pre><p>cd into the folder</p><pre><code>cd cassandrabkp</code></pre><p>Assuming that you are using bash, and you have installed cqlsh and sed, the following command will find the tables and use them one by one to create a backup CSV file for each keyspace.</p><pre><code>for i in $(cqlsh 192.168.134.132 -e &quot;DESCRIBE SCHEMA&quot; | grep &quot;TABLE&quot; | sed &apos;s/CREATE TABLE //g&apos; | sed &apos;s/ (//g&apos;) ; do echo &quot;cqlsh 192.168.134.132 -e \&quot;COPY $i to &apos;$i.csv&apos; WITH HEADER=TRUE\&quot;&quot;;done | bash</code></pre><p>The above process will take some time depending on the size.</p><p>Now you can cd out of the folder and then compress it to save space. Since it is just texts, from my experience, you can compress a 13GB backup folder to 2.5GB</p><pre><code>cd ..

tar -cvzf cassandrabkp.tar.gz cassandrabkp/</code></pre><p>You can extract it later with the following command</p><pre><code>tar -xvzf cassandrabkp.tar.gz</code></pre>]]></content:encoded></item><item><title><![CDATA[Installing Cocoapods in M1 Mac]]></title><description><![CDATA[Install brew and Cocoapods in M1 Mac]]></description><link>https://blog.mevi.tech/installing-cocoapods-in-m1-mac/</link><guid isPermaLink="false">6298f0db3e27fe0001162ddc</guid><category><![CDATA[Mac]]></category><category><![CDATA[Cocoapods]]></category><category><![CDATA[M1]]></category><category><![CDATA[Apple]]></category><category><![CDATA[Home Brew]]></category><category><![CDATA[brew]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Thu, 02 Jun 2022 17:26:13 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2022/06/cocoapodslogo.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2022/06/cocoapodslogo.png" alt="Installing Cocoapods in M1 Mac"><p>Previously Cocoapods in mac was installed using gem</p><pre><code>sudo gem install cocoapods</code></pre><p>This now throws errors when running pod install. To fix this, uninstall the Cocoapods installed using gem with the following command</p><pre><code>sudo gem uninstall cocoapods</code></pre><p>Now install cocoapods using home brew with the following command</p><pre><code>brew install cocoapods</code></pre><p>If you see the error &apos;command not found&apos; when you run the above command, you can install brew with the following command and follow the on screen instructions to enter the password when required</p><pre><code>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&quot;</code></pre><p>You should now run the following command to add brew to your PATH</p><pre><code>echo &apos;eval &quot;$(/opt/homebrew/bin/brew shellenv)&quot;&apos; &gt;&gt; /Users/vignesh/.zprofile</code></pre><p>Make sure to change &apos;vignesh&apos; to your user name</p><p>To load the new PATH, run the following command</p><pre><code>eval &quot;$(/opt/homebrew/bin/brew shellenv)&quot;</code></pre><p>That&apos;s it! You should have Cocoapods running on your M1 Mac.</p>]]></content:encoded></item><item><title><![CDATA[Enforcing a good password policy on Amazon Linux 2]]></title><description><![CDATA[Set a good password policy on Amazon Linux 2]]></description><link>https://blog.mevi.tech/enforcing-a-good-password-policy-on-amazon-linux-2/</link><guid isPermaLink="false">626baa05ac85e20001bae5a1</guid><category><![CDATA[Amazon Linux 2]]></category><category><![CDATA[Amazon web services]]></category><category><![CDATA[security]]></category><category><![CDATA[password]]></category><category><![CDATA[Password policy]]></category><category><![CDATA[authconfig]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Sun, 01 May 2022 09:26:00 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2022/04/lock-4573711_1280.webp" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2022/04/lock-4573711_1280.webp" alt="Enforcing a good password policy on Amazon Linux 2"><p>Using a good password is one of the first steps to a better security practice. The most easiest way to ensure that the users use the best password is to enforce it at the system level.</p><p>Following is the command that you can use to ensure that your Amazon Linux 2 server uses a standard password policy.</p><h3 id="password-policy">Password policy</h3><!--kg-card-begin: markdown--><table>
<thead>
<tr>
<th>Policy</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Character set</td>
<td>Alphanumeric characters, special symbols, or a combination of all three</td>
</tr>
<tr>
<td>Password length</td>
<td>14 characters or more</td>
</tr>
<tr>
<td>Password expiry</td>
<td>None</td>
</tr>
<tr>
<td>Password reuse</td>
<td>None</td>
</tr>
<tr>
<td>Account lock</td>
<td>Account will be locked for 30 minutes after 6 failed login attempts</td>
</tr>
</tbody>
</table>
<!--kg-card-end: markdown--><h3 id="command">Command</h3><p>The following command will set the above password policy on the server.</p><pre><code>sudo authconfig --passminlen=14 --enablefaillock --faillockargs=&quot;deny=6 unlock_time=1800&quot; --passminclass=4 --update</code></pre><h3 id="verification">Verification</h3><p>You can verify that the above password policy is implemented by checking the system-auth configuration file. Please note that changing this file directly will not be persistent since the changes will be reverted when the authconfig command is run again with a different configuration.</p><pre><code>cat /etc/pam.d/system-auth</code></pre><pre><code>#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required      pam_faildelay.so delay=2000000
auth        required      pam_faillock.so preauth silent deny=6 unlock_time=1800
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid &gt;= 1000 quiet_success
auth        required      pam_faillock.so authfail deny=6 unlock_time=1800
auth        required      pam_deny.so

account     required      pam_faillock.so
account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid &lt; 1000 quiet
account     required      pam_permit.so

password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so</code></pre><h3 id="references">References</h3><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.linuxtechi.com/enforce-password-policies-linux-ubuntu-centos/?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">How to Enforce Password Policies in Linux (Ubuntu / CentOS)</div><div class="kg-bookmark-description">In this guide we will learn how to enforce password policies in Linux based operating systems like CentOS, RHEL, Ubuntu and Debian.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.linuxtechi.com/wp-content/uploads/2020/02/cropped-linuxtechi-favicon-270x270.png" alt="Enforcing a good password policy on Amazon Linux 2"><span class="kg-bookmark-author">LinuxTechi |</span><span class="kg-bookmark-publisher">James Kiarie</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.linuxtechi.com/wp-content/uploads/2020/08/Enforce-password-policies-linux.png" alt="Enforcing a good password policy on Amazon Linux 2"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://linux.die.net/man/8/authconfig?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">authconfig(8) - Linux man page</div><div class="kg-bookmark-description">authconfig provides a simple method of configuring /etc/sysconfig/network to handle NIS, as well as /etc/passwd and /etc/shadow, the files used for shadow password support.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://linux.die.net/favicon.ico" alt="Enforcing a good password policy on Amazon Linux 2"><span class="kg-bookmark-author">Linux man page</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://linux.die.net/style/logo.svg" alt="Enforcing a good password policy on Amazon Linux 2"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.linuxtechi.com/lock-user-account-incorrect-login-attempts-linux/?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Lock User Account After n Failed Login attempts in Linux</div><div class="kg-bookmark-description">Learn how to lock user accounts automatically after n incorrect or failed login attempts in Linux distributions like CentOS, RHEL, Fedora, Debian and Ubuntu.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.linuxtechi.com/wp-content/uploads/2020/02/cropped-linuxtechi-favicon-270x270.png" alt="Enforcing a good password policy on Amazon Linux 2"><span class="kg-bookmark-author">LinuxTechi |</span><span class="kg-bookmark-publisher">Pradeep Kumar</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.linuxtechi.com/wp-content/uploads/2019/12/Lock-User-Account-CentOS-Debian.jpg" alt="Enforcing a good password policy on Amazon Linux 2"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://access.redhat.com/solutions/4175751?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">How to enable faillock using authconfig - Red Hat Customer Portal</div><div class="kg-bookmark-description">Executing authconfig command removes the faillock entries from PAM files. Configure faillock for persistent settings in PAM files.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://access.redhat.com/webassets/avalon/g/favicon.ico" alt="Enforcing a good password policy on Amazon Linux 2"><span class="kg-bookmark-author">Red Hat Customer Portal</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://access.redhat.com/webassets/avalon/g/shadowman-200.png" alt="Enforcing a good password policy on Amazon Linux 2"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.server-world.info/en/note?os=CentOS_7&amp;p=password&amp;ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">CentOS 7 : Set Password Rules : Server World</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.server-world.info/bin/count/count.cgi?1" alt="Enforcing a good password policy on Amazon Linux 2"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://serverfault.com/questions/936760/how-to-set-password-complexity-in-redhat-7-5?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">How to set password complexity in redhat 7.5?</div><div class="kg-bookmark-description">I am trying to set a password policy complexity on red-hat 7.5.i want that every user that will try to change his password will have to use password with at least - (1 Lower , 1 Upper , 1 Digit , 1</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://cdn.sstatic.net/Sites/serverfault/Img/apple-touch-icon.png?v=6c3100d858bb" alt="Enforcing a good password policy on Amazon Linux 2"><span class="kg-bookmark-author">Server Fault</span><span class="kg-bookmark-publisher">ChinChen</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://cdn.sstatic.net/Sites/serverfault/Img/apple-touch-icon@2.png?v=9b1f48ae296b" alt="Enforcing a good password policy on Amazon Linux 2"></div></a></figure>]]></content:encoded></item><item><title><![CDATA[Setting up Google Authenticator MFA on Amazon Linux 2]]></title><description><![CDATA[Set up a Google Authenticator based TOTP MFA for your Amazon Linux 2 server.]]></description><link>https://blog.mevi.tech/setting-up-google-authenticator-mfa-on-amazon-linux-2/</link><guid isPermaLink="false">626b7a4fac85e20001bae4e8</guid><category><![CDATA[Amazon web services]]></category><category><![CDATA[EC2]]></category><category><![CDATA[Google Authenticator]]></category><category><![CDATA[Amazon Linux 2]]></category><category><![CDATA[AL2]]></category><category><![CDATA[MFA]]></category><category><![CDATA[Multi Factor Authentication]]></category><category><![CDATA[PAM module]]></category><category><![CDATA[SSH]]></category><category><![CDATA[security]]></category><category><![CDATA[Authentication]]></category><category><![CDATA[Server]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Fri, 29 Apr 2022 06:06:26 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2022/04/authec2-1.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2022/04/authec2-1.png" alt="Setting up Google Authenticator MFA on Amazon Linux 2"><p>Sometimes, the data in your servers are so valuable that having ssh key with passphrase, IP restrictions and sudo password all together won&apos;t just cut it for your organisation&apos;s security policy.</p><p>In this case, you&apos;ll have to set up MFA for your server, and following are the steps.</p><p>Here I am setting a Google Authenticator based MFA for Amazon Linux 2 in addition to a password based authentication for the user. You can use key based authentication also with small changes in configuration.</p><h3 id="installation-of-google-authenticator">Installation of Google Authenticator</h3><p>First, enable the epel repo in AL2</p><pre><code>sudo amazon-linux-extras install epel -y</code></pre><p>Now you can install the google-authenticator package</p><pre><code>sudo yum install google-authenticator -y</code></pre><h3 id="creating-mfa">Creating MFA</h3><p>Now run the google-authenticator command and give the following responses</p><pre><code>[ec2-user@vm_al2 ~]$ google-authenticator 

Do you want authentication tokens to be time-based (y/n) y
Warning: pasting the following URL into your browser exposes the OTP secret to Google:
  https://www.google.com/chart?chs=200x200&amp;chld=M|0&amp;cht=qr&amp;chl=otpauth://totp/ec2-user@vm_al2%3Fsecret%3DKPPS2C44OQMUYKQCNEG45SVIL4%26issuer%3Dvm_al2

</code></pre><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2022/04/Screenshot-from-2022-04-29-11-18-44.png" class="kg-image" alt="Setting up Google Authenticator MFA on Amazon Linux 2" loading="lazy" width="741" height="744" srcset="https://blog.mevi.tech/content/images/size/w600/2022/04/Screenshot-from-2022-04-29-11-18-44.png 600w, https://blog.mevi.tech/content/images/2022/04/Screenshot-from-2022-04-29-11-18-44.png 741w" sizes="(min-width: 720px) 720px"><figcaption>QR code for scanning with the Google Authenticator app will be shown in the terminal</figcaption></figure><pre><code>Your new secret key is: KPPS2C44OQMUYKQCNEG45SVIL4
Your verification code is 061304
Your emergency scratch codes are:
  53063172
  99973171
  81062482
  92606712
  26718859

Do you want me to update your &quot;/home/ec2-user/.google_authenticator&quot; file? (y/n) y

Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) y

By default, a new token is generated every 30 seconds by the mobile app.
In order to compensate for possible time-skew between the client and the server,
we allow an extra token before and after the current time. This allows for a
time skew of up to 30 seconds between authentication server and client. If you
experience problems with poor time synchronization, you can increase the window
from its default size of 3 permitted codes (one previous code, the current
code, the next code) to 17 permitted codes (the 8 previous codes, the current
code, and the 8 next codes). This will permit for a time skew of up to 4 minutes
between client and server.
Do you want to do so? (y/n) n

If the computer that you are logging into isn&apos;t hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting? (y/n) y</code></pre><h3 id="configuring-the-server-to-use-mfa">Configuring the server to use MFA</h3><p>Now configure the PAM module to use Google Authenticator while logging in</p><pre><code>sudo vim /etc/pam.d/sshd</code></pre><p>Edit the file to include the following line</p><pre><code>auth required pam_google_authenticator.so nullok</code></pre><p>The <strong>nullok</strong> allows the users without MFA configured to login without MFA. Only the users with MFA will be asked for an MFA. This can be removed once all the users in the server has set the MFA.</p><p>Now edit the sshd configuration to as for the OTP challenge</p><pre><code>sudo vim /etc/ssh/sshd_config</code></pre><p>Edit the configuration to change the <strong>ChallengeResponseAuthentication</strong> to yes</p><pre><code>ChallengeResponseAuthentication yes</code></pre><p>Since I&apos;m configuring this for password authentication only and not ssh key authentication, my sshd_config file has <strong>PasswordAuthentication yes</strong> instead of the default <strong>PasswordAuthentication no</strong></p><p>Now you can restart the sshd process</p><pre><code>sudo systemctl restart sshd</code></pre><h3 id="conclusion">Conclusion</h3><p>That&apos;s it, you can login with the MFA to your server</p><pre><code>vignesh@workstation:~$ ssh ec2-user@192.168.122.125
Password: 
Verification code: 
Last login: Fri Apr 29 04:59:47 2022 from 192.168.122.1

       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-2/
55 package(s) needed for security, out of 95 available
Run &quot;sudo yum update&quot; to apply all updates.
[ec2-user@vm_al2 ~]$</code></pre><p>You can also copy the .google_authenticator file from your user&apos;s home folder to your local machine to keep the key, emergency use OTPs etc. safe.</p><pre><code>[ec2-user@vm_al2 ~]$ cat .google_authenticator 
KPPS2C44OQMUYKQCNEG45SVIL4
&quot; RATE_LIMIT 3 30 1651209615
&quot; DISALLOW_REUSE 55040320
&quot; TOTP_AUTH
53063172
99973171
81062482
92606712
26718859</code></pre><p>Also if you want to use only key based authentication,</p><p>Open the pam file</p><pre><code>sudo vim /etc/pam.d/sshd</code></pre><p>and comment the following line</p><pre><code>#auth substack password-auth</code></pre><h2 id="references">References</h2><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.redhat.com/sysadmin/mfa-linux?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Setting up multi-factor authentication on Linux systems</div><div class="kg-bookmark-description">Pluggable Authentication Modules allow Linux to work with Google Authenticator and other OTP tools to add two-factor security to your system.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.redhat.com/sysadmin/themes/custom/sysadmin/assets/favicon/apple-touch-icon.png" alt="Setting up Google Authenticator MFA on Amazon Linux 2"><span class="kg-bookmark-author">Enable Sysadmin</span><span class="kg-bookmark-publisher">Keerthi Chinthaguntla</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://live-rhes.pantheonsite.io/sysadmin/sites/default/files/styles/google_discover/public/2020-07/data-1590455_1920%20Cropped.jpg?itok=s0EDIanP" alt="Setting up Google Authenticator MFA on Amazon Linux 2"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://superuser.com/questions/337694/openssh-server-how-to-configure-keyboard-interactive-authentication?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">OpenSSH server: how to configure keyboard-interactive authentication</div><div class="kg-bookmark-description">How can I configure the OpenSSH server (on Ubuntu) to allow keyboard-interactive but not password authentication? I know that public-key-authentication is the preferred one, but I want to test a u...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://cdn.sstatic.net/Sites/superuser/Img/apple-touch-icon.png?v=0ad5b7a83e49" alt="Setting up Google Authenticator MFA on Amazon Linux 2"><span class="kg-bookmark-author">Super User</span><span class="kg-bookmark-publisher">Mike L.</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://cdn.sstatic.net/Sites/superuser/Img/apple-touch-icon@2.png?v=e869e4459439" alt="Setting up Google Authenticator MFA on Amazon Linux 2"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://aws.amazon.com/blogs/startups/securing-ssh-to-amazon-ec2-linux-hosts/?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">How to Secure Your Instances with Multi-factor Authentication | Amazon Web Services</div><div class="kg-bookmark-description">An AWS Solutions Architect walks through implementing an additional layer of authentication security for your EC2 instances by requiring two-factor authentication for administrators to use SSH to connect.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://a0.awsstatic.com/main/images/site/touch-icon-ipad-144-smile.png" alt="Setting up Google Authenticator MFA on Amazon Linux 2"><span class="kg-bookmark-author">Amazon Web Services</span><span class="kg-bookmark-publisher">Roshan Kothari</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://d2908q01vomqb2.cloudfront.net/cb4e5208b4cd87268b208e49452ed6e89a68e0b8/2017/10/19/Picture5-1260x474.png" alt="Setting up Google Authenticator MFA on Amazon Linux 2"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.middlewareinventory.com/blog/aws-mfa-ssh-ec2-setup/?ref=blog.mevi.tech"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Enabling Two Factor Authentication for EC2 SSH - AWS MFA Setup</div><div class="kg-bookmark-description">AWS MFA Setup -How to Secure your SSH Authentication to EC2 instance with Google Authenticator multi factor authentication(MFA). aws ec2 ssh mfa. AWS Google auth. AWS SSH MFA Configuration. SSH Security with AWS EC2. Configure Google Authenticator in Ec2 instance and how to securely SSH into your EC&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.middlewareinventory.com/wp-content/uploads/2017/12/cropped-Screen-Shot-2017-12-22-at-12.16.54-PM-3-270x270.png" alt="Setting up Google Authenticator MFA on Amazon Linux 2"><span class="kg-bookmark-author">Middleware Inventory</span><span class="kg-bookmark-publisher">Sarav AK</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.middlewareinventory.com/wp-content/uploads/2020/02/Screenshot-2020-09-16-at-12.08.42-PM.png" alt="Setting up Google Authenticator MFA on Amazon Linux 2"></div></a></figure>]]></content:encoded></item><item><title><![CDATA[Increase the max file upload size in Wordpress]]></title><description><![CDATA[Increase the maximum file upload size in Wordpress easily when running wordpress with their official docker container.]]></description><link>https://blog.mevi.tech/increase-the-max-file-upload-size-in-wordpress/</link><guid isPermaLink="false">61ea7883ac85e20001bae41f</guid><category><![CDATA[Wordpress]]></category><category><![CDATA[Amazon web services]]></category><category><![CDATA[ECS]]></category><category><![CDATA[EFS]]></category><category><![CDATA[Fargate]]></category><category><![CDATA[file upload]]></category><category><![CDATA[Serverless]]></category><category><![CDATA[container]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Sat, 22 Jan 2022 09:24:00 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2022/01/Wordpress_Blue_logo.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2022/01/Wordpress_Blue_logo.png" alt="Increase the max file upload size in Wordpress"><p>The first problem most people face after their custom Wordpress installation is the file upload limit.</p><p>There are various ways you can use to fix it. Following is what I use and which seems to work always. I use the Wordpress docker container, so your mileage may vary if you are using manual installation.</p><h2 id="the-htaccess-method">The htaccess method</h2><p>For me, putting the following entry into the .htaccess file in the wordpress installation folder seems to fix the issue.</p><pre><code>php_value upload_max_filesize 1000M
php_value post_max_size 2000M
php_value max_execution_time 300
php_value max_input_time 300
php_value memory_limit 3000M
php_value file_uploads On</code></pre><p>I used the WP file manager and edited this file. This is fine since I had deployed it in AWS ECS Fargate with EFS storage backend and hence the file change will persist.</p><p>If you are only putting only selected folders to persistent storage instead of the entire document root, then you&apos;ll have to make this change at the image level.</p>]]></content:encoded></item><item><title><![CDATA[Configure Nginx for path based deployment of multiple apps]]></title><description><![CDATA[Usually we set up separate UI elements and API as separate domains for the ease but here we are doing the same thing based on path.]]></description><link>https://blog.mevi.tech/configure-nginx-for-path-based-deployment-of-multiple-apps/</link><guid isPermaLink="false">61e8ff5af584dc000137b72a</guid><category><![CDATA[linux]]></category><category><![CDATA[nginx]]></category><category><![CDATA[angular]]></category><category><![CDATA[react]]></category><category><![CDATA[vuejs]]></category><category><![CDATA[api]]></category><category><![CDATA[static site]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Thu, 20 Jan 2022 06:36:59 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2022/01/1_zZlWOzff-BBNC2r4dvJ0bg.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2022/01/1_zZlWOzff-BBNC2r4dvJ0bg.png" alt="Configure Nginx for path based deployment of multiple apps"><p>Recently I had a requirement where I had to deploy multiple angular/react/vue.js apps and an API to separate paths and serve it through Nginx.</p><p>Following is the configuration that I used.</p><pre><code>server{
        server_name nginxangular.vigneshn.in;

        location /api{
                proxy_pass          http://127.0.0.1:8080;
                proxy_http_version  1.1;
                proxy_set_header    Upgrade             $http_upgrade;
                proxy_set_header    Host                $host;
                proxy_set_header    X-Real-IP           $remote_addr;
                proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
	}
    location /admin {
                alias /data/app/ui/admin;
                index index.html index.htm;
                try_files $uri $uri/ /admin/index.html;
                }
    location /client {
                alias /data/app/ui/client;
                index index.html index.htm;
                try_files $uri $uri/ /client/index.html;
                }
    location /business {
                alias /data/app/ui/business;
                index index.html index.htm;
                try_files $uri $uri/ /business/index.html;
                }
    location / {
                alias /data/app/ui/common/;
                index index.html index.htm;
                try_files $uri $uri/ /index.html =404;
                }
}</code></pre><p>The admin,client,business,common are the angular deployment folders. The common folder is served from / and the rest of them are served from their appropriate paths.</p>]]></content:encoded></item><item><title><![CDATA[How to Enable Query(General Query) Log in Amazon RDS for  MySQL?]]></title><description><![CDATA[Enable General Query Log in RDS for MySQL]]></description><link>https://blog.mevi.tech/enable-general-query-log-rds/</link><guid isPermaLink="false">61978d9d185a5e0001ac4793</guid><dc:creator><![CDATA[Ananthram]]></dc:creator><pubDate>Sat, 20 Nov 2021 18:14:13 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2021/11/download.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2021/11/download.png" alt="How to Enable Query(General Query) Log in Amazon RDS for  MySQL?"><p>Ever wondered how you can watch all the queries running in the database by someone? Here&apos;s how. </p><h3 id="lets-begin">Let&apos;s Begin</h3><p>Visit RDS console and choose the RDS instance. If the RDS instance is attached to a default parameter group, you have to create a new custom parameter group from the default parameter group. </p><p>After the custom parameter group is created, attach it to the RDS instance. Expect a downtime while you replace the existing parameter group. There won&apos;t be any downtime if you modify a parameter in the existing custom parameter group.</p><h3 id="modifying-parameter-group">Modifying Parameter Group</h3><p>1.	Beginning with <strong>general_log</strong>. The default value will be disabled(0) or blank. Modify it to <strong>1</strong></p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2021/11/general.png" class="kg-image" alt="How to Enable Query(General Query) Log in Amazon RDS for  MySQL?" loading="lazy" width="1496" height="271" srcset="https://blog.mevi.tech/content/images/size/w600/2021/11/general.png 600w, https://blog.mevi.tech/content/images/size/w1000/2021/11/general.png 1000w, https://blog.mevi.tech/content/images/2021/11/general.png 1496w" sizes="(min-width: 720px) 720px"></figure><p>2.	Next parameter, <strong>log_output</strong> asks you where to save these logs, in this case I&apos;m choosing <strong>file</strong>. The logs can be watched in real time or downloaded from the RDS console.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2021/11/fike.png" class="kg-image" alt="How to Enable Query(General Query) Log in Amazon RDS for  MySQL?" loading="lazy" width="1490" height="195" srcset="https://blog.mevi.tech/content/images/size/w600/2021/11/fike.png 600w, https://blog.mevi.tech/content/images/size/w1000/2021/11/fike.png 1000w, https://blog.mevi.tech/content/images/2021/11/fike.png 1490w" sizes="(min-width: 720px) 720px"></figure><p>Click on Save Changes and wait for some time for the RDS to modify the parameter group.</p><h3 id="watching-logs">Watching Logs</h3><p>Choose Logs &amp; Events tab. Scroll down and choose the general query log from Logs section and click on either Watch or Download. </p><p>When I ran a simple query in MySQL client, RDS logs it as in the given image.</p><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2021/11/mysql.png" class="kg-image" alt="How to Enable Query(General Query) Log in Amazon RDS for  MySQL?" loading="lazy" width="282" height="73"></figure><figure class="kg-card kg-image-card"><img src="https://blog.mevi.tech/content/images/2021/11/Screenshot-from-2021-11-19-18-04-03.png" class="kg-image" alt="How to Enable Query(General Query) Log in Amazon RDS for  MySQL?" loading="lazy" width="1288" height="115" srcset="https://blog.mevi.tech/content/images/size/w600/2021/11/Screenshot-from-2021-11-19-18-04-03.png 600w, https://blog.mevi.tech/content/images/size/w1000/2021/11/Screenshot-from-2021-11-19-18-04-03.png 1000w, https://blog.mevi.tech/content/images/2021/11/Screenshot-from-2021-11-19-18-04-03.png 1288w" sizes="(min-width: 720px) 720px"></figure>]]></content:encoded></item><item><title><![CDATA[Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries]]></title><description><![CDATA[Learn how and why you should start using AWS cloudwatch Sythetics Canaries for your monitoring needs.]]></description><link>https://blog.mevi.tech/monitor-your-external-apis-with-aws-cloudwatch-synthetics-canaries/</link><guid isPermaLink="false">6165be35185a5e0001ac4444</guid><category><![CDATA[Amazon web services]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Cloudwatch]]></category><category><![CDATA[monitoring]]></category><category><![CDATA[lambda]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Wed, 03 Nov 2021 10:23:23 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2021/10/synthetic-canaries-1.png" medium="image"/><content:encoded><![CDATA[<h2 id="what-is-it">What is it?</h2><img src="https://blog.mevi.tech/content/images/2021/10/synthetic-canaries-1.png" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries"><p>One of the easiest metrics to check if your application is running is to see if it is loading properly and that all its features are working fine. There are many monitoring tools like Zabbix, Nagios, DataDog etc that allows us to do this. To add on to that and with more customisability with the usage of Lambda, the AWS cloudwatch Sythetics Canaries is an exceptional monitoring service to monitor custom APIs or websites.</p><p>AWS Synthetics Canaries actually use Lambda in the background with selenium or puppeteer scripts to do the monitoring. Previously, we had to set up a cloudwatch event, set up Lambda, write custom code for the Lambda and then the Lambda had to push the metrics or logs to cloudwatch. Synthetics Canaries simplifies this entire process and makes the configuration of API or web monitoring easy with just a coouple of clicks. </p><h2 id="why-i-used-this">Why I used this?</h2><p>I had to use this service because I had a requirement from my customer to monitor the TAT (Turn Around Time) of an external API for an application running in AWS in a VPC with external calls going through a Managed NAT. From that, I had 3 ways to do it.</p><ul><li>Zabbix web check</li><li>Zabbix user parameter</li><li>AWS Cloudwatch Synthetics Canaries</li></ul><p>I tested each of the methods and provided the pros and cons with each method and following were my findings.</p><h3 id="zabbix-web-check">Zabbix web check</h3><p>Zabbix has an option to do web check wherein we can create steps and configure the method, URL, data, headers and other parameters of an HTTP request and use that to monitor the retured response, status codes, latency etc.</p><p>One issue I found with this method is that in Zabbix, the webcheck is done from the Zabbix server itself (or proxy server if the host having the webcheck is monitored by a proxy), this means that the people running the external API has to allowlist the Zabbix server IP also which is an additional step. We also skip the route via the Managed NAT which is being used by the rest of the application servers.</p><p>So this methods was not recommended</p><h3 id="zabbix-user-parameter">Zabbix user parameter</h3><p>In this method, a custom user parameter is added to any one of the application server. User parameter is a specific custom key that can be monitored by Zabbix. This is configured in the Zabbix agent of the host which we will add the monitoring item to.</p><p>The user parameter is a custom script or command that gives the required output which can then be used directly or parsed by Zabbix.</p><p>In this case, we will be using the following curl command to get the total time or latency of the API request as a float value.</p><pre><code>curl -w &quot;%{time_total}\n&quot; -o /dev/null -s &quot;https://vigneshn.in/&quot;</code></pre><p>One advantage with this method is that the request will go through the NAT gateway since the command is run from the application server running in the VPC</p><p>The problem with this method is that the configuration for this exists in the Zabbix server and a specific application server in which that user parameter is configured. This is a problem if that application server goes down or if there is an infrastrucutre or application change that makes that server obsolete. This also will be a problem considering that running that command will use some CPU, memory and network of the application server.</p><p>So this method was also not recommended.</p><h3 id="aws-cloudwatch-synthetics-canaries">AWS Cloudwatch Synthetics Canaries</h3><p>Since both the above solutions had their own specific technical limitations, AWS Cloudwatch Synthetics Canaries was tested.</p><p>In this case, it was configured through the AWS console by entering the required API URL, data, headers etc. and it was complete. I was able to configured the VPC, Subnet, Security group etc which the backend Lambda should use and this means that the request will always go through the NAT gateway which shows the latency via NAT and also no additional IP has to be allowed in the external API.</p><p>Since this does not depend on any of the internal servers, any downtime in them will not affect the monitoring. Since two subnets were selected in different availability zones, even if an availability zone goes down, the monitoring will still work.</p><p>The only problem with this is the additonal cost associated with this, but it is negligible.</p><h2 id="how-to-set-up-the-synthetics-canaries">How to set up the Synthetics Canaries</h2><p>First open the cloudwatch dashboard and on the left bottom, there is an option named Synthetics Canaries. Clicking that will open up the Canaries page with the status dashboard. Here, click on Create canary button</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-49-27.png" class="kg-image" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries" loading="lazy" width="1863" height="848" srcset="https://blog.mevi.tech/content/images/size/w600/2021/10/Screenshot-from-2021-10-12-22-49-27.png 600w, https://blog.mevi.tech/content/images/size/w1000/2021/10/Screenshot-from-2021-10-12-22-49-27.png 1000w, https://blog.mevi.tech/content/images/size/w1600/2021/10/Screenshot-from-2021-10-12-22-49-27.png 1600w, https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-49-27.png 1863w" sizes="(min-width: 720px) 720px"><figcaption>Synthetics canary page showing the Create canary button on the right middle. Above that, there is the status and Canary runs which shows if any canary has failed and when as donut chart and line chart</figcaption></figure><p>When you click the Create canary button, you&apos;ll be presented with the options on how to create it. You can use a blueprint (easy method), you can use an inline editor (customisable with your own scripts) or you can load the scripts from S3.</p><p>There are some typically used monitoring methods in the &quot;Use a blueprint&quot; option like Heartbeat monitoring, API canary, Broken link checker etc.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-49-41.png" class="kg-image" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries" loading="lazy" width="851" height="862" srcset="https://blog.mevi.tech/content/images/size/w600/2021/10/Screenshot-from-2021-10-12-22-49-41.png 600w, https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-49-41.png 851w" sizes="(min-width: 720px) 720px"><figcaption>Create canary window showing the &quot;Use blueprint&quot; option selected and the &quot;Heartbeat monitoring&quot; option under the blueprint option selected as default. There are also other options like API Canary, Broken link checked, Canary Recorder, GUI workflow builder and Visual monitoring (it monitors the visual changes between each runs).</figcaption></figure><p>In our case, we will be using the API canary option since we are planning to check the latency of an API call. I have also put a name for the canary as &quot;canary-demo&quot;.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-50-15.png" class="kg-image" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries" loading="lazy" width="857" height="864" srcset="https://blog.mevi.tech/content/images/size/w600/2021/10/Screenshot-from-2021-10-12-22-50-15.png 600w, https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-50-15.png 857w" sizes="(min-width: 720px) 720px"><figcaption>Create canary window showing the &quot;API canary&quot; option selected under the &quot;Use blueprint&quot; selection. The name for the canary is also entered as &quot;canary-demo&quot;: The name consists of up to 21 lowercase letters, numbers, hyphens or underscores with no spaces.</figcaption></figure><p>Now it is time to set the configuration for the API call. As an example, I am just sending a GET request to https://www.google.com with two required headers (Otherwise we will get &#xA0;bad request as the response).</p><pre><code>Method: GET
URL: https://www.google.com
Headers:
	- user-agent : curl/7.74.0
    	- accept : */*</code></pre><p>You also have an option to put request data but we are skipping it in this example.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-54-20.png" class="kg-image" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries" loading="lazy" width="1473" height="719" srcset="https://blog.mevi.tech/content/images/size/w600/2021/10/Screenshot-from-2021-10-12-22-54-20.png 600w, https://blog.mevi.tech/content/images/size/w1000/2021/10/Screenshot-from-2021-10-12-22-54-20.png 1000w, https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-54-20.png 1473w" sizes="(min-width: 720px) 720px"><figcaption>Window showing the options to put the HTTP request details like Method, URL, Headers and Request data.</figcaption></figure><p>If you are putting sensitive header like Authorization, the console will highlight it in red and show a button below to redact that information from coming in the logs, HAR etc. You can press that button or create the canary as is depending on your requirements.</p><p>Once you have set up the HTTP request, you can choose the Runtime version. I am using sys-nodejs-puppeteer-3.2 but it is only signifincant if you are modifying the script before running. In that case, you can choose the required language.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-54-35.png" class="kg-image" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries" loading="lazy" width="813" height="815" srcset="https://blog.mevi.tech/content/images/size/w600/2021/10/Screenshot-from-2021-10-12-22-54-35.png 600w, https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-54-35.png 813w" sizes="(min-width: 720px) 720px"><figcaption>Window shows the HTTP request steps on the top and the script editor below it.</figcaption></figure><p>Now it is time to choose the schedule to tell the Sythetics Canary how frequently or at what time it should run. You can set it to run continously one a specific date or at regular intervals of time, you can put in a CRON expression, or you can run it only once.</p><p>In my case, I am choosing the &quot;Run continously&quot; option because I&apos;m lazy to find the cron expression. I always forget the format.</p><p>I am also checking the option to start it immediately after creation.</p><p>There are some additional configuration also to set a timeout but I am leaving it as is.</p><p>There is also an option to specify how long the failure data and the success data should be retained. I am putting it as 1 month for both success and failure data.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-54-43.png" class="kg-image" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries" loading="lazy" width="813" height="750" srcset="https://blog.mevi.tech/content/images/size/w600/2021/10/Screenshot-from-2021-10-12-22-54-43.png 600w, https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-54-43.png 813w" sizes="(min-width: 720px) 720px"><figcaption>Window showing the Schedule with the &quot;Run continously&quot; option selected. It shows how frequenty to run and the option is put as Run canary &quot;Every&quot; &quot;5&quot; minutes and the &quot;Start immediately after creation option is checked. Additional configuration menu is kept closed and below that the Data retention option is seen as dropdown.</figcaption></figure><p>The data that is collected during each canary run is stored in an S3 bucket. By default, an S3 bucket will be created with the format given in the screenshot</p><figure class="kg-card kg-code-card"><pre><code>s3://cw-syn-results-AWSAccountNumber-Region/canary/...</code></pre><figcaption>S3 bucket format</figcaption></figure><p>You do have the option to change it but that will require you to already have set up an IAM role with the correct permission to write to that S3 bucket.</p><p>You can either configure the canary to create a new role or select and existing role in the next &quot;Access permissions&quot; step. Do note that once the S3 bucket is edited, then the &quot;Create a new role&quot; option will not be selectable.</p><p>You can also create CloudWatch alarms which I am skipping now but it is required if you need to get alerts when the API latency crosses a set threshold.</p><p>As I said perviously, my requirement had to have the lambda call the external API from within the VPC since the application servers were inside the VPC and they were sending the request through the NAT.</p><p>In this case I am not configuring the VPC for this demo because I configured google.com as the API endpoint and since it is in the public internet, I will need a NAT in the VPC since lambda can talk to public internet from inside the VPC only if there is a NAT gateway attached and as AWS managed NAT gateways are friggin expensive.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-54-55.png" class="kg-image" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries" loading="lazy" width="816" height="701" srcset="https://blog.mevi.tech/content/images/size/w600/2021/10/Screenshot-from-2021-10-12-22-54-55.png 600w, https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-54-55.png 816w" sizes="(min-width: 720px) 720px"><figcaption>Window shows the Data storage option showing the default S3 location, Access permissions option showing the &quot;Create a new role&quot; and &quot;Select and existing role&quot; option. It is followed by two optional configuration for cloudwatch alarms and VPC settings.</figcaption></figure><p>When you are giving a custom S3 location, you have to create a service role for Lambda with the following configurations</p><p>Path</p><pre><code>/service-role/</code></pre><p>IAM Policy</p><pre><code>{
    &quot;Version&quot;: &quot;2012-10-17&quot;,
    &quot;Statement&quot;: [
        {
            &quot;Effect&quot;: &quot;Allow&quot;,
            &quot;Action&quot;: [
                &quot;s3:PutObject&quot;,
                &quot;s3:GetObject&quot;
            ],
            &quot;Resource&quot;: [
                &quot;arn:aws:s3:::{bucketname}/{path}/*&quot;
            ]
        },
        {
            &quot;Effect&quot;: &quot;Allow&quot;,
            &quot;Action&quot;: [
                &quot;s3:GetBucketLocation&quot;
            ],
            &quot;Resource&quot;: [
                &quot;arn:aws:s3:::{bucketname}&quot;
            ]
        },
        {
            &quot;Effect&quot;: &quot;Allow&quot;,
            &quot;Action&quot;: [
                &quot;logs:CreateLogStream&quot;,
                &quot;logs:PutLogEvents&quot;,
                &quot;logs:CreateLogGroup&quot;
            ],
            &quot;Resource&quot;: [
                &quot;arn:aws:logs:ap-northeast-1:038218625917:log-group:/aws/lambda/cwsyn-{canaryname}-*&quot;
            ]
        },
        {
            &quot;Effect&quot;: &quot;Allow&quot;,
            &quot;Action&quot;: [
                &quot;s3:ListAllMyBuckets&quot;,
                &quot;xray:PutTraceSegments&quot;
            ],
            &quot;Resource&quot;: [
                &quot;*&quot;
            ]
        },
        {
            &quot;Effect&quot;: &quot;Allow&quot;,
            &quot;Resource&quot;: &quot;*&quot;,
            &quot;Action&quot;: &quot;cloudwatch:PutMetricData&quot;,
            &quot;Condition&quot;: {
                &quot;StringEquals&quot;: {
                    &quot;cloudwatch:namespace&quot;: &quot;CloudWatchSynthetics&quot;
                }
            }
        }
    ]
}</code></pre><p>Trust relationship</p><pre><code>{
  &quot;Version&quot;: &quot;2012-10-17&quot;,
  &quot;Statement&quot;: [
    {
      &quot;Effect&quot;: &quot;Allow&quot;,
      &quot;Principal&quot;: {
        &quot;Service&quot;: &quot;lambda.amazonaws.com&quot;
      },
      &quot;Action&quot;: &quot;sts:AssumeRole&quot;
    }
  ]
}</code></pre><p>If you are providing VPC configurations to make requests from inside your VPC, remember to also attach the <strong>AWSLambdaVPCAccessExecutionRole </strong>to the created IAM Role. This is required by the Lambda running in the backend of the Synthetics Canaries to create network interfaces inside the VPC with the given configuration.</p><p>Now you can tag the canary and if you want, you can also enable Active tracing with AWS X-Ray. I am keeping mine checked.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-55-09.png" class="kg-image" alt="Monitor your external APIs with AWS Cloudwatch - Synthetics Canaries" loading="lazy" width="826" height="681" srcset="https://blog.mevi.tech/content/images/size/w600/2021/10/Screenshot-from-2021-10-12-22-55-09.png 600w, https://blog.mevi.tech/content/images/2021/10/Screenshot-from-2021-10-12-22-55-09.png 826w" sizes="(min-width: 720px) 720px"><figcaption>Window shows the tagging options and the Active tracing option which is optional. The active tracing is enabled in the screenshot.</figcaption></figure><p>That is it, you can click the Create canary button as you see in the above screenshot and your canary will be created. You will be able to see the failure and success status in the canary dashboard.</p><p>If you make any mistakes, you have the option to edit the configuration after the entre thing is created.</p>]]></content:encoded></item><item><title><![CDATA[Uninstall bloatware from Android]]></title><description><![CDATA[My Samsung Galaxy M30s comes with a lot of bloatware and during each updates, Samsung intorduces new bloatware. Since I wanted to remove them without root, I use this method.]]></description><link>https://blog.mevi.tech/uninstall-bloatware-from-android/</link><guid isPermaLink="false">6152aa6e8fb908000145d1a5</guid><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Sun, 03 Oct 2021 06:30:00 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2021/10/image142.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2021/10/image142.png" alt="Uninstall bloatware from Android"><p>Following are the steps that I took to uninstall bloatware from my Samsung M30s phone without root.</p><h2 id="requirements">Requirements</h2><ol><li>Phone (I use Samsung Galaxy M30s)</li><li>PC (I used Linux)</li><li>Data cable (I use Type C)</li></ol><h2 id="steps">Steps</h2><h3 id="connect-the-phone-to-the-pc">Connect the phone to the PC</h3><p>Connect the phone to the PC with the data cable and allow or deny the storage access based on your need since we won&apos;t be using that for this purpose.</p><h3 id="enable-usb-debugging">Enable USB Debugging</h3><p>Once it is connected, go to your settings and take the developers options and enable the USB Debugging option.</p><p>If you don&apos;t see the developer options, you will have to enabled that by going to Settings -&gt; About phone -&gt; Software information and tapping the Build number 5 times.</p><p>When you enable USB debugging, it might show a confirmation saying that it is for development purpose and all, you can just tap OK.</p><h3 id="install-adb">Install ADB</h3><p>Use your favourite package manager to install the adb package. I use PopOS which is an Ubuntu based (Debian) OS and it has apt.</p><pre><code>sudo apt install adb</code></pre><p><a href="https://developer.android.com/studio/command-line/adb?ref=blog.mevi.tech">Android Debug Bridge</a> is a CLI tool that we use to communicate with the device. It provides a shell interface which we will use in the following steps to run commands.</p><h3 id="authorise-the-pc">Authorise the PC</h3><p>Once ADB is installed run the following command to check if your device is listed</p><pre><code>adb devices</code></pre><p>Running this command will give the following output</p><pre><code>List of devices attached
W5TP428P3MS	unauthorised</code></pre><p>You will now be able to see a prompt on your phone asking you if you want to authorise the PC as an USB debugging device. Confirm that and when you run the command again, you should see the following output.</p><pre><code>List of devices attached
W5TP428P3MS	device</code></pre><h3 id="list-the-packages">List the packages</h3><p>Now we can start running the commands on the ADB shell and it will run inside the device.</p><p>For opening the shell, assuming you only have a single device connected, you can run the following command</p><pre><code>adb shell</code></pre><p>This will give you the following prompt</p><pre><code>vignesh@vignesh-asus-pop-os:~$ adb shell 
m30s:/ $</code></pre><p>Now you can list the installed packages by running the following command</p><pre><code>pm list packages</code></pre><p>This will list he packages as follows</p><pre><code>vignesh@vignesh-asus-pop-os:~$ adb shell 
m30s:/ $ pm list packages
package:com.samsung.android.provider.filterprovider
package:com.google.android.apps.subscriptions.red
package:com.sec.android.app.DataCreate
package:com.skype.raider
...
...
...</code></pre><p>You can use the grep command to find the package of your interest quickly</p><pre><code>pm list packages | grep skype</code></pre><p>I wanted to remove the Samsung Pay Mini application and hence my grep keyword was &quot;pay&quot;, but here I am using Skype as an example</p><p>This showed me the exact package name of that application</p><pre><code>m30s:/ $ pm list packages | grep skype
package:com.skype.raider</code></pre><h3 id="uninstall-the-bloatware">Uninstall the bloatware</h3><p>Now that you got the package name, you can uninstall the package with the following command</p><pre><code>pm uninstall -k com.skype.raider</code></pre><p>If this was successful, it will show success, else it will show failed.</p><p>Usually it fails because the app you are trying to uninstall would be a system app. So you can only uninstall it for your own user since we don&apos;t have the root access.</p><p>This is good because if you uninstall an essentail app like an API or OS package, you can easily fix your phone by resetting it.</p><p>To uninstall a system app, you have to specify the user option as follows</p><pre><code>pm uninstall --user 0 -k com.skype.raider</code></pre><h2 id="conclusion">Conclusion</h2><p>You should be able to uninstall all the bloatware with this method without root. Just make sure you don&apos;t delete any necessary packages. I once made that mistake and had to reset my phone.</p><p><em>Disclaimer: I am not responsible if you damage your phone doing the above steps. It worked for me and hence I have put this blog post for educational purpose.</em></p>]]></content:encoded></item><item><title><![CDATA[Setting up JMX monitoring with Zabbix for Tomcat]]></title><description><![CDATA[Setting up JMX monitoring of Tomcat or a standalone application can become a bit confusing. It has lots of little caveats. This blog addresses that.]]></description><link>https://blog.mevi.tech/setting-up-jmx-monitoring-with-zabbix/</link><guid isPermaLink="false">61521a7b8fb908000145d093</guid><category><![CDATA[Amazon web services]]></category><category><![CDATA[Amazon]]></category><category><![CDATA[AWS]]></category><category><![CDATA[EC2]]></category><category><![CDATA[management]]></category><category><![CDATA[tomcat]]></category><category><![CDATA[tomcat 8.5]]></category><category><![CDATA[VPC]]></category><category><![CDATA[zabbix]]></category><category><![CDATA[jmx]]></category><category><![CDATA[monitoring]]></category><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Mon, 27 Sep 2021 20:45:04 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2021/09/JMXMonitorin-Page-2.drawio.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2021/09/JMXMonitorin-Page-2.drawio.png" alt="Setting up JMX monitoring with Zabbix for Tomcat"><p>I tried to set up JMX monitoring for a couple of Tomcat servers and it took a lot of time than it needed to. So this blog simplifies that process.</p><p>The environment I set it up was a trusted network (VPC in AWS) so I did not bother with the security part since everything is restricted using security groups.</p><h2 id="some-explanation">Some explanation</h2><p>I shall try and explain some concepts more clearer than the documentation and relating to my environment</p><h3 id="infra-diagram">Infra diagram</h3><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/09/JMXMonitorin.drawio-2.png" class="kg-image" alt="Setting up JMX monitoring with Zabbix for Tomcat" loading="lazy" width="562" height="602"><figcaption>Infrastructure image showing a VPC having two availability zone and 3 servers - Zabbix, Tomcat-1, and Tomcat-2 in AWS. The Zabbix server connects with Tomcat servers on ports 10050 and 12345.</figcaption></figure><h3 id="zabbix-java-gateway">Zabbix Java Gateway</h3><p>The Zabbix Java gateway is basically like a Zabbix proxy server but unlike a normal Zabbix proxy server which cannot be nested i.e you cannot set one proxy server behind another proxy server, you can set a Zabbix Java gateway behind a proxy or directly connecting to the Zabbix server.</p><p>There is also another difference compared to a Zabbix proxy. You can add multiple Zabbix proxies with the Zabbix server UI, but there can be only one Zabbix Java gateway and it has to be configured in /etc/zabbix/zabbix_server.conf (or /usr/local/etc/zabbix_server.conf) or wherever your Zabbix server configuration is.</p><h2 id="setting-up-jmx-monitoring">Setting up JMX monitoring</h2><h3 id="zabbix-java-gateway-setup">Zabbix Java gateway setup</h3><p>The following was my configuration after I <a href="https://www.zabbix.com/documentation/4.0/manual/concepts/java?ref=blog.mevi.tech">installed</a> the Zabbix Java gateway in the Zabbix server.</p><p>Make sure that you start the Zabbix Java gateway service.</p><pre><code>JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5</code></pre><p>Restart the Zabbix server service after updating with the above configuration</p><p>Make sure that any internal firewall or security group has the access enabled for 12345 port to the Tomcat server</p><h2 id="tomcat-setup">Tomcat setup</h2><p>To make tomcat start listening on 12345 port for the jmx connections, add the following options to it.</p><pre><code>java.rmi.server.hostname=xxx.xxx.xxx.xxx
com.sun.management.jmxremote.rmi.port=12345
com.sun.management.jmxremote
com.sun.management.jmxremote.port=12345
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.ssl=false
com.sun.management.jmxremote.registry.ssl=false</code></pre><p>So in this case, the Tomcat 1 (192.168.5.1) server will have the following entry in /etc/systemd/system/tomcat.service</p><pre><code>[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=UMASK=022
Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/usr/share/tomcat8/temp/tomcat.pid
Environment=CATALINA_HOME=/usr/share/tomcat8
Environment=CATALINA_BASE=/usr/share/tomcat8
Environment=&apos;CATALINA_OPTS=-Xms512M -Xmx3072M -Xss2M -server -XX:+UseParallelGC&apos;
Environment=&apos;JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Djava.rmi.server.hostname=192.168.5.1 -Dcom.sun.management.jmxremote.rmi.port=12345 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.registry.ssl=false&apos;

ExecStart=/usr/share/tomcat8/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=root
Group=tomcat

[Install]
WantedBy=multi-user.target</code></pre><p>and Tomcat 2 (192.168.6.1) will have the following entry in the tomcat service file</p><pre><code>[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=UMASK=022
Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/usr/share/tomcat8/temp/tomcat.pid
Environment=CATALINA_HOME=/usr/share/tomcat8
Environment=CATALINA_BASE=/usr/share/tomcat8
Environment=&apos;CATALINA_OPTS=-Xms512M -Xmx3072M -Xss2M -server -XX:+UseParallelGC&apos;
Environment=&apos;JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Djava.rmi.server.hostname=192.168.6.1 -Dcom.sun.management.jmxremote.rmi.port=12345 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.registry.ssl=false&apos;

ExecStart=/usr/share/tomcat8/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=root
Group=tomcat

[Install]
WantedBy=multi-user.target</code></pre><p>As you can see, the java.rmi.server.hostname option is configured with the Tomcat server&apos;s own IP address to which the Zabbix server connects to.</p><p>I have put ssl and other authentication and security options to false because this is inside a VPC and we have other layers of security in place.</p><p>After setting the above configuration in the service file, make sure to restart tomcat with the following commands</p><pre><code>sudo systemctl daemon-reload
sudo systemctl restart tomcat.service</code></pre><h3 id="zabbix-server-ui-config">Zabbix Server UI config</h3><p>This section tell you what you have to do in the Zabbix server UI side to configure the Tomcat servers as hosts for monitoring</p><p>In this case, it is just like configuring any other Zabbix agent host, but you have to enter the IP 192.168.5.1 (for Tomcat-1) and the port 12345 in the JMX interfaces section</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/09/Screenshot-from-2021-09-28-01-48-56.png" class="kg-image" alt="Setting up JMX monitoring with Zabbix for Tomcat" loading="lazy" width="1079" height="759" srcset="https://blog.mevi.tech/content/images/size/w600/2021/09/Screenshot-from-2021-09-28-01-48-56.png 600w, https://blog.mevi.tech/content/images/size/w1000/2021/09/Screenshot-from-2021-09-28-01-48-56.png 1000w, https://blog.mevi.tech/content/images/2021/09/Screenshot-from-2021-09-28-01-48-56.png 1079w" sizes="(min-width: 720px) 720px"><figcaption>Zabbix host configuration with the Host name Tomcat-1, Agent interfaces IP and Port, and JMX interface IP and port filled in.</figcaption></figure><p>If your configuration were correct, you should see the green JMX indicator</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://blog.mevi.tech/content/images/2021/09/Screenshot-from-2021-09-28-01-55-01.png" class="kg-image" alt="Setting up JMX monitoring with Zabbix for Tomcat" loading="lazy" width="154" height="31"><figcaption>Green ZBX and JMX indicators</figcaption></figure><h2 id="some-problems-i-faced">Some problems I faced</h2><h3 id="ssl-error">SSL error</h3><pre><code>SSL peer shut down incorrectly: service:jmx:rmi:///jndi/rmi://192.168.5.1:12345/jmxrmi</code></pre><p>I got the above error and I fixed it with the help from <a href="https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/427170-jmx-monitoring-ssl-peer-shut-down-incorrectly?ref=blog.mevi.tech">this answer</a>. This is there in the systemd service file example I have put above.</p><p>This showed up as a red JMX indicator with the above error.</p><h3 id="wrong-understanding">Wrong understanding</h3><p>I thought this was like Zabbix agent itself where we install an agent on all the servers that we have to monitor, but it is not like that. We install Zabbix Java gateway in a single place that can access the JMX port on all the servers we want to monitor.</p><p>So we can install the gateway on the Zabbix server itself and when we use 12345 as the JMX port, we can open the firewall from Zabbix agent to the Tomcat server for 12345 port.</p><p>Since the Zabbix Java gateway agent listening on port 10052 is inside the Zabbix server itself, it doesn&apos;t need to be enabled in the firewall for external access.</p>]]></content:encoded></item><item><title><![CDATA[Logging bash commands]]></title><description><![CDATA[<p>I once had a requirement to log bash commands and I checked many solutions like <a href="https://github.com/a2o/snoopy?ref=blog.mevi.tech">Snoopy</a>, but none of them were proper for a production environment. So the below is the most simple method to add logging to bash in Linux.</p><h2 id="steps">Steps</h2><h3 id="modify-bash-config">Modify bash config</h3><p>First step is to modify</p>]]></description><link>https://blog.mevi.tech/logging-bash-commands/</link><guid isPermaLink="false">6125d8c08fb908000145d017</guid><dc:creator><![CDATA[Vignesh N]]></dc:creator><pubDate>Wed, 25 Aug 2021 05:54:55 GMT</pubDate><media:content url="https://blog.mevi.tech/content/images/2021/08/bash-logo-web.png" medium="image"/><content:encoded><![CDATA[<img src="https://blog.mevi.tech/content/images/2021/08/bash-logo-web.png" alt="Logging bash commands"><p>I once had a requirement to log bash commands and I checked many solutions like <a href="https://github.com/a2o/snoopy?ref=blog.mevi.tech">Snoopy</a>, but none of them were proper for a production environment. So the below is the most simple method to add logging to bash in Linux.</p><h2 id="steps">Steps</h2><h3 id="modify-bash-config">Modify bash config</h3><p>First step is to modify the configuration file for bash</p><p>Open /etc/bashrc with the following command</p><pre><code>sudo vim /etc/bashrc</code></pre><p>After that, add the following line to the end of the file</p><pre><code>PROMPT_COMMAND=&apos;history -a &gt;(tee -a ~/.bash_history | logger -p local6.info -t &quot;$USER[$$] $SSH_CONNECTION&quot;)&apos;</code></pre><p>The above entry basically logs all the bash history (commands) to the local6.info log severity.</p><p>This will start working only after logging out and logging in again (Or you can manually source the new bashrc)</p><h3 id="modify-rsyslog-config">Modify Rsyslog config</h3><p>Now to actually log the bash commands, the Rsyslog configuration must be edited to send all the local6.* logs to the /var/log/secure file</p><p>So open up Rsyslog config with the following command</p><pre><code>sudo vim /etc/rsyslog.conf</code></pre><p>And then change the existing secure log entry</p><p>from</p><pre><code>authpriv.*                                 /var/log/secure</code></pre><p>to</p><pre><code>authpriv.*,local6.*                        /var/log/secure</code></pre><p>After this, restart Rsyslog with the following command</p><pre><code>sudo systemctl restart rsyslogd.service</code></pre><h2 id="conclusion">Conclusion</h2><p>This will enable bash logging but do note that this will enable only bash logging. If there is any other shell like sh or zsh, this method will not log the commands run using those shells.</p><p>Also anyone can put any commands in a script and run it and this will only log the name of the script and not the commands inside the script.</p>]]></content:encoded></item></channel></rss>