<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tips &#8211; Otricks.com</title>
	<atom:link href="https://otricks.com/tag/tips/feed/" rel="self" type="application/rss+xml" />
	<link>https://otricks.com</link>
	<description>It&#039;s the big &#039;O&#039; in technology</description>
	<lastBuildDate>Sat, 27 Jun 2020 11:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>How to delete MySQL binlog files if you don&#8217;t have disk space left</title>
		<link>https://otricks.com/how-to-delete-mysql-binlog-files-if-you-dont-have-disk-space-left/</link>
		
		<dc:creator><![CDATA[Anjum Nawab]]></dc:creator>
		<pubDate>Thu, 23 Apr 2020 05:47:40 +0000</pubDate>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[JavaScript]]></category>
		<guid isPermaLink="false">https://otricks.com/?p=2351</guid>

					<description><![CDATA[<p>MySql does some really stupid stuff, often I feel like it&#8217;s no MY-SQL it SOMEONE-ELSE-SQL. Maybe it has some valid reasoning behind it, which I&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://otricks.com/how-to-delete-mysql-binlog-files-if-you-dont-have-disk-space-left/">How to delete MySQL binlog files if you don&#8217;t have disk space left</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>MySql does some really stupid stuff, often I feel like it&#8217;s no MY-SQL it SOMEONE-ELSE-SQL. Maybe it has some valid reasoning behind it, which I don&#8217;t know completely yet. One issue which often people encountered is  MySql binlog files.</p>



<p>These binlog files are very storage-intensive, most of the time for a small application each binlog file will be around 1.2GB.</p>



<p>Now imagine if you have 20GB disk-space it will eat up pretty much everything to the point where not a single kb is remaining for the server, if such thing happens, we even can&#8217;t run small commands like opening a file or editing a file etcetera.</p>



<p>As you can see in below image where It uses 100% of disk space 🙁  </p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="531" src="https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-23-at-9.03.10-1024x531.png" alt="" class="wp-image-2352" srcset="https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-23-at-9.03.10-1024x531.png 1024w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-23-at-9.03.10-300x156.png 300w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-23-at-9.03.10-768x398.png 768w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-23-at-9.03.10.png 1072w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Some blog suggested that we can delete those files using <code>myql></code> in terminal, however if you don&#8217;t have any space left we can&#8217;t even run <code>sql</code> in terminal.</p>



<h2 class="wp-block-heading">The right way to remove binlog files.</h2>



<p>If you are a root user to the system you can do following things to get it deleted in proper way.</p>



<p>login to the system via ssh and run below command, it will make you root user.</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">sudo -su</pre></div>



<p>Run <code>df -h</code> to check current disk space information, it will show you something like below. check <code>/dev/xvda1</code> section it consume all the space which I have it 🙁</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">Filesystem      Size  Used Avail Use% Mounted on
udev            236M     0  236M   0% /dev
tmpfs            49M  5.7M   44M  12% /run
/dev/xvda1       20G   20G     0 100% /
tmpfs           244M     0  244M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           244M     0  244M   0% /sys/fs/cgroup
/dev/loop0       92M   92M     0 100% /snap/core/8689
/dev/loop1       18M   18M     0 100% /snap/amazon-ssm-agent/1480
/dev/loop2       18M   18M     0 100% /snap/amazon-ssm-agent/1566
/dev/loop4       94M   94M     0 100% /snap/core/8935
tmpfs            49M     0   49M   0% /run/user/1000</pre></div>



<p>To get more information about your database usage you can run du -hs <code>/opt/bitnami/mysql/data</code> for me, it&#8217;s 16 bg, which is way too much for small application.</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">16G	/opt/bitnami/mysql/data</pre></div>



<p>To check all the big files (in space allocation) run below command, it will show list of culprits </p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">du -hs /opt/bitnami/*/*/* |sort -rh | head -35</pre></div>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">1.1G	/opt/bitnami/mysql/data/binlog.000017
1.1G	/opt/bitnami/mysql/data/binlog.000016
1.1G	/opt/bitnami/mysql/data/binlog.000015
1.1G	/opt/bitnami/mysql/data/binlog.000014
1.1G	/opt/bitnami/mysql/data/binlog.000013
1.1G	/opt/bitnami/mysql/data/binlog.000012
1.1G	/opt/bitnami/mysql/data/binlog.000011
1.1G	/opt/bitnami/mysql/data/binlog.000010
1.1G	/opt/bitnami/mysql/data/binlog.000009
1.1G	/opt/bitnami/mysql/data/binlog.000008
1.1G	/opt/bitnami/mysql/data/binlog.000007
1.1G	/opt/bitnami/mysql/data/binlog.000006
1.1G	/opt/bitnami/mysql/data/binlog.000003
1.0G	/opt/bitnami/mysql/data/binlog.000018
569M	/opt/bitnami/mysql/data/binlog.000004</pre></div>



<p>At this point you even can&#8217;t open file via <code>nano etc.txt</code> or preform any other operation in the system as no space is left.</p>



<p>You can delete <code>binlog.000001</code> to get some space, run <code>rm binlog.000001</code> once it&#8217;s deleted  you will be able to run <code>nano</code> command.</p>



<p>Now open binlog.index file using  <code>nano binlog.index</code> and remove all the entries of binlog.0xxx from binlog.index file, once done save it and exit.</p>



<p>Run below to remove all fu(king binlog files at once, if you want you can remove <code>mysqld.log</code> files to as it might not be any use. </p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">rm binlog.00*</pre></div>



<p>After this if you run <code>df -h</code> you will get your space back. check <code>/dev/xvda1</code> section 🙂</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">Filesystem      Size  Used Avail Use% Mounted on
udev            236M     0  236M   0% /dev
tmpfs            49M  5.7M   44M  12% /run
/dev/xvda1       20G  4.4G   15G  23% /
tmpfs           244M     0  244M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           244M     0  244M   0% /sys/fs/cgroup
/dev/loop0       92M   92M     0 100% /snap/core/8689
/dev/loop1       18M   18M     0 100% /snap/amazon-ssm-agent/1480
/dev/loop2       18M   18M     0 100% /snap/amazon-ssm-agent/1566
/dev/loop4       94M   94M     0 100% /snap/core/8935
tmpfs            49M     0   49M   0% /run/user/1000</pre></div>



<p>Hope this will be helpful to someone.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p> I go beyond boundaries that trap me. Attachments and limitations in thinking are removed and I see people as actors playing roles sometimes negative and sometimes positive and scenes as passing phases, sometimes negative and sometimes positive. This experience translates into power in the consciousness as well as in words and actions.</p></blockquote>



<p>You may check other informative article  https://otricks.com/responsiveness-in-reactive-programming/ </p>
<p>The post <a rel="nofollow" href="https://otricks.com/how-to-delete-mysql-binlog-files-if-you-dont-have-disk-space-left/">How to delete MySQL binlog files if you don&#8217;t have disk space left</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Reactive Programming : Understanding Responsiveness</title>
		<link>https://otricks.com/responsiveness-in-reactive-programming/</link>
		
		<dc:creator><![CDATA[Vijayakumar Mohan]]></dc:creator>
		<pubDate>Wed, 08 Apr 2020 06:24:00 +0000</pubDate>
				<category><![CDATA[Reactive Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[reactive programming]]></category>
		<guid isPermaLink="false">https://otricks.com/?p=2207</guid>

					<description><![CDATA[<p>Understand the key idea of responsiveness in reactive programming</p>
<p>The post <a rel="nofollow" href="https://otricks.com/responsiveness-in-reactive-programming/">Reactive Programming : Understanding Responsiveness</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>If you are a software developer, i am sure you might have heard of the term &#8220;Reactive Programming&#8221;.  In this article, I am going to give you an understanding of why reactive programming?</p>



<p><strong>Note</strong> : This article is technology agnostic and is mostly conceptual.</p>



<h2 class="wp-block-heading">What is reactive programming?</h2>



<p>Reactive Programming is a programming <a href="https://dictionary.cambridge.org/dictionary/english/paradigm">paradigm</a>, which helps you to build a reactive system. It advocates a declarative, event driven programming approach, modeled around &#8216;data flows&#8217; between computing components. </p>



<h2 class="wp-block-heading">What is a reactive system?</h2>



<p>A reactive system is a system, which has the below key characteristics. </p>



<ol class="wp-block-list"><li><strong>Responsive</strong> &#8211; Ability of a system to respond in a timely manner</li><li><strong>Resilient</strong> &#8211; Ability of a system to stay responsive even during failures</li><li><strong>Elastic</strong> &#8211; Ability of a system to stay responsive under varying workload</li><li><strong>Message driven</strong> &#8211; Reliance on message passing (think data flows) to communicate between different computing components in a system</li></ol>



<p>The key to reactive programming is in understanding the idea of &#8216;Responsiveness&#8217;. </p>



<h2 class="wp-block-heading">Understanding responsiveness</h2>



<p>The word responsive means &#8216;<strong>quick to react</strong>&#8216;. Responsiveness is the ability of a system to complete an assigned task, within a given time, appropriate for the task. Please note, the notion of completeness does not mean that the assigned task was successful. It could also mean that a given task could be a failure as well. A responsive system &#8216;<strong>responds</strong>&#8216; within a given time, irrespective of whether the assigned task was successful or unsuccessful.</p>



<p>Responsiveness is one of the primary goals of reactive programming.Let&#8217;s understand responsiveness by comparing to a man-made system. </p>



<h2 class="wp-block-heading">Example man-made system</h2>



<p>Bear with me for a moment. The below example is used to highlight important concerns, which I believe are pre-requisites for reactive programming.</p>



<p>Imagine a flower shop which sells the below products,</p>



<ol class="wp-block-list"><li><strong>Standard bouquets</strong> &#8211; Prepackaged bouquets with flower combination chosen by the shop. The shop is keen to sell more of these since they can serve more customers per unit time</li><li><strong>Custom bouquets</strong> &#8211; A customer can order a custom combination of flowers based on his/her preference. This product costs extra compared to the standard ones. It also incurs an extra delivery time</li></ol>



<p>This flower shop employs 2 staff who have the below responsibilities,</p>



<ol class="wp-block-list"><li><strong>Counter staff</strong> &#8211; The person responsible for accepting and delivering orders to the customer</li><li><strong>Packaging staff</strong> &#8211; The person who is responsible for packaging custom orders. When there are no custom orders, he / she will work on packaging the standard bouquets when required</li></ol>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="563" src="https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.44.13-AM-1024x563.png" alt="Reactive Programming : An example man-made system : Flower shop" class="wp-image-2314" srcset="https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.44.13-AM-1024x563.png 1024w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.44.13-AM-300x165.png 300w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.44.13-AM-768x423.png 768w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.44.13-AM-1536x845.png 1536w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.44.13-AM-2048x1127.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Flower shop &#8211; example man-made system</figcaption></figure>



<p>Given a flower shop system described above, let us define the following times which are inherent in such a system.</p>



<ol class="wp-block-list"><li><strong>Queue Wait Time (Customer)</strong> &#8211; The duration a customer waits in the queue to place an order</li><li><strong>Service Time</strong> &#8211; The duration it takes for the flower shop to full-fill an order</li><li><strong>Custom order queue time</strong> &#8211; The wait time for a custom order in queue for packaging</li><li><strong>Custom bouquet packaging time</strong> &#8211; The duration taken by the bouquet packager to package a custom request</li><li><strong>Overall Service time</strong> &#8211; The overall duration for a customer to complete his objective. This duration is the sum of the durations 1 to 4. Note that, duration 3 &amp; 4 above for standard product customers depend on other custom bouquet customers.</li></ol>



<h2 class="wp-block-heading">Not so responsive system</h2>



<p>Let&#8217;s assume that the flower shop chooses the following rules for servicing its customers,</p>



<ol class="wp-block-list"><li>The counter staff will wait for the customer&#8217;s order to be completely delivered, before taking on the next customer</li><li>Once packaging is complete, the packaging staff hands over the completed order to the counter staff for delivery</li></ol>



<p>Given these conditions , the follow are the characteristics of such a system</p>



<ol class="wp-block-list"><li>The customer queue length and time increases with more custom order requests</li><li>The Overall service time for a standard bouquet customer is dependent on the number of custom bouquet request before him/her</li><li>The number of customers the flower shop can service per hour, depends on the number of custom orders. As more custom orders come in, the less number of customers can be serviced per unit time.</li><li>The more the number of custom bouquet requests there are, the more idle time for the counter staff</li></ol>



<p>So given these characteristics, let us ponder about the responsiveness of such a system. </p>



<p>This system is unresponsive, as the customers can&#8217;t expect a standard overall service time in the illustration above.</p>



<p>If the number of custom bouquet requests are relatively less , then they may get a better service time. However this is entirely dependent on chance, which is not a desirable property to depend on. This system is also inefficient, because of the idle time of the counter staff. This inefficient design also reduces the throughput (the number of customers served in unit time) of the system. </p>



<h2 class="wp-block-heading">A responsive system</h2>



<p>Let us relook at the above mentioned flower shop with a slight redesign of the operations. The illustration below highlights the important changes made.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="563" src="https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.48.03-AM-1024x563.png" alt="Reactive Programming : A responsive system example" class="wp-image-2316" srcset="https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.48.03-AM-1024x563.png 1024w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.48.03-AM-300x165.png 300w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.48.03-AM-768x422.png 768w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.48.03-AM-1536x845.png 1536w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-07-at-7.48.03-AM-2048x1126.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>A responsive flower shop</figcaption></figure>



<p>Let&#8217;s make the below changes in this system,</p>



<ol class="wp-block-list"><li>The counter staff will guide the customer to a dedicated wait queue on taking a custom order</li><li>He/She then places the custom order to the packaging queue, and proceeds to service the next customer</li><li>On completing a custom bouquet request, the packaging staff delivers the package to the waiting customer, without bothering the counter staff.</li></ol>



<p>Such a system will then have the below characteristics which are different from the previous one in some key aspects.</p>



<ol class="wp-block-list"><li>This system serves more customers per unit time, since the counter staff spends less time waiting</li><li>Quicker service time for a standard bouquet customer since queue wait time is not dependent on the custom bouquet packaging</li><li>More efficient, since the idle time of the counter staff is very less compared to the previous one</li></ol>



<p>Overall the above system is more responsive than the previous one. Here the standard bouquet customer can expect a overall standard service time in comparison.</p>



<h2 class="wp-block-heading">Relevance to reactive programming</h2>



<p>The flower shop here serves as a metaphor for a computing system. Reactive programming emphasizes the resource oriented view of a computing system. For example the cpu cores, memory, storage subsystems etc. are all resources. These resources also have similar queueing characteristics of the flower shop mentioned above.</p>



<p>A typical software will use a number of these resources (cpu, memory, disc, network) to achieve its intended function. These software also interact with other software at runtime and so on. Such a system, is a network of interconnected, computing components working in coordination to achieve a bigger goal.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="619" src="https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-06-at-9.54.08-AM-1024x619.png" alt="Reactive programming : Software system as a network of computing components" class="wp-image-2245" srcset="https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-06-at-9.54.08-AM-1024x619.png 1024w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-06-at-9.54.08-AM-300x181.png 300w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-06-at-9.54.08-AM-768x464.png 768w, https://otricks.com/wp-content/uploads/2020/04/Screen-Shot-2020-04-06-at-9.54.08-AM.png 1162w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>A software system as a network of computing components</figcaption></figure>



<p>Which means any failure / delay due to a lack of resource availability will have a repercussion in the upstream computing component&#8217;s responsiveness.</p>



<p>The number of interconnected components is directly proportional to the availability and responsiveness of the computing system, unless carefully designed. A failure / delay in any intermediate component will have a direct impact on the system&#8217;s responsiveness and availability.</p>



<p>Reactive programming, requires you to think in terms of data flowing between computing components. This model allows you to build robust software which are responsive to delays and failures.</p>



<h2 class="wp-block-heading">Responsiveness in reactive programming</h2>



<p>Let&#8217;s now briefly look at how reactive programming proposes to solve the above mentioned responsiveness problem. </p>



<p>Reactive programming  forces the programmer to think of a system, as a set of connected computing components which,</p>



<ol class="wp-block-list"><li>Is aware of the <strong>limitedness of resources</strong> at its disposal</li><li><strong>Responds</strong> to requests in a <strong>timely fashion</strong></li><li><strong>Reacts</strong> to <strong>data flowing</strong> through them</li><li><strong>Self heal</strong> by automatically resisting data flow</li></ol>



<h2 class="wp-block-heading">Conclusion</h2>



<p>We have reached the end of this article. I hope i managed to convey the primary goal of reactive programming, which is &#8216;responsiveness&#8217;. Of course there is more to reactive programming. We can delve into other aspects of reactive programming in a later article. Until then, Bye for now!</p>
<p>The post <a rel="nofollow" href="https://otricks.com/responsiveness-in-reactive-programming/">Reactive Programming : Understanding Responsiveness</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to implement SSL Pinning in Ionic 5?</title>
		<link>https://otricks.com/how-to-implement-ssl-pinning-in-ionic-5-or-html5-app/</link>
		
		<dc:creator><![CDATA[Anjum Nawab]]></dc:creator>
		<pubDate>Thu, 26 Mar 2020 20:08:04 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mobile Apps]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[JavaScript]]></category>
		<guid isPermaLink="false">https://otricks.com/?p=2135</guid>

					<description><![CDATA[<p>When we develop ionic or HTML5 hybrid application often we ignore some of the goofy security stuff, however, when a client wants to do security&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://otricks.com/how-to-implement-ssl-pinning-in-ionic-5-or-html5-app/">How to implement SSL Pinning in Ionic 5?</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When we develop ionic or HTML5 hybrid application often we ignore some of the goofy security stuff, however, when a client wants to do security testing checkup, we need to implement many things which we really don&#8217;t care at the time of development, one of such thing is <a rel="noreferrer noopener" aria-label="SSL Pinning (opens in a new tab)" href="https://en.wikipedia.org/wiki/HTTP_Public_Key_Pinning" target="_blank">SSL Pinning</a> </p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>The pinning is an optional mechanism that can be used to improve the security of a service or site that relies on SSL Certificates. Pinning allows you to specify a cryptographic identity that should be accepted by users visiting your website </p></blockquote>



<p>It&#8217;s a two-part process, first, we need to get a certificate from our API server where we host our backend services. second,  we will need to implement SSL Pinning in the ionic app. Without further ado, let&#8217;s start the first part: </p>



<h2 class="wp-block-heading">Step 1: Get the SSL Certificate from API Server.</h2>



<p>Let&#8217;s pretend that our API server is <a rel="noreferrer noopener" aria-label="otricks.com (opens in a new tab)" href="https://otricks.com/" target="_blank">otricks.com</a> we can get an SSL certificate for the same, I will show you a very easy way to get it via <a rel="noreferrer noopener" aria-label="Firefox (opens in a new tab)" href="https://www.mozilla.org/en-US/firefox/new/" target="_blank">Firefox</a> browser.</p>



<p>Go to otricks.com or your API endpoint with https </p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="474" src="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.03-1024x474.png" alt="" class="wp-image-2138" srcset="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.03-1024x474.png 1024w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.03-300x139.png 300w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.03-768x355.png 768w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.03-1536x711.png 1536w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.03.png 1906w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large border: 1px solid #ddd"><img loading="lazy" decoding="async" width="1024" height="597" src="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.28-1024x597.png" alt="" class="wp-image-2139" srcset="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.28-1024x597.png 1024w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.28-300x175.png 300w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.28-768x448.png 768w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.28-1536x896.png 1536w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.28.png 1914w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="743" src="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.42-1024x743.png" alt="" class="wp-image-2140" srcset="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.42-1024x743.png 1024w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.42-300x218.png 300w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.42-768x557.png 768w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.42-1536x1114.png 1536w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-19.20.42-2048x1485.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>When you click on PEM(cert), it will download <strong><em>otricks-com.pem</em></strong> file which you can convert it to <strong><em>filename.cer</em></strong>  file extension. You need to have <a rel="noreferrer noopener" aria-label="OpenSSL (opens in a new tab)" href="https://www.openssl.org/" target="_blank">OpenSSL</a> tool install in your machine, I have it already in my Macbook Pro. You can google it and install it.</p>



<p>Open a terminal window and run below command which will convert <code>.pem</code> a file to <code>.cer</code> file, change &#8220;nameOfPemFile.pem &#8221; with your file and adjust the path accordingly. Once you run below command it will convert your <strong><em><code>pem</code></em></strong> file to <strong><em><code>cer</code></em></strong> file which we need for our next step.</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20" class="dashicon dashicons-admin-page"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">openssl x509 -inform PEM -in /Users/anjum/Downloads/nameOfPemFile.pem -outform DER -out /Users/anjum/Downloads/certificate.cer
</pre></div>



<h2 class="wp-block-heading">Step 2: Create a new Ionic 5 project.</h2>



<p>Let&#8217;s create a new empty project with the Ionic CLI tool</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20" class="dashicon dashicons-admin-page"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="powershell" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">ionic start sslpinning tabs
</pre></div>



<p>Open the project and edit the angular.json file add certificates block something like below. check app =&gt; architect =&gt; build =&gt; assets section.  This way Angular will copy our <code>certificates</code> inside <code>www</code> folder of ionic when we build project</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20" class="dashicon dashicons-admin-page"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="json" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">{
    "glob": "**/*",
    "input": "src/certificates",
    "output": "certificates"
},</pre></div>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="json" data-theme="monokai" data-fontsize="14" data-lines="10" data-showlines="true" data-copy="false">{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "defaultProject": "app",
  "newProjectRoot": "projects",
  "projects": {
    "app": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "www",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              {
                "glob": "**/*",
                "input": "src/assets",
                "output": "assets"
              },
              {
                "glob": "**/*",
                "input": "src/certificates",
                "output": "certificates"
              },
              {
                "glob": "**/*.svg",
                "input": "node_modules/ionicons/dist/ionicons/svg",
                "output": "./svg"
              }
            ],
            "styles": [
              {
                "input": "src/theme/variables.scss"
              },
              {
                "input": "src/global.scss"
              }
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ]
            },
            "ci": {
              "progress": false
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "app:build:production"
            },
            "ci": {
              "progress": false
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "app:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "styles": [],
            "scripts": [],
            "assets": [
              {
                "glob": "favicon.ico",
                "input": "src/",
                "output": "/"
              },
              {
                "glob": "**/*",
                "input": "src/assets",
                "output": "/assets"
              }
            ]
          },
          "configurations": {
            "ci": {
              "progress": false,
              "watch": false
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "tsconfig.app.json",
              "tsconfig.spec.json",
              "e2e/tsconfig.json"
            ],
            "exclude": ["**/node_modules/**"]
          }
        },
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "app:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "app:serve:production"
            },
            "ci": {
              "devServerTarget": "app:serve:ci"
            }
          }
        },
        "ionic-cordova-build": {
          "builder": "@ionic/angular-toolkit:cordova-build",
          "options": {
            "browserTarget": "app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "app:build:production"
            }
          }
        },
        "ionic-cordova-serve": {
          "builder": "@ionic/angular-toolkit:cordova-serve",
          "options": {
            "cordovaBuildTarget": "app:ionic-cordova-build",
            "devServerTarget": "app:serve"
          },
          "configurations": {
            "production": {
              "cordovaBuildTarget": "app:ionic-cordova-build:production",
              "devServerTarget": "app:serve:production"
            }
          }
        }
      }
    }
  },
  "cli": {
    "defaultCollection": "@ionic/angular-toolkit"
  },
  "schematics": {
    "@ionic/angular-toolkit:component": {
      "styleext": "scss"
    },
    "@ionic/angular-toolkit:page": {
      "styleext": "scss"
    }
  }
}
</pre></div>



<p>Let&#8217;s make <code>certificates</code> folder inside <code>src</code> folder and copy your .cer file inside it. please check the screenshot below for the folder structure.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="485" height="1024" src="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-23.04.06-485x1024.png" alt="" class="wp-image-2157" srcset="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-23.04.06-485x1024.png 485w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-23.04.06-142x300.png 142w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-23.04.06.png 648w" sizes="auto, (max-width: 485px) 100vw, 485px" /></figure>



<p>Now open the terminal and run <code>ionic cordova platform add android</code> to add an android platform. It will generate all related files and folders for android. Open the file <code>config.xml</code> and add below code inside the platform block.</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20" class="dashicon dashicons-admin-page"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="xml" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">&lt;platform name="android">
     &lt;!-- other tags will be here  -->
    &lt;resource-file src="src/certificates/certificate.cer" target="src/certificates/certificate.cer" />
&lt;/platform></pre></div>



<p>Next, we need to include the Cordova plugin for SSL Pinning, for that we will use <a rel="noreferrer noopener" href="https://github.com/silkimen/cordova-plugin-advanced-http" target="_blank">https://github.com/silkimen/cordova-plugin-advanced-http</a> plugin which is great.  Run below commands in the terminal to install the plugin in the project and we will also need ionic native too.</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20" class="dashicon dashicons-admin-page"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">ionic cordova plugin add cordova-plugin-advanced-http

npm install @ionic-native/http
</pre></div>



<p>Once done open <code>app.component.ts</code> file and add code inside <code>initializeApp()</code> function check below file </p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="typescript" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">import { Component } from '@angular/core';

import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

 
import { HTTP } from '@ionic-native/http/ngx'; //&lt;=== Import this 

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss']
})
export class AppComponent {
  constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
    private httpSSL: HTTP //&lt;=== define this too
  ) {
    this.initializeApp();
  }

  initializeApp() {
    this.platform.ready().then(() => {
      this.statusBar.styleDefault();
      this.splashScreen.hide();

      this.platform.ready() 
      .then(() => {
          
          
        this.httpSSL.setServerTrustMode("pinned") //&lt;=== Add this function 
          .then(() => {
              console.log("Congratulaions, you have set up SSL Pinning.")
          })
          .catch(() => {
              console.error("Opss, SSL pinning failed.")
          });
          
          
      })

    });
  }
}
</pre></div>



<p>Now create new service folder to keep all our http service at one place something like below and create <code>api.service.ts</code> file </p>



<figure class="wp-block-image size-medium"><img loading="lazy" decoding="async" width="300" height="138" src="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-23.29.54-300x138.png" alt="" class="wp-image-2160" srcset="https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-23.29.54-300x138.png 300w, https://otricks.com/wp-content/uploads/2020/03/Screen-Shot-2020-03-26-at-23.29.54.png 578w" sizes="auto, (max-width: 300px) 100vw, 300px" /></figure>



<p><code>api.service.ts</code></p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="typescript" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">import { Injectable } from '@angular/core';
import { HTTP } from '@ionic-native/http/ngx';

@Injectable({
  providedIn: 'root'
})
export class ApiService {
    
    readonly  apiEndPoint = 'https://otricks.com/api/user';
    readonly  fakeEndPoint = 'http://www.google.com/api/xyz'
    
    // This will get work with SSL Pinning becuase API endpoint is same as our certificate 
    getDataFromActualAPi(){
        return this.http.get(`apiEndPoint`,{}, {});
    }
    
    
    // This call will be fail as the domain is not correct according to our certificate.
    getDataFromFakeApi(){
        return this.http.get(`fakeEndPoint`,{}, {});
    }

}</pre></div>



<p></p>



<p>When you call this API service in the component <code>getDataFromActualAPi()</code> will return your correct response, however, if you try to call <code>getDataFromFakeApi()</code> the function will fail as the provided certificate is not from this domain.</p>



<p>The system will throw below error message, you can check in the debugger console.</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="javascript" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">{status: -2, error: "TLS connection could not be established: javax.net…n: Trust anchor for certification path not found."}
error: "TLS connection could not be established: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found."
status: -2
}</pre></div>



<p>Hope this will help someone 🙂  if you like this article you may want to check how to <a href="https://otricks.com/how-to-secure-your-ubuntu-server-from-brute-force-attacks/">protect your server </a></p>





<p></p>
<p>The post <a rel="nofollow" href="https://otricks.com/how-to-implement-ssl-pinning-in-ionic-5-or-html5-app/">How to implement SSL Pinning in Ionic 5?</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Best &#038; free google chrome plugin with HD wallpaper, world time, quotes with many more..</title>
		<link>https://otricks.com/replace-your-boring-chrome-tab-screen-with-an-amazing-tab-it-has-lots-of-features-functionality-install-it-get-amazed/</link>
		
		<dc:creator><![CDATA[Anjum Nawab]]></dc:creator>
		<pubDate>Sat, 14 Mar 2020 14:18:43 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[plugin]]></category>
		<guid isPermaLink="false">https://otricks.com/?p=2075</guid>

					<description><![CDATA[<p>When we start a new page/ new tab, we want something amazing from the chrome tab. A great HD wallpaper with clocks/ Timers world time&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://otricks.com/replace-your-boring-chrome-tab-screen-with-an-amazing-tab-it-has-lots-of-features-functionality-install-it-get-amazed/">Best &#038; free google chrome plugin with HD wallpaper, world time, quotes with many more..</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When we start a new page/ new tab, we want something amazing from the chrome tab. A great HD wallpaper with clocks/ Timers world time with different timezones, custom images with dynamically generated patterns.</p>



<p>We have covered all the great features including, world&#8217;s best photo from great photographers, best quotes to get motivated and inspire every day, add new abstract patterns to show your creativity and imagination, view the current time and set world clock with a different timezone that could be useful if you are working on multiple locations and want to see a quick time.</p>



<p>New Amazing Tab will be free forever for people like you and me</p>



<p>Features list</p>



<ul class="wp-block-list"><li>Get amazed with a fresh image every day from world-class photographers.</li><li>Create wallpaper patterns, to show your creative side. save created pattern into a photo album.</li><li>Change wallpaper image or set your own image as a wallpaper image.</li><li>Set Image change on every new tab open or every hour.</li><li>Search images from millions of images and set as wallpaper.</li><li>Get images from already crafted categories to suit your choice.</li><li>Set multiple clocks to have different timezones time with your custom names.</li><li>Set master clock with different styles, such as Rotary clock, Classical clock, Digital clock, and 3D clock.</li><li>Get motivated every day with the best quotes, you can change or add to favorite your quote.</li><li>Set Salat times (Muslim prayer) based on your current location or set the different locations of your choice.</li></ul>



<p>Please download it from the chrome store and provide your feedback.</p>



<pre class="wp-block-preformatted"><a href="https://chrome.google.com/webstore/detail/new-amazing-tab/ekbpbniminfcdefejlmipbdcnoblhamb?h1=en" class="rank-math-link">https://chrome.google.com/webstore/detail/new-amazing-tab/ekbpbniminfcdefejlmipbdcnoblhamb?h1=en</a></pre>



<figure class="wp-block-gallery aligncenter columns-3 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img loading="lazy" decoding="async" width="640" height="400" src="https://otricks.com/wp-content/uploads/2020/03/tab-5.jpg" alt="" data-id="2079" data-full-url="https://otricks.com/wp-content/uploads/2020/03/tab-5.jpg" data-link="https://otricks.com/?attachment_id=2079" class="wp-image-2079" srcset="https://otricks.com/wp-content/uploads/2020/03/tab-5.jpg 640w, https://otricks.com/wp-content/uploads/2020/03/tab-5-300x188.jpg 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure></li><li class="blocks-gallery-item"><figure><img loading="lazy" decoding="async" width="640" height="400" src="https://otricks.com/wp-content/uploads/2020/03/tab-2.jpg" alt="" data-id="2082" data-full-url="https://otricks.com/wp-content/uploads/2020/03/tab-2.jpg" data-link="https://otricks.com/?attachment_id=2082" class="wp-image-2082" srcset="https://otricks.com/wp-content/uploads/2020/03/tab-2.jpg 640w, https://otricks.com/wp-content/uploads/2020/03/tab-2-300x188.jpg 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure></li><li class="blocks-gallery-item"><figure><img loading="lazy" decoding="async" width="640" height="400" src="https://otricks.com/wp-content/uploads/2020/03/tab-3.jpg" alt="" data-id="2081" data-full-url="https://otricks.com/wp-content/uploads/2020/03/tab-3.jpg" data-link="https://otricks.com/?attachment_id=2081" class="wp-image-2081" srcset="https://otricks.com/wp-content/uploads/2020/03/tab-3.jpg 640w, https://otricks.com/wp-content/uploads/2020/03/tab-3-300x188.jpg 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure></li><li class="blocks-gallery-item"><figure><img loading="lazy" decoding="async" width="640" height="400" src="https://otricks.com/wp-content/uploads/2020/03/tab-1.jpg" alt="" data-id="2078" data-full-url="https://otricks.com/wp-content/uploads/2020/03/tab-1.jpg" data-link="https://otricks.com/?attachment_id=2078" class="wp-image-2078" srcset="https://otricks.com/wp-content/uploads/2020/03/tab-1.jpg 640w, https://otricks.com/wp-content/uploads/2020/03/tab-1-300x188.jpg 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure></li><li class="blocks-gallery-item"><figure><img loading="lazy" decoding="async" width="640" height="400" src="https://otricks.com/wp-content/uploads/2020/03/tab-4.jpg" alt="" data-id="2080" data-full-url="https://otricks.com/wp-content/uploads/2020/03/tab-4.jpg" data-link="https://otricks.com/?attachment_id=2080" class="wp-image-2080" srcset="https://otricks.com/wp-content/uploads/2020/03/tab-4.jpg 640w, https://otricks.com/wp-content/uploads/2020/03/tab-4-300x188.jpg 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure></li></ul></figure>
<p>The post <a rel="nofollow" href="https://otricks.com/replace-your-boring-chrome-tab-screen-with-an-amazing-tab-it-has-lots-of-features-functionality-install-it-get-amazed/">Best &#038; free google chrome plugin with HD wallpaper, world time, quotes with many more..</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to secure your Ubuntu server from brute-force attacks?.</title>
		<link>https://otricks.com/how-to-secure-your-ubuntu-server-from-brute-force-attacks/</link>
		
		<dc:creator><![CDATA[Anjum Nawab]]></dc:creator>
		<pubDate>Tue, 10 Mar 2020 11:52:55 +0000</pubDate>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">https://otricks.com/?p=2057</guid>

					<description><![CDATA[<p>Nowadays more and more people and organizations are going on the cloud for their applications, and its very common practice to have a server on&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://otricks.com/how-to-secure-your-ubuntu-server-from-brute-force-attacks/">How to secure your Ubuntu server from brute-force attacks?.</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Nowadays more and more people and organizations are going on the cloud for their applications, and its very common practice to have a server on the cloud. As more people are using cloud solutions so do more attackers are after them.</p>



<p>According to Ubuntu data, there are around at least 20 million users are using Ubuntu and that&#8217;s a very big number. It would be a gold mine for attackers who keep trying to get access to your server using a brute-force attack, for those who don&#8217;t know what the hack is brute-force attack?. its an attempt to crack username and password, using trial and error approach with the hope to get it correct for multiple time, if you keep your password or username very generic or easy to guess they might get into your system.</p>



<p>It&#8217;s a very old attack method, however, it&#8217;s still very effective and popular within the hacker community.    You can read more about brute-force attack here.<a rel="noreferrer noopener" target="_blank" href="https://en.wikipedia.org/wiki/Brute-force_attack">https://en.wikipedia.org/wiki/Brute-force_attack</a></p>



<p>It&#8217;s always a better idea to secure your system/service/server from such wicked people. Let&#8217;s get it done.</p>



<p>I will be using my  Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-88-generic x86_64) machine.</p>



<p>Update your system first running below commands in the terminal, my assumption is you are already logged in with Root access using SSH.</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-admin-page" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">apt-get update
apt-get upgrade</pre></div>



<p>After a system update add Fail2ban, which is an invasion blocking software framework that protects servers from brute-force attacks, it&#8217;s written in the Python.</p>



<p>Fail2Ban scans log files like /var/log/auth.log and bans IP addresses conducting too many failed login attempts. It does this by updating system firewall rules to reject new connections from those IP addresses, for a configurable amount of time. </p>



<p>Fail2Ban comes out-of-the-box ready to read many standard log files, such as those for sshd and Apache, and is easily configured to read any log file of your choosing, for any error you wish.</p>



<p>Though Fail2Ban is able to reduce the rate of incorrect authentication attempts, it cannot eliminate the risk presented by weak authentication. Set up services to use only two factor, or public/private authentication mechanisms if you really want to protect services.</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-admin-page" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">
apt-get install fail2ban</pre></div>



<p>Copy the configuration file and do changes </p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-admin-page" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local</pre></div>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-admin-page" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">
sudo nano /etc/fail2ban/jail.local</pre></div>



<p></p>



<p>Change the ban time from 600 (10 minutes) to 604800 (7 days) is guess this would be more than enough to have peaceful nights 🙂</p>



<p>Nest step is to install logwatch is the tool the aggregate all system logs and make meaningful decisions. </p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-admin-page" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">
apt-get install logwatch</pre></div>



<p>Logwatch can be configurated to trigger a daily email of your logs.</p>



<p></p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-admin-page" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">nano /etc/cron.daily/00logwatch</pre></div>



<p>Add below line at the bottom of the cron job file and replace the example email with your own address. </p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-admin-page" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="sh" data-theme="monokai" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="true">/usr/sbin/logwatch --output mail --mailto mail@example.com --detail high</pre></div>
<p>The post <a rel="nofollow" href="https://otricks.com/how-to-secure-your-ubuntu-server-from-brute-force-attacks/">How to secure your Ubuntu server from brute-force attacks?.</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Manage Multiple version of Node in a single machine</title>
		<link>https://otricks.com/manage-multiple-version-of-node-in-a-single-machine/</link>
		
		<dc:creator><![CDATA[Anjum Nawab]]></dc:creator>
		<pubDate>Fri, 06 Mar 2020 13:32:07 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Nodejs]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[Tips]]></category>
		<guid isPermaLink="false">https://otricks.com/?p=2049</guid>

					<description><![CDATA[<p>When we start using node.js as our primary framework for writing multiple applications, Over the time it will be really pain in the neck, to&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://otricks.com/manage-multiple-version-of-node-in-a-single-machine/">Manage Multiple version of Node in a single machine</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When we start using node.js as our primary framework for writing multiple applications, Over the time it will be really pain in the neck, to manage older projects or projects with different node versions. </p>



<p>While working on angularjs to angualr 9 or ionic to ionic 5, I have a variety of node versions in different projects. Node community has also faced similar problems, to rescue there is a package to manage different versions of the node in a single computer, without uninstalling or re-installing your required version.</p>



<p>  You can install <a href="https://github.com/nvm-sh/nvm" class="rank-math-link">https://github.com/nvm-sh/nvm</a> in your computer to manage node</p>



<p>Once install its very easy to change your desire node version. To download, compile, and install the latest release of the node, do this:</p>



<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><div style="position:absolute;top:-20px;right:0px;cursor:pointer" class="copy-simple-code-block"><svg aria-hidden="true" role="img" focusable="false" class="dashicon dashicons-admin-page" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewbox="0 0 20 20"><path d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path></svg></div><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="javascript" data-theme="monokai" data-fontsize="12" data-lines="Infinity" data-showlines="true" data-copy="true">nvm install node # "node" is an alias for the latest version</pre></div>
<p>The post <a rel="nofollow" href="https://otricks.com/manage-multiple-version-of-node-in-a-single-machine/">Manage Multiple version of Node in a single machine</a> appeared first on <a rel="nofollow" href="https://otricks.com">Otricks.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
