<?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>ci/cd Archives - Tech Chronicles</title>
	<atom:link href="http://kostacipo.stream/tag/ci-cd/feed/" rel="self" type="application/rss+xml" />
	<link>https://kostacipo.stream/tag/ci-cd/</link>
	<description>Ramblings of a Tech Dude</description>
	<lastBuildDate>Tue, 16 Feb 2021 21:34:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>

<image>
	<url>https://kostacipo.stream/wp-content/uploads/2019/12/cropped-profile-32x32.jpg</url>
	<title>ci/cd Archives - Tech Chronicles</title>
	<link>https://kostacipo.stream/tag/ci-cd/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is DevOps?</title>
		<link>http://kostacipo.stream/what-is-devops/</link>
					<comments>http://kostacipo.stream/what-is-devops/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Tue, 16 Feb 2021 21:34:22 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[ci/cd]]></category>
		<category><![CDATA[devops]]></category>
		<guid isPermaLink="false">http://kostacipo.stream/?p=2045</guid>

					<description><![CDATA[<p>DevOps is the simplification or automation of established IT processes. Here&#8217;s a brief tutorial to understand and get started with DevOps. DevOps… CI/CD… Docker… Kubernetes… I&#8217;m sure you&#8217;ve been bombarded with these words a lot the past year. Seems like the entire world is talking about it. The rate at which this segment is progressing, [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/what-is-devops/">What is DevOps?</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>DevOps is the simplification or automation of established IT processes.</h3>
<h5>Here&#8217;s a brief tutorial to understand and get started with DevOps.</h5>
<p data-selectable-paragraph="">DevOps… CI/CD… Docker… Kubernetes… I&#8217;m sure you&#8217;ve been bombarded with these words a lot the past year. Seems like the entire world is talking about it. The rate at which this segment is progressing, it won&#8217;t be long before we reach the stage of NoOps. It&#8217;s about time we break down what DevOps really is.</p>
<p data-selectable-paragraph="">The objective of this article is to set a solid foundation for you to build on top of. So let&#8217;s start with the obvious question.</p>
<h2 data-selectable-paragraph="">What is DevOps?</h2>
<blockquote>
<p data-selectable-paragraph="">DevOps is the simplification or automation of <strong>established IT processes.</strong></p>
</blockquote>
<p data-selectable-paragraph="">I&#8217;ve seen so many people start this journey to adopt DevOps to only find themselves lost. There seems to be a pattern to this.</p>
<p data-selectable-paragraph="">It usually starts with a video on how a fancy tech startup has automated its release cycle. Deployments happen automatically once all the tests pass. Rollbacks, in case of failures, is automatic. Thousands of simultaneous A/B test is driving up customer engagement.</p>
<p data-selectable-paragraph="">We all are tired of releasing a new version like it&#8217;s a rollercoaster ride.</p>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354587-devops-rollercoaster.png" alt="The DevOps rollercoaster" data-image="true" data-new="false" data-sizeformatted="179.5 kB" data-mimetype="image/png" data-creationdate="1611506359500" data-creationdateformatted="01/24/2021 04:39 PM" data-type="temp" data-url="/storage/temp/14354587-devops-rollercoaster.png" data-modificationdate="null" data-size="179456" data-name="devops-rollercoaster.png" data-id="14354587" data-src="/storage/temp/14354587-devops-rollercoaster.png" /></div>
</figure>
<p data-selectable-paragraph="">Unfortunately, DevOps doesn&#8217;t work that way. DevOps isn&#8217;t a magic wand that can solve all your problems in an instant.</p>
<p data-selectable-paragraph="">Instead, it is a systematic process of choosing the right tools and technology to get the job done.</p>
<h3 data-selectable-paragraph="">All of This Starts With a Process</h3>
<p data-selectable-paragraph="">It doesn&#8217;t matter what the process is. It could be simplifying the deployment of your app or automate testing. Whatever your process is, the act of making your life easier is what DevOps is all about.</p>
<p data-selectable-paragraph="">But you always need to start with a process.</p>
<p data-selectable-paragraph="">In fact, <em>if your process cannot be done manually (on a smaller scale), you should probably re-examine your process.</em></p>
<p data-selectable-paragraph="">I mean it.</p>
<p data-selectable-paragraph="">Enough talking. Let&#8217;s take a real-world example to understand things better.</p>
<h2 data-selectable-paragraph="">Let&#8217;s Take a Real DevOps Example</h2>
<p data-selectable-paragraph="">Let&#8217;s take a simple example of <em>making a </em><a href="https://nodejs.org/en/" target="_blank" rel="noopener nofollow"><em>Nodejs</em></a><em> app live on a VM in the cloud</em>.</p>
<h3 data-selectable-paragraph="">The Process</h3>
<p data-selectable-paragraph="">Here&#8217;s what our process looks like:</p>
<ul>
<li data-selectable-paragraph=""><strong>Start with the source code:</strong> This is our source of truth. We can run our process from anywhere as long as we have access to the source code.</li>
<li data-selectable-paragraph=""><strong>Build an Artifact:</strong> We then package our source code to build an <a href="https://en.wikipedia.org/wiki/Artifact_(software_development)" target="_blank" rel="noopener nofollow">Artifact</a>. In the case of a compiled language, the compiled output (JAR file, in the case of JAVA) would be our artifact. In our case, our source code itself is the artifact to be released.</li>
<li data-selectable-paragraph=""><strong>Publish to an Artifact Repository:</strong> Next, we push our artifact to a repository. This is a location from where our target environment can pull the artifact from. We could stick with something like <a href="https://github.com/" target="_blank" rel="noopener nofollow">Github</a> since we are working with source code here.</li>
<li data-selectable-paragraph=""><strong>Pull and run your app:</strong> Finally, we pull the artifact onto our VM and schedule a Nodejs process by running <code>npm start</code>.</li>
</ul>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354591-devops-deploy-node-app-on-vm.png" alt="process diagram" data-image="true" data-new="false" data-sizeformatted="52.5 kB" data-mimetype="image/png" data-creationdate="1611506405487" data-creationdateformatted="01/24/2021 04:40 PM" data-type="temp" data-url="/storage/temp/14354591-devops-deploy-node-app-on-vm.png" data-modificationdate="null" data-size="52531" data-name="devops-deploy-node-app-on-vm.png" data-id="14354591" data-src="/storage/temp/14354591-devops-deploy-node-app-on-vm.png" /></div>
</figure>
<p data-selectable-paragraph="">It&#8217;s okay if you do things a slightly different way. We are here to focus on the journey and not the destination.</p>
<h2 data-selectable-paragraph="">Our First DevOps Project</h2>
<p data-selectable-paragraph="">Let&#8217;s not do anything fancy here.</p>
<p data-selectable-paragraph="">The easiest way to automate this process would be to write a simple <a href="https://en.wikipedia.org/wiki/Shell_script" target="_blank" rel="noopener nofollow">shell script</a> to run all the commands in sequence.</p>
<p data-selectable-paragraph=""><strong>Congratulations!!! That&#8217;s our first DevOps project!!!</strong></p>
<p data-selectable-paragraph="">I know shell scripts sounds too simple to be taken seriously. I suspect you already have such scripts in place. But believe me, that&#8217;s DevOps!</p>
<p data-selectable-paragraph="">Don’t worry; we will get to the fancy stuff in a minute. But it&#8217;s important to understand that this is how DevOps works.</p>
<h2 data-selectable-paragraph="">Importance of Repeatability</h2>
<p data-selectable-paragraph="">Let me ask you one question. Which one of these would you prefer?</p>
<ul>
<li data-selectable-paragraph="">An automated deployments pipeline which works 60% of the time, or,</li>
<li data-selectable-paragraph="">A boring shell script that gets the job done every time it&#8217;s executed.</li>
</ul>
<p data-selectable-paragraph="">If you have dealt with production failures in the middle of the night, you&#8217;ll choose the shell script.</p>
<p data-selectable-paragraph="">The reason is simple.</p>
<p data-selectable-paragraph=""><strong>Reliability is far more critical than the degree of automation.</strong></p>
<p data-selectable-paragraph="">In other words,</p>
<blockquote>
<p data-selectable-paragraph="">A DevOps process must be able to produce consistent results every time it&#8217;s run.</p>
</blockquote>
<h3 data-selectable-paragraph="">Making Our Process Repeatable</h3>
<p data-selectable-paragraph="">Let&#8217;s take the example of our shell script.</p>
<p data-selectable-paragraph="">Currently, our shell script depends on Node.js to be installed on the VM we want to deploy the app to.</p>
<p data-selectable-paragraph="">What would happen if the Nodejs runtime was missing? These days, an incorrect version of the runtime is enough to break our application.</p>
<p data-selectable-paragraph="">This problem only gets worse in <a href="https://en.wikipedia.org/wiki/Polyglot_(computing)" target="_blank" rel="noopener nofollow">polyglot environments</a> where we deal with multiple programming languages.</p>
<p data-selectable-paragraph="">A simple solution would be to <em>archive the Nodejs runtime along with our source code</em> in a zip file. The zip file can then be sent to the VM. This way, the VM can use the local Nodejs runtime present in the archive to run our app.</p>
<p data-selectable-paragraph="">Luckily, there is a tool to make our lives easier.</p>
<h2 data-selectable-paragraph="">In Comes Docker and Containers</h2>
<p data-selectable-paragraph="">If you are new to this, think of <a href="https://www.docker.com/" target="_blank" rel="noopener nofollow">Docker</a> as a way to package your artifact along with all its OS dependencies, including Nodejs, into a container image.</p>
<p data-selectable-paragraph="">Using containers, we can deploy any application on a VM which has Docker installed.</p>
<p data-selectable-paragraph="">With Docker, our flow will look something like this:</p>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354592-devops-deployment-process-with-docker.png" alt="Docker flow should look something like this." data-image="true" data-new="false" data-sizeformatted="59.4 kB" data-mimetype="image/png" data-creationdate="1611506421880" data-creationdateformatted="01/24/2021 04:40 PM" data-type="temp" data-url="/storage/temp/14354592-devops-deployment-process-with-docker.png" data-modificationdate="null" data-size="59437" data-name="devops-deployment-process-with-docker.png" data-id="14354592" data-src="/storage/temp/14354592-devops-deployment-process-with-docker.png" /></div>
</figure>
<p data-selectable-paragraph="">There is a lot more to containers than just this. However, this was one of the reasons why containers got so popular.</p>
<h3 data-selectable-paragraph="">Docker Vs. Containers</h3>
<p data-selectable-paragraph="">Let me clarify this. Docker and containers are not the same things anymore.</p>
<blockquote>
<p data-selectable-paragraph="">Docker is a set of utility tools to build and ship container images which container runtimes like <a href="https://containerd.io/" target="_blank" rel="noopener nofollow">containerd</a> use to make and run containers.</p>
</blockquote>
<p data-selectable-paragraph="">Many are concerned about the future of Docker, given the <a href="https://kubernetes.io/blog/2020/12/02/dont-panic-kubernetes-and-docker/" target="_blank" rel="noopener nofollow">recent events</a> which have taken place.</p>
<p data-selectable-paragraph="">It is important to understand that Docker is not going anywhere anytime soon. It <em>provides the best DX</em> and will <em>continue to play a major role in building and shipping container images</em>.</p>
<h2 data-selectable-paragraph="">Getting Serious With DevOps</h2>
<p data-selectable-paragraph="">We have made some serious progress already. Hopefully, we understand how Docker fits into the DevOps process.</p>
<p data-selectable-paragraph="">It&#8217;s time to take things to the next level.</p>
<h3 data-selectable-paragraph="">Triggering Deployment Based on Events</h3>
<p data-selectable-paragraph="">Our script looks pretty solid, but it&#8217;s still triggered manually.</p>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354593-devops-trigger-automation-manual.png" alt="Developer &gt; Shell Script &gt; VM" data-image="true" data-new="false" data-sizeformatted="49.5 kB" data-mimetype="image/png" data-creationdate="1611506443799" data-creationdateformatted="01/24/2021 04:40 PM" data-type="temp" data-url="/storage/temp/14354593-devops-trigger-automation-manual.png" data-modificationdate="null" data-size="49537" data-name="devops-trigger-automation-manual.png" data-id="14354593" data-src="/storage/temp/14354593-devops-trigger-automation-manual.png" /></div>
</figure>
<p data-selectable-paragraph="">Wouldn&#8217;t it be great if we could trigger this script automatically whenever someone pushes code on GitHub? In other words, we want to trigger this script on an event.</p>
<p data-selectable-paragraph="">GitHub can <a href="https://docs.github.com/en/developers/webhooks-and-events" target="_blank" rel="noopener nofollow">invoke webhooks</a> on a certain set of events.</p>
<p data-selectable-paragraph="">To achieve this, we need to make a simple HTTP server that executes our shell script whenever its endpoint is hit. We can configure GitHub to hit our endpoint on the <a href="https://docs.github.com/en/developers/webhooks-and-events/github-event-types#pushevent" target="_blank" rel="noopener nofollow">Push Event</a>.</p>
<p data-selectable-paragraph="">Let&#8217;s call this server <em>Colorful Daemons</em> or <em>CD</em>.</p>
<p data-selectable-paragraph="">Our new flow will look something like this:</p>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354594-devops-trigger-automation-cd.png" alt="Source Code to Server diagram" data-image="true" data-new="false" data-sizeformatted="62.4 kB" data-mimetype="image/png" data-creationdate="1611506463327" data-creationdateformatted="01/24/2021 04:41 PM" data-type="temp" data-url="/storage/temp/14354594-devops-trigger-automation-cd.png" data-modificationdate="null" data-size="62420" data-name="devops-trigger-automation-cd.png" data-id="14354594" data-src="/storage/temp/14354594-devops-trigger-automation-cd.png" /></div>
</figure>
<p data-selectable-paragraph="">Congratulations! You just set up what we call a <em>CD pipeline</em>.</p>
<p data-selectable-paragraph="">And no… I don&#8217;t mean Colorful Daemons. I&#8217;m talking about <a href="https://en.wikipedia.org/wiki/Continuous_deployment" target="_blank" rel="noopener nofollow">Continous Deployments</a>.</p>
<blockquote>
<p data-selectable-paragraph="">Continuous Deployments is a piece of software responsible for taking your app from something like GitHub all the way to your target environment where it finally gets deployed.</p>
</blockquote>
<p data-selectable-paragraph="">This is basically the CI/CD stuff you keep hearing about. When people talk about tools like Jenkins and CircleCI, they are usually referring to CI/CD.</p>
<p data-selectable-paragraph="">What we just made with Colorful Daemons was a continuous deployments pipeline. Don&#8217;t confuse it with continuous integration or delivery. We&#8217;ll get to those some other day.</p>
<h2 data-selectable-paragraph="">The DevOps Pattern</h2>
<p data-selectable-paragraph="">I guess you&#8217;ve already found a pattern here. We start with a process, find a section we aren’t happy with and then introduce some software component to simplify or automate it.</p>
<p data-selectable-paragraph="">That&#8217;s getting the <em>dev in ops</em>. And that&#8217;s all that there is to it.</p>
<p data-selectable-paragraph="">This is the real answer to the question, &#8216;<em>What is DevOps?.&#8217;</em></p>
<h2 data-selectable-paragraph="">Introducing Container Orchestration</h2>
<p data-selectable-paragraph="">Let&#8217;s finish up by making one small improvement.</p>
<p data-selectable-paragraph="">Till now, we have been dealing with deploying our app to a single VM or a single node. What if we wanted to <em>deploy our app to multiple nodes?</em></p>
<p data-selectable-paragraph="">The easiest way to achieve this would be to modify our CD server to ssh into all the VMs and deploy our container to each one of them.</p>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354596-devops-deploy-to-multiple-vms-cd.png" alt="Deployment from Github" data-image="true" data-new="false" data-sizeformatted="69.4 kB" data-mimetype="image/png" data-creationdate="1611506491877" data-creationdateformatted="01/24/2021 04:41 PM" data-type="temp" data-url="/storage/temp/14354596-devops-deploy-to-multiple-vms-cd.png" data-modificationdate="null" data-size="69429" data-name="devops-deploy-to-multiple-vms-cd.png" data-id="14354596" data-src="/storage/temp/14354596-devops-deploy-to-multiple-vms-cd.png" /></div>
</figure>
<p data-selectable-paragraph="">While this method works, <strong>we&#8217;ll need to change our script every time our infrastructure changes</strong>. In a world where <em>applications are always autoscaling,</em> and <em>VMs are considered disposable</em>, this is unacceptable.</p>
<p data-selectable-paragraph="">A better way would be to make another HTTP server to track infrastructure changes. We can call this server <em>&#8216;</em><em>Pilot.&#8217;</em></p>
<p data-selectable-paragraph="">This server will be responsible for performing health checks on the various VMs in our cluster to maintain a list of active VMs. It could even communicate with the cloud vendor to make things more robust.</p>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354597-devops-deploy-to-multiple-vms-pilot.png" alt="Pilot diagram" data-image="true" data-new="false" data-sizeformatted="65.2 kB" data-mimetype="image/png" data-creationdate="1611506510994" data-creationdateformatted="01/24/2021 04:41 PM" data-type="temp" data-url="/storage/temp/14354597-devops-deploy-to-multiple-vms-pilot.png" data-modificationdate="null" data-size="65214" data-name="devops-deploy-to-multiple-vms-pilot.png" data-id="14354597" data-src="/storage/temp/14354597-devops-deploy-to-multiple-vms-pilot.png" /></div>
</figure>
<p data-selectable-paragraph="">Pilot will expose an endpoint as well to accept the details of the container to spawn. It can then talk to the various VMs to get the job done.</p>
<p data-selectable-paragraph="">Now, our CD server can simply request Pilot instead of talking to each VM individually.</p>
<p data-selectable-paragraph="">Our new flow will look something like this:</p>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354598-devops-deploy-to-multiple-vms-process.png" alt="Another new flow, to two servers!" data-image="true" data-new="false" data-sizeformatted="84.0 kB" data-mimetype="image/png" data-creationdate="1611506532707" data-creationdateformatted="01/24/2021 04:42 PM" data-type="temp" data-url="/storage/temp/14354598-devops-deploy-to-multiple-vms-process.png" data-modificationdate="null" data-size="83976" data-name="devops-deploy-to-multiple-vms-process.png" data-id="14354598" data-src="/storage/temp/14354598-devops-deploy-to-multiple-vms-process.png" /></div>
</figure>
<p data-selectable-paragraph="">The second server, Pilot, is called a container orchestrator. That&#8217;s what <a href="https://kubernetes.io/" target="_blank" rel="noopener nofollow">Kubernetes</a> is!</p>
<p data-selectable-paragraph="">You just designed a mini version of Kubernetes!</p>
<p data-selectable-paragraph="">Also, Kubernetes is greek for Pilot. Isn&#8217;t that a pleasant co-incidence?</p>
<h2 data-selectable-paragraph="">Where to Start?</h2>
<p data-selectable-paragraph="">We covered quite a few tools together. This brings me to my last point. Ever wondered why the DevOps space is so fragmented?</p>
<p data-selectable-paragraph="">If you think about it, there are so many tools out there, making it hard to decide: what&#8217;s the right choice or where you should even start?</p>
<figure>
<div tabindex="0"><img decoding="async" class="fr-fic fr-dib lazyloaded" src="https://dzone.com/storage/temp/14354599-devops-landscape.png" alt="Where do you start? Roadmap" data-image="true" data-new="false" data-sizeformatted="97.4 kB" data-mimetype="image/png" data-creationdate="1611506544158" data-creationdateformatted="01/24/2021 04:42 PM" data-type="temp" data-url="/storage/temp/14354599-devops-landscape.png" data-modificationdate="null" data-size="97371" data-name="devops-landscape.png" data-id="14354599" data-src="/storage/temp/14354599-devops-landscape.png" /></div>
</figure>
<p data-selectable-paragraph="">Every organisation has its own way, its own process to do things. And since their paths are different, the tools they need to use are different.</p>
<p data-selectable-paragraph="">Your job is not to find which tool is the best. <em>Your job is to find what process works for you best.</em> Once you have that figured out, the tools are just a google search away.</p>
<p data-selectable-paragraph="">So now you know where to start. It&#8217;s not with the tools out there.</p>
<blockquote>
<p data-selectable-paragraph="">Start by understanding how your company and teams do things.</p>
</blockquote>
<p data-selectable-paragraph="">I&#8217;m literally asking you to open up a Word document and copy-paste the commands you need to run to do stuff.</p>
<h2 data-selectable-paragraph="">Wrapping Up</h2>
<p data-selectable-paragraph="">I hope this post has been helpful in understanding how the DevOps field is arranged and how different tools depend and coexist with each other.</p>
<p data-selectable-paragraph="">I&#8217;d like to add:</p>
<blockquote>
<p data-selectable-paragraph="">Your DevOps process is only as strong as its foundation.</p>
</blockquote>
<p data-selectable-paragraph="">So work on the underlying process. It&#8217;s okay if you need to tweak your current process a bit.</p>
<p data-selectable-paragraph="">An excellent foundation to build upon could be using tools like <a href="https://spaceuptech.com/" target="_blank" rel="noopener nofollow">SpaceCloud</a>. Space Cloud is a Kubernetes-based serverless platform that helps you develop, deploy and secure cloud-native applications.</p>
<p data-selectable-paragraph="">In a nutshell, SpaceCloud gives you <em>an excellent starting point to build your DevOps practices on top of</em>. It makes performing rolling upgrades, canary deployments, and autoscaling your applications easy. You can configure everything using the <code>space-cli</code> or REST APIs.</p>
<p>The post <a href="http://kostacipo.stream/what-is-devops/">What is DevOps?</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/what-is-devops/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Creating a Secure Pipeline: Jenkins with SonarQube and DependencyCheck</title>
		<link>http://kostacipo.stream/creating-a-secure-pipeline-jenkins-with-sonarqube-and-dependencycheck/</link>
					<comments>http://kostacipo.stream/creating-a-secure-pipeline-jenkins-with-sonarqube-and-dependencycheck/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Wed, 08 Jan 2020 10:45:34 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[ci/cd]]></category>
		<category><![CDATA[jenkins]]></category>
		<category><![CDATA[owasp]]></category>
		<category><![CDATA[sonarqube]]></category>
		<guid isPermaLink="false">http://www.kostacipo.stream/?p=1639</guid>

					<description><![CDATA[<p>&#160; Configuring Jenkins To Build WebGoat We&#8217;re going to scan a known vulnerable webapp, WebGoat, which is an OWASP project used for learning basic web penetration testing skills and vulnerabilities. A good scanner should find a lot of things! A quick note: We were initially going to use Mutillidae, another vulnerable app written in PHP. [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/creating-a-secure-pipeline-jenkins-with-sonarqube-and-dependencycheck/">Creating a Secure Pipeline: Jenkins with SonarQube and DependencyCheck</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<h2 id="configuring-jenkins-to-build-webgoat">Configuring Jenkins To Build WebGoat</h2>
<p>We&#8217;re going to scan a known vulnerable webapp, <a href="https://webgoat.github.io/WebGoat/">WebGoat</a>, which is an OWASP project used for learning basic web penetration testing skills and vulnerabilities. A good scanner should find a lot of things!</p>
<p>A quick note: We were initially going to use <a href="https://github.com/webpwnized/mutillidae">Mutillidae</a>, another vulnerable app written in PHP. However we couldn&#8217;t find any good open source PHP Static analyzers that would catch the vulnerabilities. </p>
<p>Anyway, let&#8217;s get on with Jenkins. Navigate in your browser to <a href="http://localhost:8080">http://localhost:8080</a> and enter the admin password shown in the terminal running docker. Go ahead and install the default plugins (for a deployed instance, I would recommend only installing plugins you will actually use) and create your first admin user.</p>
<p>WebGoat requires Java 11 to build, which Jenkins won&#8217;t install automatically. Head over to the main page -&gt; Manage Jenkins -&gt; Global Tool Configuration. There are two sections here we will update now: JDK installation and Maven installations. We need to add a link to a Java 11 installer &#8211; we used <a href="https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz">https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz</a> and we can use the default maven. Your config should look like this:</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img decoding="async" class="kg-image" src="https://nullsweep.com/content/images/2019/05/jenkins_jdk_install_config.png"><figcaption>Jenkins JDK11 Install configuration</figcaption></figure>
<figure class="kg-card kg-image-card kg-card-hascaption"><img decoding="async" class="kg-image" src="https://nullsweep.com/content/images/2019/05/jenkins_maven_install_config.png"><figcaption>Jenkins Maven install configuration</figcaption></figure>
<p>We sometimes see Jenkins have trouble installing a JDK this way if more than one JDK is installed in the system. If this is the first one, there should be no problems.</p>
<p>Finally, we have to set the JAVA_HOME variable. In the Jenkins -&gt; Manage Jenkins -&gt; Configure System menu, enable environment varaibles and set JAVA_HOME equal to /var/jenkins_home/tools/hudson.model.JDK/openjdk11/jdk-11.0.1/.</p>
<p>Now let&#8217;s create a pipeline for WebGoat and make sure it builds successfully. Back on the main page choose new item -&gt; freestyle project.</p>
<p>The initial setup is pretty simple:</p>
<ul>
<li>Add Webgoat to the various github setting locations (https://github.com/WebGoat/WebGoat/)</li>
<li>Set the target branch to */develop</li>
<li>Create a maven build step (&#8220;Invoke top level maven targets&#8221;) and give it the command &#8220;clean install&#8221;</li>
</ul>
<p>Here is the full pipeline configuration:</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img decoding="async" class="kg-image" src="https://nullsweep.com/content/images/2019/05/initial_webgoat_pipeline.png"><figcaption>Basic WebGoat Pipeline</figcaption></figure>
<p>Try running it and making sure that everything builds successfully.</p>
<h2 id="adding-sonarqube-and-dependencycheck">Adding SonarQube and DependencyCheck</h2>
<h3 id="sonarqube-setup-security">SonarQube setup &amp; security</h3>
<p>We already have a SonarQube instance running, we just need to link and configure Jenkins to use it. Log in to <a href="http://localhost:9000">http://localhost:9000</a> and use the default sonarQube login of admin/admin.</p>
<p>Although this is only for practice, I still want to secure our SonarQube instance, so do the following:</p>
<ul>
<li>Change the admin password</li>
<li>Go to administration-&gt; security and turn on &#8220;Force user authentication&#8221;</li>
<li>Create a new user for Jenkins.</li>
<li>Log into the new user, go to the profile -&gt; security section, and generate a token. Copy this for later use.</li>
</ul>
<p>Finally, create a project named &#8220;webgoat&#8221; with your jenkins user.</p>
<h3 id="configure-the-plugins-for-jenkins">Configure the plugins for Jenkins</h3>
<p>We will need two new plugins for jenkins. In the Jenkins home page, go to Mange Jenkins -&gt; Manage Plugins. On the Available tab find and select &#8220;OWASP Dependency-Check Plugin&#8221; and &#8220;SonarQube Scanner for Jenkins&#8221;. Install them without restarting.</p>
<p>Back on the Jenkins home, go to Manage Jenkins -&gt; Global Tool Configuration. You should see a new option for SonarQube Scanner. Add an installation here (I just chose the latest from Maven Central) and save.</p>
<p>Finally, head over to Jenkins -&gt; Manage Jenkins -&gt; Configure System and add a sonarqube instance. The URL with our docker container is http://sonarqube:9000 and the token should be the one you saved while setting up the Jenkins user in SonarQube. Here is my setup:</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img decoding="async" class="kg-image" src="https://nullsweep.com/content/images/2019/05/sonarqube_settings.png"><figcaption>SonarQube Settings</figcaption></figure>
<p>One other thing I had to do to get SonarQube working properly. For some reason I couldn&#8217;t completely determine, the SonarQube startup script was truncating the JAVA_HOME path incorrectly, causing errors during the pipeline. To solve this, log into the docker container manually and update the sonar script to the proper JAVA_HOME.</p>
<pre class=" language-bash"><code class=" language-bash">$ docker <span class="token function">exec</span> -it secure_pipeline_jenkins_1 <span class="token function">bash</span>
jenkins@2ea0acb5905d:/$ <span class="token function">cd</span> /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonarqube
jenkins@2ea0acb5905d:~/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonarqube$ <span class="token function">head</span> bin/sonar-scanner
<span class="token comment">#!/bin/sh</span>
<span class="token comment">#</span>
<span class="token comment"># SonarQube Scanner Startup Script for Unix</span>
<span class="token comment">#</span>
<span class="token comment"># Optional ENV vars:</span>
<span class="token comment">#   SONAR_SCANNER_OPTS - Parameters passed to the Java VM when running the SonarQube Scanner</span>
<span class="token comment">#   SONAR_SCANNER_DEBUG_OPTS - Extra parameters passed to the Java VM for debugging</span>
<span class="token comment">#   JAVA_HOME - Location of Java's installation</span>

JAVA_HOME<span class="token operator">=</span><span class="token string">"/var/jenkins_home/tools/hudson.model.JDK/openjdk11-remote/jdk-11.0.1"</span>
</code></pre>
<h3 id="add-sonarqube-and-dependencycheck-to-the-pipeline">Add SonarQube and DependencyCheck to the pipeline</h3>
<p>Now we can add these to our pipeline and start scanning with every build.</p>
<p>In the pipeline created earlier, add two new build steps &#8211; Invoke Dependency-Check analysis and Execute SonarQube Scanner. In the SonarQube scanner, add the configuration settings required &#8211; the project key and name should match the project you created in SonarQube.</p>
<pre class=" language-bash"><code class=" language-bash">sonar.projectKey<span class="token operator">=</span>webgoat
sonar.projectName<span class="token operator">=</span>webgoat
sonar.projectVersion<span class="token operator">=</span>1.0
sonar.language<span class="token operator">=</span>java
sonar.java.binaries<span class="token operator">=</span>**/target/classes
sonar.exclusions<span class="token operator">=</span>**/*.ts
</code></pre>
<p>I am excluding the TypeScript files above since we did not setup Node or a JS build step for our project. In a real project, we would want to ensure that they were also scannable.</p>
<p>In the DependencyCheck advanced section, check to generate HTML reports as well for easier viewing.</p>
<p>Here is my full pipeline configuration now:</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img decoding="async" class="kg-image" src="https://nullsweep.com/content/images/2019/05/webgoat_pipeline_with_sast.png"><figcaption>Full Secure Pipeline</figcaption></figure>
<p>Kick off a build and make sure it runs correctly. Afterwards, you should be able to see results.</p>
<h3 id="viewing-reports">Viewing Reports</h3>
<p>If all runs successfully, logging into SonarQube will show you security scan details (with plenty of findings!) and the pipeline can show you the dependencyCheck results in the workspace -&gt; dependency-check-report.html file.</p>
<figure class="kg-card kg-image-card kg-card-hascaption"><img decoding="async" class="kg-image" src="https://nullsweep.com/content/images/2019/05/dependencyCheck_results.png"><figcaption>DependencyCheck Sample Data</figcaption></figure>
<figure class="kg-card kg-image-card kg-card-hascaption"><img decoding="async" class="kg-image" src="https://nullsweep.com/content/images/2019/05/webgoat_sonarqube_report.png"><figcaption>SonarQube Findings</figcaption></figure>
<p>You can and should at this point consider additional SonarQube plugins (or other SAST tools) that are specifically for your languages and frameworks.</p>
<h2 id="breaking-the-build">Breaking the Build</h2>
<p>We want to know when something isn&#8217;t working right at the build phase. SonarQube gives us this for free with the plugin (you should see a nice red ERROR tag under the SonarQube Quality gate) but DependencyCheck requires one more configuration.</p>
<p>Add a post-build check for &#8220;Publish Dependency Check Results&#8221; and expand the advanced tabs. Just add some threshold data and the build will fail or be marked unstable according to the rules set.</p>
<p>Here &nbsp;is our final pipeline configuration, fully expanded.</p>
<figure class="kg-card kg-image-card"><img decoding="async" class="kg-image" src="https://nullsweep.com/content/images/2019/05/jenkins_full_sast.png"></figure>
<h2 id="final-thoughts">Final Thoughts</h2>
<p>Getting a CI/CD pipeline running with some basic security checks can be done within a few minutes. This will help keep your published artifacts in better shape and ensure the team has an opportunity to learn about security issues as soon as they emerge.</p>
<p>The post <a href="http://kostacipo.stream/creating-a-secure-pipeline-jenkins-with-sonarqube-and-dependencycheck/">Creating a Secure Pipeline: Jenkins with SonarQube and DependencyCheck</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/creating-a-secure-pipeline-jenkins-with-sonarqube-and-dependencycheck/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Anteater – CI/CD Security Gate Check Framework</title>
		<link>http://kostacipo.stream/anteater-ci-cd-security-gate-check-framework/</link>
					<comments>http://kostacipo.stream/anteater-ci-cd-security-gate-check-framework/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Tue, 24 Dec 2019 13:49:26 +0000</pubDate>
				<category><![CDATA[Cybersecurity]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[ci/cd]]></category>
		<category><![CDATA[hacks]]></category>
		<guid isPermaLink="false">http://www.kostacipo.stream/?p=1567</guid>

					<description><![CDATA[<p>&#160; Anteater is a CI/CD Security Gate Check Framework to prevent the unwanted merging of nominated strings, filenames, binaries, deprecated functions, staging environment code/credentials etc. It’s main function is to block content based on regular expressions. &#160; Anything that can be specified with regular expression syntax, can be sniffed out by Anteater. You tell Anteater [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/anteater-ci-cd-security-gate-check-framework/">Anteater – CI/CD Security Gate Check Framework</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Anteater is a CI/CD Security Gate Check Framework to prevent the unwanted merging of nominated strings, filenames, binaries, deprecated functions, staging environment code/credentials etc.</p>
<p>It’s main function is to block content based on regular expressions.</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-medium wp-image-5291" src="https://cdn.darknet.org.uk/wp-content/uploads/2019/08/Anteater-CICD-Security-Gate-Check-Framework-640x342.png" sizes="(max-width: 640px) 100vw, 640px" srcset="https://cdn.darknet.org.uk/wp-content/uploads/2019/08/Anteater-CICD-Security-Gate-Check-Framework-640x342.png 640w, https://cdn.darknet.org.uk/wp-content/uploads/2019/08/Anteater-CICD-Security-Gate-Check-Framework.png 800w" alt="Anteater - CI/CD Security Gate Check Framework" width="640" height="342"></p>
<div align="center">&nbsp;</div>
<p>Anything that can be specified with regular expression syntax, can be sniffed out by Anteater. You tell Anteater exactly what you don’t want to get merged, and anteater looks after the rest.</p>
<h2>How Anteater CI/CD Security Gate Check Framework Works</h2>
<p>If Anteater finds something, it exits with a non-zero code which in turn fails the build of your CI tool, with the idea that it would prevent a pull request merging. Any false positives are easily negated by using the same RegExp framework to cancel out the false match.</p>
<p>Entire projects may also be scanned also, using a recursive directory walk. With a few simple steps, it can be easily implemented into a CI/CD workflow with tooling such as Travis CI, CircleCI, Gitlab CI/CD and Jenkins.</p>
<p>Anteater also provides integrates with the Virus Total API, so any binaries, public IP addresses or URL’s found by Anteater, will be sent to the Virus Total API and a report will be returned. If any object is reported as malicious, it will fail the CI build job.</p>
<p>You can also set it to block all binaries or tamper with existing binaries (this includes PDFs, Images etc.) and you can whitelist desired binaries using a SHA256 checksum.</p>
<h3>Using Anteater CI/CD Security Gate Checks</h3>
<p>There is some excellent documentation for Anteater here:</p>
<p><a href="https://anteater.readthedocs.io/en/latest/index.html">Docs » Anteater – CI/CD Gate Check Framework</a></p>
<p>This includes how to get it working with CircleCI which is my personal choice for CI tooling.</p>
<p>In order to use the VirusTotal API, you will first require an API key. These are free to get and can be obtained by signing up to the service <a href="https://www.virustotal.com/#/join-us">here</a>.</p>
<p>Once you have your key, it needs to be set as an environment variable.</p>
<p>You can download Anteater here:</p>
<p><a href="https://github.com/anteater/anteater/archive/master.zip">anteater-master.zip</a></p>
<p>Or read more <a href="https://github.com/anteater/anteater">here</a>.</p>
<p>&nbsp;</p>
<p>The post <a href="http://kostacipo.stream/anteater-ci-cd-security-gate-check-framework/">Anteater – CI/CD Security Gate Check Framework</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/anteater-ci-cd-security-gate-check-framework/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
