<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Swati Sannidhi on Medium]]></title>
        <description><![CDATA[Stories by Swati Sannidhi on Medium]]></description>
        <link>https://medium.com/@swatisannidhi?source=rss-a7ffdec10d9b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*mBMfE6HzfxakVvBBXua0sA.jpeg</url>
            <title>Stories by Swati Sannidhi on Medium</title>
            <link>https://medium.com/@swatisannidhi?source=rss-a7ffdec10d9b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 21:22:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@swatisannidhi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Sonatype Nexus — Beyond Repository Manager]]></title>
            <link>https://swatisannidhi.medium.com/sonatype-nexus-beyond-repository-manager-da5946b49b11?source=rss-a7ffdec10d9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/da5946b49b11</guid>
            <dc:creator><![CDATA[Swati Sannidhi]]></dc:creator>
            <pubDate>Wed, 14 Jul 2021 09:42:41 GMT</pubDate>
            <atom:updated>2021-07-14T10:59:09.295Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sonatype Nexus — Beyond Repository Manager</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*edEye4755yHYNUOT9bCi3Q.png" /></figure><p>Many of us know Nexus as a Repository Manager, but Sonatype has recently evolved Nexus Platform to deliver full spectrum control of software development lifecycle to developers. Here are some of them I had an opportunity to explore on.</p><h3>Nexus Repository</h3><p>It is an artifact repository which supports many different artifact formats including docker, maven, npm, nuget etc. It also supports generic formats like zip files through raw repositories.</p><p><strong>OSS Vs Pro</strong></p><p>OSS is the free/open source version of Nexus Repository where as Pro version offers additional features like SAML/SSO authentication, Enterprise support, dynamic storage, custom metadata and many more. A full list of pro features compared to oss can be found here <a href="https://www.sonatype.com/products/repository-oss-vs-pro-features">https://www.sonatype.com/products/repository-oss-vs-pro-features</a></p><p><strong>Equivalent Tools</strong></p><ul><li>JFrog Artifactory</li></ul><h3>Nexus IQ Server</h3><p>Nexus IQ Server is a policy engine powered by <a href="https://guides.sonatype.com/iqserver/technical-guides/sonatype-vuln-data/">precise intelligence</a> on open source components.</p><p>Sonatype creates its data using a proprietary, automated vulnerability detection system that monitors, aggregates, correlates, and incorporates machine learning from publicly available information like National Vulnerability Database, OWASP, OSS Index and many more.</p><p>Sonatype uses a combination of automated identification and human research that <strong>eliminates false positives and negatives</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*959lckz5ZOP11X0WgLo1Rw.png" /><figcaption>Nexus IQ Console with Firewall and Lifecycle</figcaption></figure><p>Nexus Lifecycle and Nexus Firewall are powered by Nexus IQ Server.</p><h3>Nexus Lifecycle</h3><p>Lifecycle is the open source code security and dependency management tool which continuously monitors and helps identify vulnerabilities and licenses at the every stage of software development.</p><p>The policy enforcement is configurable at Root Organization level or Individual Organization level (Projects) or Individual Application level. The policy enforcement is also configurable at various stages of your software development lifecycle, which Sonatype categorise as proxy, develop, source, build, stage, release and operate stages.</p><p>Policy violation actions (No Action, Warn, <strong>Fail</strong>) can be set to fail the pipelines at specific stages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4HEW-SbUf1JT2jqJ4UiLow.png" /><figcaption>Policy Enforcement at various levels and stages</figcaption></figure><p>Applications can be categorised as Distributed, Hosted, Internal or even custom categories and policies can be configured differently for each application category based on security requirements</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lgWgGGt1HrdxFeZaOf37Pg.png" /><figcaption>Default Application Categories</figcaption></figure><p>Beyond Day 0, with continuous monitoring feature enabled, Lifecycle performs the scan on a daily basis for the components identified in the configured stage and notifies of any new vulnerabilities that come up. With continuous monitoring, vulnerability scanning is performed outside of the devops pipeline on a regular basis for components already in production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uf3A7ay1gLOl9IxdlmsLqg.png" /><figcaption>Continuous Monitoring enabled with Release Stage</figcaption></figure><p>With Lifecycle license,</p><ul><li>The scan tool can be integrated into the IDE</li><li>The scan reports can be viewed and downloaded through IQ Server UI or through apis</li></ul><p><strong>Equivalent Tools:</strong></p><ul><li>Snyk Open Source</li><li>JFrog X-Ray</li><li>Dependabot</li></ul><h3>Nexus Firewall</h3><p>Firewall gives you the ability to block vulnerable open source software packages and their dependencies from entering into your code (IDE), proxy repositories or DevOps pipelines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPrXcYEVWupjUq32cEB7kQ.png" /><figcaption>Custom Error Code from Nexus Firewall showing blocked vulnerable package</figcaption></figure><p>With Firewall license,</p><ul><li>The scan reports can be viewed through IQ Server UI but cannot be downloaded.</li></ul><h3>Nexus Container</h3><p>Scans for open source vulnerabilities related to application components in each layer of a docker image file.</p><p>Note that it does not scan the OS level components. [Clair (OpenSource) is container scan at OS level]</p><p><strong>Equivalent Tools:</strong></p><ul><li>Snyk Container</li></ul><h3>Sonatype Lift</h3><p>Code analysis tool focused on code quality.</p><p>Free version is limited to public repositories.</p><p>Pro version is for unlimited private repositories and supports 11 languages. Can be run for every pull request and the feedback is provided as comments in Code Review.</p><p><strong>Equivalent Tools:</strong></p><ul><li>Sonar Qube</li><li>Codacy</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da5946b49b11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Disaster Recovery Guide]]></title>
            <link>https://swatisannidhi.medium.com/disaster-recovery-guide-340cf5b9c882?source=rss-a7ffdec10d9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/340cf5b9c882</guid>
            <dc:creator><![CDATA[Swati Sannidhi]]></dc:creator>
            <pubDate>Sat, 01 May 2021 02:53:51 GMT</pubDate>
            <atom:updated>2021-05-01T02:55:22.199Z</atom:updated>
            <content:encoded><![CDATA[<p>This document describes</p><ol><li>Steps needed to be performed in case of a disaster (DR — Failover scenario) i.e., to bring up application and services in “Failover Region”.</li><li>Steps needed to operate back in the original state (DR — Fallback scenario) i.e., to run application and services in “Primary Region” once the region is operational.</li></ol><h3>DR — Failover Scenario</h3><p>Steps:</p><h4>Stop PROD application</h4><ul><li>Set the desired count of PROD ecs services service to 0 through terraform.</li></ul><pre>$ terraform plan -var-file=&quot;prod.tfvars&quot; -out env-PROD.plan  <br>$ terraform apply env-PROD.plan</pre><h4>Promote DR Replica to standalone</h4><ul><li>From the PROD/DR AWS Console, monitor replication lag and when lag is significantly less, promote the cross-region read replica.</li></ul><p>AWS Region: “Failover Region”</p><p>RDS → demo-dr-db → Actions → Promote</p><ul><li>Set the replicate_source_db in env-DR terraform scripts to null, so the DB status can now reflect in the terraform state.</li></ul><pre>#Provision DB <br>module demo-db {  </pre><pre>...   <br>replicate_source_db = &quot;&quot;   </pre><pre>}</pre><p><strong>NOTE:</strong> There seems no way of promoting the read replica to standalone through terraform right now, hence the above 2 steps are needed.</p><h4>Check DR application version</h4><ul><li>Ensure current application version(image tag) in the task definition is the same as in PROD. Deploy services if needed.</li></ul><h4>Start DR application services</h4><ul><li>Set the desired count &gt;0 (precisely to the prod setting) by updating the ecs service in env-DR terraform scripts for all services.</li><li>Run terraform plan and apply.</li></ul><pre>$ terraform plan -var-file=&quot;dr.tfvars&quot; -out env-DR.plan  <br>$ terraform apply env-DR.plan</pre><ul><li>Monitor application logs in cloudwatch for all services</li></ul><h4>Update CloudFront origin to point to DR Front End ALB</h4><ul><li>From the PROD/DR AWS Console,</li></ul><p>CloudFront → Click PROD Distribution ID → Origins and Origin Groups → Select Origin &amp; Edit → Update “<strong>Origin Domain Name</strong>” to DR ALB from drop down → Yes, Edit</p><h3>DR — Fallback Scenario</h3><p>Steps:</p><h4>Rename the existing prod db</h4><p>NOTE: In case of actual disaster, this step may or may not be needed depending on how AWS recovers the resources</p><ul><li>Rename demo-prod-db to demo-prod-old-db in SG region from console or CLI (takes about a minute)</li></ul><h4>Create a cross region read replica of the DR Database</h4><ul><li>From AWS console, create a read replica of demo-dr-db with below screenshot options.</li></ul><h4>Promote replica as standalone DB</h4><ul><li>Once Replica is created, promote it(demo-prod-db) as stanalone database.</li></ul><h4>Synchronise PROD terraform state</h4><ul><li>Run the prod terraform plan to see any changes detected in the DB. Run the terraform apply to apply those changes if needed</li></ul><pre>$ terraform init<br>$ terraform plan -var-file=&quot;prod.tfvars&quot; -out env-PROD.plan <br>$ terraform apply env-PROD.plan</pre><p>NOTE1: Minor changes like tags, max_allocated_storage were detected.</p><p>NOTE2: In case of actual disaster, all other resources in the SG region will be provisioned.</p><h4>Start PROD application services</h4><ul><li>Set the desired count of PROD ecs services service to original count through terraform.</li></ul><pre>$ terraform init<br>$ terraform plan -var-file=&quot;prod.tfvars&quot; -out env-PROD.plan <br>$ terraform apply env-PROD.plan</pre><p>NOTE: This terraform plan should set the <strong>desired_count</strong> of the ecs services and task the ecs tasks.</p><ul><li>Validate all production logs to ensure DB is accessible.</li></ul><h4>Update CloudFront origin to point back to PROD</h4><ul><li>From the PROD/DR AWS Console,</li></ul><p>CloudFront → Click PROD Distribution ID → Origins and Origin Groups → Select Origin &amp; Edit → Update “<strong>Origin Domain Name</strong>” to PROD ALB from drop down → Yes, Edit</p><ul><li>Test the production Url and ensure application is accessible.</li></ul><h4>Delete the DR Standalone &amp; re-create a read replica from the current prod db</h4><ul><li>From the AWS console, delete the demo-dr-db standalone instance.</li><li>Run the DR terraform scripts to create a read replica of demo-prod-db in “Failover Region” region.</li></ul><pre>$ terraform init <br>$ terraform plan -var-file=&quot;dr.tfvars&quot; -out env-DR.plan <br>$ terraform apply env-DR.plan</pre><p>NOTE1: This terraform plan should create a read replica and update the DR secret with the new DB replica identifier.</p><p>NOTE2: This replica creation takes about 20–25 min and more depending on the size of the DB.</p><h4>CloudWatch Alarms</h4><ul><li>Check and update the RDS alarms configured for the demo-prod-db as necessary.</li><li>Check all other cloud watch alarms are in the OK state as expected.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=340cf5b9c882" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SoftEther VPN on AWS]]></title>
            <link>https://swatisannidhi.medium.com/softether-vpn-on-aws-ef8f7ff1c5bc?source=rss-a7ffdec10d9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef8f7ff1c5bc</guid>
            <dc:creator><![CDATA[Swati Sannidhi]]></dc:creator>
            <pubDate>Fri, 25 Sep 2020 08:01:18 GMT</pubDate>
            <atom:updated>2020-09-25T08:01:18.788Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*g7_ve_88wBpAykL3V00cIw.jpeg" /></figure><h4>Some of VPN UseCases</h4><ol><li>Restrict certain administrative portals to ‘internal’ network by not exposing to wider public internet for security purposes.</li><li>Ability to locally access dev and test RDS database provisioned in private subnets i.e without public access (for developers to access DB from local in non-prod environments).</li><li>Ability to directly access AWS resources provisioned in private subnets in a vpc. (Access kibana endpoint of an ES cluster provisioned in a vpc?)</li><li>Applications which were intranet in nature to be available on cloud.</li></ol><h4>Install &amp; Configure VPN Server</h4><ol><li>Pre-requisites</li><li>Download &amp; Install SoftEther VPN server</li><li>Run vpnserver as a service</li><li>Establish connectivity to VPN server</li><li>Configure VPN server admin password</li><li>Configure virtual hub</li><li>Create VPN users</li><li>Set up L2TP/IPSec on the VPN server</li><li>Configure vpc resolver and set static routes</li><li>VPN client to connect to VPN</li></ol><p>Let’s see these steps in detail.</p><h4>Step1: Pre-requisites</h4><ol><li>Provision an EC2 instance to act as a VPN Server. <br>[Most application infrastructure setups running on AWS would have an ec2 instance running as the jump server, if the internal traffic is minor to moderate we can utilise the same ec2 instance for setting up the vpn server.]</li><li>SSH to your AWS EC2 instance make sure the following softwares are installed and enabled:</li></ol><ul><li>gcc, binutils software</li><li>tar, gzip or other software for extracting package files</li><li>chkconfig system utility</li><li>libc (glibc), zlib, openssl, readline, ncurses, pthread libraries</li></ul><p>If you’re using an AWS Linux AMI, you should have most of them, the only thing you need to install is gcc.</p><pre>$ sudo yum install -y gcc</pre><h4>Step2: Download &amp; Install SoftEther vpn server</h4><p>Download the linux distribution of SoftEther server at the <a href="http://www.softether-download.com/en.aspx?product=softether">download link</a> to the ec2 instance and install using below steps</p><ul><li>Select Software: Softether VPN(freeware)</li><li>Select Component: Softether VPN Server</li><li>Select Platform: Linux</li><li>Select CPU: Intel x64 / AMD64 (64 bit)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*kqH6GcUZWp4Noe05EAMD_g.png" /></figure><pre>$ wget -O softether-vpnserver.tar.gz <a href="https://www.softether-download.com/files/softether/v4.34-9745-rtm-2020.04.05-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-x64-64bit.tar.gz">&lt;</a>download_link_address_above&gt;<br>$ tar -zxvf softether-vpnserver.tar.gz</pre><pre>$ cd vpnserver<br>$ make</pre><p>Agree to the license agreement and you will get the vpnserver executable when the make command is completed successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*cEcgP_zr8N_s-uuDtDBJNQ.png" /></figure><p>Move the location of the whole folder to the <strong>/usr/local/</strong> directory</p><pre>$ cd ..<br>$ sudo mv vpnserver /usr/local<br>$ sudo chown -R root:root /usr/local/vpnserver</pre><pre>$ ls -la /usr/local/vpnserver/</pre><p>Perform a check using the <strong><em>vpncmd</em></strong> command line to see whether SoftEther VPN server can operate properly on your system.</p><pre>$ cd /usr/local/vpnserver<br>$ ./vpncmd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*HsX4h2_6JTvx_6p3KZ1uSQ.png" /><figcaption>vpnserver installation check</figcaption></figure><h4>Step3: Run vpnserver as a service</h4><p>Configure below control script at /etc/init.d/ to be able to start, stop, reload &amp; restart vpnserver</p><pre>$ sudo vi /etc/init.d/vpnserver</pre><pre>#! /bin/bash<br>#<br># vpnserver     softether vpn server<br>#<br># chkconfig: 2345 10 90<br># description: Activates/Deactivates VPN Server<br>#<br>### BEGIN INIT INFO<br># Default-Start:     2 3 4 5<br># Should-Start: iptables ip6tables NetworkManager-wait-online NetworkManager $network-pre<br># Short-Description: Bring up/down vpnserver<br># Description: Bring up/down vpnserver<br>### END INIT INFO</pre><pre># Source function library.<br>#. /etc/init.d/functions</pre><pre># Check that networking is up.<br>[ &quot;${VPNSERVER}&quot; = &quot;no&quot; ] &amp;&amp; exit 6</pre><pre>DAEMON=/usr/local/vpnserver/vpnserver<br>LOCK=/var/lock/subsys/vpnserver</pre><pre># if the ip configuration utility isn&#39;t around we can&#39;t function.<br>[ -x ${DAEMON} ] || exit 1</pre><pre>CWD=$(pwd)</pre><pre># See how we were called.<br>case &quot;$1&quot; in<br>start)<br>    [ &quot;$EUID&quot; != &quot;0&quot; ] &amp;&amp; exit 4<br>    rc=0<br>    if [ -x ${DAEMON} ]; then<br>      ${DAEMON} start<br>      touch ${LOCK}<br>    fi</pre><pre>    ;;<br>stop)<br>    [ &quot;$EUID&quot; != &quot;0&quot; ] &amp;&amp; exit 4<br>    rc=0<br>    if [ -x ${DAEMON} ]; then<br>      ${DAEMON} stop<br>      rm ${LOCK}<br>    fi</pre><pre>    ;;<br>restart|reload|force-reload)<br>    cd &quot;$CWD&quot;<br>    $0 stop<br>    $0 start<br>    rc=$?</pre><pre>    ;;<br>*)<br>    echo $&quot;Usage: $0 {start|stop|restart|reload}&quot;<br>    exit 2<br>esac</pre><pre>exit $rc</pre><p>Configure vpnserver as a service to startup on server reboot and run the vpn server.</p><pre>$ sudo chmod +x /etc/init.d/vpnserver<br>$ sudo chkconfig vpnserver on<br>$ sudo service vpnserver start</pre><h4>Step4: Establish connectivity to vpn server</h4><p>vpn client communicates with vpn server on ports 4500 , 500 using udp protocol. For the vpn server administration we can connect on ports 22 or 443 using tcp protocol. Hence we need to add below inbound rules to the security group associated with the ec2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*aJEZywAC7-uR2_1LLSecpQ.png" /><figcaption>Security Group Inbound Rules</figcaption></figure><h4>Step5: Configure vpn server admin password (Command Line — vpncmd)</h4><ol><li>Goto vpnserver directorycd /usr/local/vpnserver, type ./vpncmd</li><li>Choose option 1Management of VPN Server or VPN Bridge and hit Enter</li><li>For the hostname IP, input the IP address of the EC2 server instance followed by a colon and port 443. You can find the IP of your server instance on the EC2 dashboard. The input should look like this: 123.123.123.123:443</li><li>In the next step, leave the input blank and hit Enter to connect from the Server Admin node.</li><li>The prompt should now read “VPN Server&gt;”. Enter ServerPasswordSet and hit Enter</li><li>Enter a password of your choice and type it again to confirm. Keep a note of the password.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PhzQkL0CL1ALFS2_9WNQw.png" /></figure><h4>Step6: Set up L2TP/IPSec on the VPN server</h4><ol><li>While at “VPN Server&gt;” prompt, enter <strong>IPsecEnable</strong></li><li>(Optional) In case you already exited the “VPN Server&gt;” prompt, follow Step5:1–4. This time you will be prompted for the server admin password set in Step5</li><li>Next you are given a series of configuration prompts. Choose as per below</li></ol><pre>Enable L2TP over IPsec Server Function (yes / no): <strong>yes</strong> <br>(<em>To enable the VPN for use on multiple devices including Windows PC, Mac OSX, iOS, and Android</em>)</pre><pre>Enable Raw L2TP Server Function (yes / no): <strong>no</strong> <br><em>(do not allow connections without encryption)</em></pre><pre>Enable EtherIP / L2TPv3 over IPsec Server Function (yes / no): <strong>yes</strong><br><em>(allow routers with this built-in function to connect)</em></pre><p>4. Next comes the pre-shared key. This is a password with a maximum of nine characters. Enter whatever you like and make a note of it.</p><p>5. For “Default Virtual HUB in a case of omitting the HUB on the Username:”, simply enterSITVPN (The name of the virtual hub)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PY4p6R67nPULyRcTVDiQIQ.png" /></figure><h4>Step7: Configure virtual hub (Command Line — vpncmd)</h4><ol><li>While at the “VPN Server&gt;” prompt, type HubCreate SITVPN and enter a new password that you will use to log in when you are not in Server Admin mode. Keep a note of the password.</li><li>(Optional) In case you already exited the “VPN Server&gt;” prompt, follow Step5:1–4. This time you will be prompted for the server admin password set in Step5</li><li>Type Hub SITVPN and hit Enter. The prompt should read “VPN Server/SITVPN&gt;”</li><li>Type SecureNatEnable</li></ol><p>We use Secure NAT as the means to connect hubs to the server network. Another option is Local Bridge connection, but it’s more complicated and requires setting up a DHCP server. Secure NAT takes care of the DHCP server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*C5YEYfFiKVLHtKaOYQh1kQ.png" /></figure><h4>Step8: Create vpn users (Command Line — vpncmd)</h4><ol><li>Goto vpnserver directorycd /usr/local/vpnserver, type ./vpncmd</li><li>Choose option 1Management of VPN Server or VPN Bridge and hit Enter</li><li>For the hostname IP, input the IP address of the EC2 server instance followed by a colon and port 443. You can find the IP of your server instance on the EC2 dashboard. The input should look like this: 123.123.123.123:443</li><li>In the next step, enter the virtual hub name Specify Virtual Hub Name: SITVPN and hit Enter to connect to the server by Virtual Hub Admin Mode.</li><li>The prompt should now read “VPN Server/SITVPN&gt;”. Type UserCreate sitvpnuser, replacing “sitvpnuser” with a username of your choice.</li><li>You will be asked to enter a Group Name, Full Name, and Description for the new user. Leave the Group Name blank, and use whatever you want for the other two.</li><li>Type UserPasswordSet sitvpnuser, replacing sitvpnuser with the username you just created. Enter and confirm a password for that user.</li><li>Repeat steps 1–3 for as many users as you wish.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*NDrbDb9kQzocZFvjyEMrkg.png" /></figure><h4>Step9: Configure Virtual DHCP Server Settings</h4><p>The Virtual DHCP Server will be enabled when you enabled the SecureNAT in Step6.4. A couple of additional settings are needed</p><ol><li>Stop the vpn server service and edit the vpn_server.config file to set the DhcpDnsServerAddress to the DNS address of the VPC (x.x.0.2) in the VirtualDhcpServer <strong>configuration block under the virtual hub</strong>.</li><li>Reload the config and start vpn serverservice vpnserver start</li></ol><pre><em>Before:</em><br>declare VirtualDhcpServer<br>{<br>  string DhcpDnsServerAddress 192.168.30.1<br>  ...<br>  string DhcpPushRoutes $<br>}</pre><pre><em>After:</em><br>declare VirtualDhcpServer<br>{<br>  string DhcpDnsServerAddress <strong>10.192.0.2</strong><br>  ...<br>  string DhcpPushRoutes 10.192.0.0/255.255.255.0/192.168.30.1<br>}</pre><ol><li>Stop the vpn server service and edit the vpn_server.config file to add routes for each subnet of the vpc in which the resources will be accessed in the VirtualDhcpServer <strong>configuration block under the virtual hub</strong>. Set the DhcpPushRoutes as below</li><li>Reload the config and start vpn serverservice vpnserver start</li></ol><pre>declare VirtualDhcpServer<br>{<br>  string DhcpDnsServerAddress <strong>10.192.0.2</strong><br>  ...<br>  string DhcpPushRoutes 10.192.0.0/255.255.255.0/192.168.30.1, &lt;public_subnet_1&gt;/255.255.255.0/192.168.30.1, &lt;public_subnet_2&gt;/255.255.255.0/192.168.30.1,&lt;private_subnet_1&gt;/255.255.255.0/192.168.30.1,&lt;private_subnet_2&gt;/255.255.255.0/192.168.30.1<br>}</pre><h4>Step10: VPN client to connect to vpn</h4><p>We can use any open vpn client to connect to your vpn. SoftEther has its own client which can be downloaded from &lt;link&gt;</p><p>If you are a MacOS user, it has a built-in support to IPsec/L2TP VPN so you do not have to install a client.</p><ol><li>Open System Preferences -&gt; Network</li><li>Click “+” to create a new service</li><li>Select interface VPN , and VPN type L2TP over IPSec and give any name for the Service Name and click Create</li></ol><pre><strong>Server Address:</strong> &lt;Set it to the public IP of the ec2 instance&gt;<br><strong>Account Name:</strong>   &lt;Set it to the VPN User&gt;</pre><pre>In Authentication Settings, set</pre><pre><strong>Password:</strong>       &lt;Set it to password of the VPN User&gt;<br><strong>Shared Secret:</strong>  &lt;Set it to the pre-shared key&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ilCOs8Zd6mi3Avwb2e1IFA.png" /></figure><p>Finally, Apply &amp; Connect to the vpn!</p><h3>Whats Next?</h3><p>Automate this whole process into an AMI, Cost Comparision</p><h4>References:</h4><p><a href="http://blog.wumuxian1988.com/2016/10/26/softether-vpn/">http://blog.wumuxian1988.com/2016/10/26/softether-vpn/</a></p><p><a href="https://www.comparitech.com/blog/vpn-privacy/how-to-set-up-your-own-free-vpn-with-softether-and-amazon-web-services/">https://www.comparitech.com/blog/vpn-privacy/how-to-set-up-your-own-free-vpn-with-softether-and-amazon-web-services/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef8f7ff1c5bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Access A Secure Elasticache Cluster?]]></title>
            <link>https://swatisannidhi.medium.com/how-to-access-a-secure-elasticache-cluster-217f4b17c2c3?source=rss-a7ffdec10d9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/217f4b17c2c3</guid>
            <dc:creator><![CDATA[Swati Sannidhi]]></dc:creator>
            <pubDate>Fri, 25 Sep 2020 07:55:06 GMT</pubDate>
            <atom:updated>2020-09-25T07:55:06.337Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*oemDL3FLqFB_pKeGajGbqA.png" /></figure><p>An application using an elasticache(redis) cluster for in-memory caching in production needs security at various levels. Most obvious ones being, provisioning the cluster within private subnets inside a vpc, enabling encryption at rest, enabling encryption in transit and configuring a security group to restrict access to the elasticache(redis) cluster.</p><p>We may encounter a scenario while troubleshooting operational issues which require access to your secure redis cluster.</p><blockquote>For elasticache instances provisioned inside a vpc, you can only connect from an ec2 instance running within the same vpc or through vpc peering for ec2 instances from other vpc.</blockquote><p>Following steps might come in handy</p><ul><li>Identify connection endpoint based on type of your cluster. This can be determined by looking at the <em>Elasticache Dashboard -&gt; Redis -&gt; &lt;cluster&gt; -&gt;Description</em> in the AWS console.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GxpkWyKQVqwHE3tAfugDkA.png" /></figure><ul><li>Add an inbound rule to the redis cluster’s security group to allow access from the ec2 instance’s security group.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dh5AK5XE1FQw-D4GKlwS7w.png" /></figure><ul><li>Check if any network ACLs are enabled for the subnets in which the redis cluster in provisioned. If yes, configure the associated NACL to allow traffic on the redis cluster port.</li><li>Login to the ec2 instance within the same vpc as your redis cluster.</li></ul><pre>ssh -i &lt;path_to_key_file&gt; ec2-user@&lt;public_ip&gt;</pre><ul><li>As root user, install redis-cli</li></ul><pre># yum install -y gcc<br># wget <a href="http://download.redis.io/redis-stable.tar.gz">http://download.redis.io/redis-stable.tar.gz</a> &amp;&amp; tar xzf redis-stable.tar.gz &amp;&amp; cd redis-stable &amp;&amp; make &amp;&amp; make install</pre><ul><li>At this point, if your redis cluster does not have encryption in transit enabled, you can directly connect to the cluster using redis-cli</li></ul><pre>$ redis-cli -h &lt;<strong>connection_endpoint_without_port</strong>&gt; -p <strong>&lt;cluster_port&gt;</strong></pre><blockquote>For elasticache instances with encryption in transit enabled, you have to connect using clients that work with SSL. As redis-cli doesn’t support SSL or Transport Layer Security (TLS), you can connect using stunnel command to create an SSL tunnel to the redis cluster.</blockquote><ul><li>As root user, install stunnel</li></ul><pre># yum install -y stunnel</pre><ul><li>As root user, add redis connection endpoint determined in the first step in the below configuration template. You may add multiple connection configurations as well to this file, for example to connect to a reader endpoint or to connect to another cluster.</li></ul><pre># vi /etc/stunnel/redis-cli.conf      </pre><pre>fips = no<br>setuid = root<br>setgid = root<br>pid = /var/run/stunnel.pid<br>debug = 7<br>delay = yes<br>options = NO_SSLv2<br>options = NO_SSLv3<br>[redis-cli]<br>   client = yes<br>   accept = 127.0.0.1:6666 <br>   connect = &lt;<strong>connection_endpoint</strong>&gt;</pre><ul><li>Start stunnel and test the tunnels are started (Can be run as non-root user)</li></ul><pre>$ sudo stunnel /etc/stunnel/redis-cli.conf</pre><pre>$ sudo netstat -tulnp | grep -i stunnel</pre><pre><em>tcp        0      0 127.0.0.1:6666          0.0.0.0:*               LISTEN      18385/</em><strong><em>stunnel</em></strong></pre><ul><li>Connect to the encrypted Redis cluster using the local endpoint of the tunnel and execute necessary commands to view key-value pairs in the cache or clear cache using flushall. For an extensive list of redis-cli commands, check the link in the References section.</li></ul><pre>$ redis-cli -h localhost -p <strong>6666<br></strong>localhost:6666&gt; keys *</pre><pre>1) abc:xyz</pre><pre>2) 123:456</pre><pre>localhost:6666&gt; flushall</pre><pre>OK</pre><ul><li>The last step once you are done, stop and close the SSL tunnels.</li></ul><pre>sudo pkill stunnel</pre><p>Additionally, you can create an AMI of the ec2 instance after the above configurations and use it to spin up an instance as and when required.</p><p><strong>References:</strong></p><ul><li><a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Endpoints.html">https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Endpoints.html</a></li><li><a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/in-transit-encryption.html">https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/in-transit-encryption.html</a></li><li><a href="https://redis.io/topics/rediscli">https://redis.io/topics/rediscli</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=217f4b17c2c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>