<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jean-Thierry Bonhomme on Medium]]></title>
        <description><![CDATA[Stories by Jean-Thierry Bonhomme on Medium]]></description>
        <link>https://medium.com/@jtbonhomme?source=rss-59a132142e65------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wClTzBjru5CTbpyz.</url>
            <title>Stories by Jean-Thierry Bonhomme on Medium</title>
            <link>https://medium.com/@jtbonhomme?source=rss-59a132142e65------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:53:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jtbonhomme/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your Time-based One time passwords from your terminal]]></title>
            <link>https://medium.com/@jtbonhomme/your-time-based-one-time-passwords-from-your-terminal-e9955fbc9b65?source=rss-59a132142e65------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9955fbc9b65</guid>
            <category><![CDATA[keychain]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[2fa]]></category>
            <category><![CDATA[mfa]]></category>
            <dc:creator><![CDATA[Jean-Thierry Bonhomme]]></dc:creator>
            <pubDate>Wed, 19 Feb 2020 05:59:46 GMT</pubDate>
            <atom:updated>2020-02-19T05:59:46.459Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*hl9l14m29x1NHofAV2-ncg.png" /></figure><h3>Context</h3><p>Modern web services usually offer a 2-factor authentication as a complement of the traditional login/password method. It brings an additional security layer, based on Time-based One-Time Password (TOTP), because even if a user’s traditional password is stolen or compromised, an attacker cannot get access to your resources without this second password.</p><p>A time-based one-time password (TOTP) is a temporary passcode generated by an algorithm that uses the current time of day as one of its authentication factors.</p><p>The TOTP specification (RFC-6238) describes the TOTP algorithm, as a time-based variant of the One-Time Password (OTP), namely the HMAC-based One-Time Password (HOTP) algorithm.</p><p>The TOTP is basically a hash-mac token computed from a shared key (generally randomly generated) and seed with a 30-second valid timestamp. Lot’s of mobile applications can provide such a service (Google Authenticator, …)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*IMH_hSDxMhsijhxzepo31Q.jpeg" /></figure><p>When you wish to log into a 2FA protected service, you are asked to provide your credentials (login/password) then to enter the TOTP displayed on the application. The web service computed the same TOTP and make sure they are equal.</p><p>The RFC-6238 provides this definition of a Time-based One-time password:</p><pre>TOTP = HOTP(K, T), where T is an integer and represents the number of time steps between the initial counter time T0 and the current Unix time.</pre><p><a href="https://tools.ietf.org/html/rfc6238#section-4.2">https://tools.ietf.org/html/rfc6238#section-4.2</a></p><h3>Motivation</h3><p>I started using this security feature long time ago, and was happy using the Google Authenticator application on my mobile phone. Until I realized I forgot to export all the secret keys I use every day at work on my new phone, and was unable to connect to AWS console for a day.</p><p>Then, I wish I had a backup solution on my laptop. I started to wonder how I could implement a desktop application with a secure storage backend.</p><p>I found some programs that manages MFA credentials, but in a local file, and not always encrypted.</p><p>My idea was to find a way to securely store secret keys from the services I use every day (github, AWS, …) and generate TOTP in an easy way. As I always have a terminal opened, it was the most natural solution for me.</p><p>I started to look around how I could interface with Keychain on my Mac, and I found some cross platform Golang libraries that let developers use secure system storages.</p><p>You can find the full program source code <a href="https://github.com/jtbonhomme/gotp">here</a>.</p><p>Note that gotp accepts Pull Requests! Feel free to add your own features, improve documentation or add tests.</p><h3>Usage</h3><h4>Download</h4><p>Get the version for your OS here: <a href="https://github.com/jtbonhomme/gotp/tree/master/dist">download</a> (I only tested gotp on Mac OS X)</p><h4>Install as a command line tool</h4><pre>go get -u github.com/jtbonhomme/gotp/cmd/gotp</pre><h4>Add a key</h4><p>The shared secret shall be in the base-32 format.</p><pre>gotp add -key=AWS:MFA -value=KZAUYVKFGA======</pre><h4>Get a code</h4><p>The code read is copied to the clipboard.</p><pre>gotp get -key=AWS:MFA<br>code: 585146 (copied to clipboard)</pre><h4>List all keys</h4><pre>gotp list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TxXT5b0TQsMQioly.png" /></figure><h4>Delete a key</h4><pre>gotp del -key=AWS:MFA</pre><h3>The secure KeyChain</h3><p>gotp uses the <a href="https://godoc.org/github.com/99designs/keyring">keyring</a> library to store the secret keys. The repository documentation states that:</p><blockquote><strong>Currently Keyring supports the following backends</strong>: macOS/OSX Keychain, Windows credential store, <a href="https://www.passwordstore.org/">Pass</a>, <a href="https://github.com/99designs/aws-vault/pull/98">Secret Service</a>, <a href="https://github.com/99designs/aws-vault/pull/27">KDE Wallet</a>, <a href="https://github.com/99designs/aws-vault/pull/63">Encrypted File</a></blockquote><h3>References</h3><ul><li><a href="https://godoc.org/github.com/99designs/keyring">https://godoc.org/github.com/99designs/keyring</a></li><li><a href="https://tools.ietf.org/html/rfc6238">https://tools.ietf.org/html/rfc6238</a></li><li><a href="https://tools.ietf.org/html/rfc2104">https://tools.ietf.org/html/rfc2104</a></li><li><a href="https://medium.com/@n.moretto/two-factor-authentication-with-totp-ccc5f828b6df">https://medium.com/@n.moretto/two-factor-authentication-with-totp-ccc5f828b6df</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9955fbc9b65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pragmatic Guide to Writing User Story]]></title>
            <link>https://medium.com/intercloud/pragmatic-guide-to-writing-user-story-c0d442e6ca23?source=rss-59a132142e65------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0d442e6ca23</guid>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[kanban]]></category>
            <category><![CDATA[guidelines]]></category>
            <dc:creator><![CDATA[Jean-Thierry Bonhomme]]></dc:creator>
            <pubDate>Thu, 31 Oct 2019 09:03:16 GMT</pubDate>
            <atom:updated>2019-10-31T09:03:16.886Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting Started in Writing User Stories</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GPcVC8vaBb914-a-.jpg" /></figure><p>Agile literature is full of guides telling you how to write awesome User Story (Independant, Negociable, Valuable, …), but all these articles are intended to address a large audience, with common good sense advices.</p><p>But I always felt a lack of a pragmatic, return of experience driven list of good practices. How can I be more efficient to avoid common pitfall of communication in a development team.</p><p>With this idea in mind, I started gathering methods and habits (I learned the hard way) I used to apply in my previous job, and I tried to write a practical guideline to efficient User Story that will, I hope so, help you avoid common pitfall and misunderstanding between Product Owners and Developers.</p><h3>Know you product</h3><p>It was the first advice one of my managers gave to me. He often used to ask me how the product was working, how the user had to do to perform a specific action, and if I didn’t answer correctly, he used to say: “You don’t know your product”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*kAeUxypulHvGyLoRsqWdLQ.gif" /><figcaption>Damn, she’s right !</figcaption></figure><p>I am now convinced that you can not write a good user story if you can’t use correctly your product, or if you can’t explain how it work.</p><p>You don’t have to be an technical expert in any field of technology but I am sure you can’t be efficient if you can’t roughtly understand the core concepts of your product.</p><h3>Be nice with your developers</h3><p>People usually say you should give an overview of the end user benefits (“As a customer, I can do this in order to get that …”) While it is a good habit to give developers a good overview of the feature they will have to design and code, I think it is even more important to give them a good understanding of why you want to improve user experience this way.</p><p>In other words, what is the business (or technical) value of this user story, what benefits do your company expect with this development ?</p><p>Explaining the tech team what is the ultimate goal behind the story will help them to making the right choices during design and architecture stage. It also will prevent them making wrong assumptions and making unilateral decision about the way it should behave in case of uncomplete description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*VwYg4nLJU2Pi6uv4JucICQ.jpeg" /></figure><h3>Always Start with the Happy Path</h3><p>The <a href="https://en.wikipedia.org/wiki/Happy_path">Happy Path</a> is the normal scenario, when no error occurs, and everything work in respect with the service you want to deliver.</p><p>It sounds obvious, but this nominal use case should fit with 80% of the real world cases, so it also should be obvious to start to manage this normal use case first.</p><p>In this “rainbows and butterfiles” scenario, all resources are available, network is up, the user will never try to enter an incorrect value, neither click on back button without having achieve to fill the web form. Don’t try to imagine what could go wrong right now.</p><p>It also will help you in a future User Story splitting if estimation shows the development should be split in smaller units (task, or anything you are using in your agile workflow)</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*WMybsO5QdyDWQxEk-WNYog.png" /></figure><p><a href="https://www.intercloud.com/">InterCloud</a> Platform is an application-aware platform offering private access to any cloud provider, securely and efficiently delivering cloud applications wherever they may be required.</p><p>InterCloud Platform is physically connected to all major cloud providers. This private network is completely isolated from all public networks, making it impervious to any of the cyber-attacks typically experienced by services running on the internet.</p><p>By the way, if you are a passionate developer, we hire !</p><p><a href="https://www.welcometothejungle.co/fr/companies/intercloud/jobs">https://www.welcometothejungle.co/fr/companies/intercloud/jobs</a></p><p>Positions currently open are SRE, Front-End and Back-End developer. Feel free to contact me for any information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*7dEIlIuCx9UT4Zrl.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0d442e6ca23" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intercloud/pragmatic-guide-to-writing-user-story-c0d442e6ca23">Pragmatic Guide to Writing User Story</a> was originally published in <a href="https://medium.com/intercloud">InterCloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My notes from the “Going Secure with Go” GopherCon 2019 conference (Singapore)]]></title>
            <link>https://medium.com/intercloud/my-notes-from-the-going-secure-with-go-gophercon-2019-conference-singapore-ab94352a2ed?source=rss-59a132142e65------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab94352a2ed</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[gophercon]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Jean-Thierry Bonhomme]]></dc:creator>
            <pubDate>Wed, 11 Sep 2019 06:53:08 GMT</pubDate>
            <atom:updated>2019-11-06T10:58:51.518Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xQjc5GdmmCPN9B_N" /><figcaption>Photo by <a href="https://unsplash.com/@climatereality?utm_source=medium&amp;utm_medium=referral">The Climate Reality Project</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I did not attend the Singapore conference <a href="https://2019.gophercon.sg/schedule/">GopherCon 2019</a>. When I found some time to have a look on <a href="https://www.youtube.com/channel/UCazkIMpjghmT8fugD1WF_DQ">YouTube to the talks I missed</a>, I was struck by the quality of these conferences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/0*V38THlfNxouN5cTm.png" /></figure><p>One of these speeches caught my attention</p><h3>Going Secure with Go</h3><p>This conference was given by <a href="https://2019.gophercon.sg/speakers/#natalie-pistunovich">Natalie Pistunovitch</a>. She works at Fraugster, Berlin, and is organizing GopherCon Europe.</p><p>Her talk is a concentrate of Golang technology and security. Here is my notes of her video, you should really watch if you have time.</p><h3>Agenda</h3><p>Natalie’s conference follow a natural and logical, from a software architecture point of view, <a href="https://youtu.be/9e2gRtzemGo?t=164">pattern</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GGdLxmt7BYBP7Rzkv35CBg.png" /><figcaption>Singapore Gopher 2019 — YouTube</figcaption></figure><p>She explains how being more secure on manipulating data, how writing better Go code, how keeping your dependencies up to date, and how building secure containers.</p><p>I will only cover Golang specific issues, but she covers more general software security topics (#devSecOps), so watching her video is actually a good idea. In particular, she provides efficient and secure way to build your containers, and I will not cover this part here since <a href="https://youtu.be/9e2gRtzemGo?t=1086">examples provided in the video</a> are precise enough to give you a good idea of how you can improve your container builds security.</p><h3>Data</h3><h4>Use Golang cryptographic rand library to seed your random generators</h4><p>When you need to generate strong cryptographic random data, for password initialization for example, you need to<a href="https://en.wikipedia.org/wiki/Random_seed"> seed your random</a> generator. Wikipedia says that a seed is used to initialize a pseudo-random generator. If a pseudorandom number generator is reinitialized with the same seed, it will produce the same sequence of numbers. This is obviously not what is expected from a password generator, right ?</p><p>My first intuition when I started to work as a developer was to use a timestamp seed, thinking that it was enough precise (Golang <a href="https://golang.org/pkg/time/#Time">time</a> library can represent an instant in time with nanosecond precision)</p><p>Picking a good random seed can be extremely difficult. For example, using system clock <strong>is a very bad idea</strong>. During 90’s, system clocks were not that precise and often provided only a 1/60th second granularity. Using unix timestamp as a seed to initialize a random generator during these years could lead an hacker, knowing approximatively the nearest hour when you generated your password, to retrieve it, because there are only 60x60x60 = 216,000 possible values to try (<a href="http://web.deu.edu.tr/doc/oreily/networking/puis/">Practical UNIX &amp; Internet Security</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/0*5SYST82qUrRcWEKc.gif" /></figure><p>So, the secure way to generate real random password in Golang is to use the <a href="https://golang.org/pkg/crypto/rand/">crypto/rand</a> library which is cryptographically secure (and not math/rand) to generate random data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/869fd7d119dc0d754c3f1190e497195f/href">https://medium.com/media/869fd7d119dc0d754c3f1190e497195f/href</a></iframe><blockquote>Note: crypto/rand library does not expose any .Seed() member. The Natalies’s video example should not be used as is.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*GKZvBNUh8Uw0tlSa_7vxbw.png" /></figure><h3>Code</h3><h4>Input Validation</h4><p>The <a href="https://www.owasp.org/index.php/Main_Page">OWASP</a> project provides this advice to encourage input validation:</p><blockquote>Input validation is performed to ensure only properly formed data is entering the workflow in an information system, preventing malformed data from persisting in the database and triggering malfunction of various downstream components. Input validation should happen as early as possible in the data flow, preferably as soon as the data is received from the external party.</blockquote><p><a href="https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html">Input Validation - OWASP Cheat Sheet Series</a></p><p>Validation is performed on the server side before the input data can be used by your business functions.</p><p>At <a href="https://www.intercloud.com/">InterCloud</a>, we selected the <a href="https://github.com/leebenson/conform">conform</a> library.</p><p>It let use easily define field types for a full structure :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qeq4NJAzI3C6bYtwT1RyKQ.png" /></figure><p>And reject invalid inputs according to the models we defined:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9_-LnIQOefITA7S3tqdNlg.png" /></figure><p>At the edge of input validation, you can also enforce your data validation by using <a href="https://json-schema.org/">JSON schemas</a>.</p><p>Golang community provides some libraries to check input data in JSON format are compliant to a model you defined thanks to <a href="https://json-schema.org/">JSON schemas</a>.</p><p>You can have a look to <a href="https://github.com/xeipuuv/gojsonschema">github.com/xeipuuv/gojsonschema</a> for example.</p><p>Here is a code sample you can use to check yours schemas:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FUXj9WxrDL1ecc7HMcqrTg.png" /></figure><h4>SQL Injection</h4><p>When people work with SQL databases and build their first handler to manipulate queries, they often try to build their queries with builtin string formatters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fm9mIVtj7om6yZpfR5s1Zw.png" /></figure><p>Using this query with an external input (email) allow hackers to make an SQL injection by injecting an input data that will be interpreted as another SQL query.</p><p>For example, providing an email input like “ &#39;; DROP TABLE users;&#39;” will lead this program to build two queries, the first one that selects no user, the second that drops the users table:</p><pre>SELECT * FROM users WHERE email=&#39;&#39;; DROP TABLE users;&#39;&#39;;</pre><p>To prevent this, you shall rely on golang SQL database library to execute your queries.</p><pre>db.Exec(&quot;INSERT INTO users(name, email) VALUES($1, $2)&quot;,<br>  &quot;Jean-Thierry BONHOMME&quot;, &quot;jean-thierry.bonhomme@medium.fr&quot;)</pre><p>If a hacker try to inject SQL queries as input data, they will be escaped and manipulated like any other string data:</p><pre>SELECT * FROM users WHERE email=&#39;&#39;&#39;; DROP TABLE users;&#39;&#39;&#39;;</pre><blockquote>Note: there are 3 ‘ to escape the email input, which will prevent the SQL engine to execute 2 queries and drop the users table.</blockquote><h4>Static Code Analysis</h4><p>The tools presented during the conference is <a href="https://github.com/securego/gosec">gosec</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MY3BM7ipwrE4jEI3" /></figure><p>It scans your code and analyse potential vulnerabilities (list of checks is provided in the gosec repository).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0Ka-8EaPIqJH15sgh-0fA.png" /></figure><p>In this example given by Natalie during her conference, we can note the alerts raised by gosec about low security level of a random generator, and two potential SQL injections vulnerabilities.</p><p>You can also use as a complement a more general static code analyser, for example, use <a href="https://github.com/go-critic/go-critic">go-critic</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*EY3YgtS-d3NV0HgU" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CGHKYRbLAw_h3A8i_D5Gqw.png" /></figure><p>I strongly advice you to embed these tools as regular steps of your CICD process.</p><h3>Dependencies</h3><blockquote>Should you trust random pieces of code written by strangers on the Internet ?</blockquote><p>Natalie Pistunovich, Fraugster (@NataliePis)</p><p>Well, do you actually need more motivation ?</p><p>The advice given during the conference is you really should audit your dependencies code base like you would do for your own code. Check the inputs are validated, check that the SQL queries are built in a manner that avoid injections, check that the library is built using a CI that run static code analysis for quality and security, check the maintainer provides code coverage …</p><p>Wait … I can easily do this for the dependencies I use, but what about the dependencies of my dependencies ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/0*nucJouAzE6FJ1U8r" /></figure><p>Well, I would say that if you are that rigorous with your first level dependencies, chances are that the maintainers of the librairies you selected are also challenging with their dependencies.</p><p>Another important point raised by Natalie is that you really should make sure your CICD generate <strong>reproductible builds</strong>. You actually need to make sure the library you checked months ago does not expose a vulnerability in its last release that could be imported when you rebuild your codebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EpfvKb_xVOrA6CAhudSRdw.jpeg" /></figure><p><a href="https://www.intercloud.com/">InterCloud</a> Platform is an application-aware platform offering private access to any cloud provider, securely and efficiently delivering cloud applications wherever they may be required.</p><p>InterCloud Platform is physically connected to all major cloud providers. This private network is completely isolated from all public networks, making it impervious to any of the cyber-attacks typically experienced by services running on the internet.</p><p>By the way, if you are a passionate developer, we are hirin !</p><p>https://www.welcometothejungle.co/fr/companies/intercloud/jobs</p><p>Positions currently open are SRE, Front-End and Back-End developer. Feel free to contact me for any information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*7dEIlIuCx9UT4Zrl.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab94352a2ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intercloud/my-notes-from-the-going-secure-with-go-gophercon-2019-conference-singapore-ab94352a2ed">My notes from the “Going Secure with Go” GopherCon 2019 conference (Singapore)</a> was originally published in <a href="https://medium.com/intercloud">InterCloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices automated versioning with Gitlab-CI]]></title>
            <link>https://medium.com/intercloud/microservices-automated-versioning-with-gitlab-ci-5d465940142f?source=rss-59a132142e65------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d465940142f</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[gitlab-ci]]></category>
            <category><![CDATA[semantic-versioning]]></category>
            <category><![CDATA[versioning]]></category>
            <dc:creator><![CDATA[Jean-Thierry Bonhomme]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 06:20:41 GMT</pubDate>
            <atom:updated>2019-07-23T11:31:05.480Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*HVYyH4foseqjHOEs00CeYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/0*UG0fABIWmIqQwB23.png" /></figure><h3>Introduction</h3><blockquote>The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms.</blockquote><p>This definition was issued by <a href="https://martinfowler.com/articles/microservices.html">Martin Fowler</a> in its microservices dedicated article.</p><p>Microservices are designed to be developed with their own life cycle, and to be updated often, easily and quickly.</p><p>Automation tools and CICD approach make it simple to add features, fix issues and deliver new source code with no pain. It became so easy to deliver and deploy new release of microservice components that monitoring the version of these live components in your production environment is critical. So, the versioning of these components became critical too.</p><p>This article will present you the method we adopted to make it simple keeping a rigorous and automated versioning for our Golang microservices.</p><h3>Semver automated versioning</h3><p>With no surprise, we have chosen <strong>semver</strong> (<a href="https://semver.org/">https://semver.org/</a>) as the versioning standard. It not only made sense to us to follow a convention that is a <em>de facto </em>standard, but it was also introduced in Golang community as a reference for the module system release in Go v1.11.</p><p>Go also suggest a standard library to manage versioning (<a href="https://godoc.org/golang.org/x/tools/internal/semver">https://godoc.org/golang.org/x/tools/internal/semver</a>)</p><p>As a small team, automation is an every day challenge. We wanted to get rid of this annoying work that consists in parsing your commit list to define if your need to release a minor or patch version.</p><p>We tested some libraries and pickup the node library <a href="https://github.com/semantic-release/semantic-release"><strong>semantic release</strong></a>.</p><blockquote>semantic-release automates the whole package release workflow including: determining the next version number, generating the release notes and publishing the package.</blockquote><blockquote>This removes the immediate connection between human emotions and version numbers, strictly following the <a href="http://semver.org/">Semantic Versioning</a> specification.</blockquote><p>All commits following conventional commits messages are taken into account to determine the new release version.</p><h3>CICD pipeline Presentation</h3><p>To make it seamless to us, we embedded it in our CICD pipeline. We are happy with Gitlab-CI as a daily precious tool to automate all our development workflow. And we found it natural to insert a new job in our pipeline to generate versions automatically for our services.</p><p>Here is a representation of our build process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*krfk-a2YznoHWWSnokXpwQ.png" /></figure><p>The release job use a docker container made from the <a href="https://github.com/semantic-release/semantic-release">semantic release</a> project.</p><p>Here is the source code from the .gitlab-ci.yml file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9288e0035aeb243ddab7a8f360b38ea/href">https://medium.com/media/a9288e0035aeb243ddab7a8f360b38ea/href</a></iframe><p>The semantic release program gets a configuration parameter in a .releaserc local file. Please find bellow our configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd4cee5281d193ef4bc14a4b827821e7/href">https://medium.com/media/bd4cee5281d193ef4bc14a4b827821e7/href</a></iframe><h3>Conventional commit messages</h3><p>To be used, semantic release needs commit message to follow a precise pattern. These rules are described by the team of AngularJS:</p><p><a href="https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines">angular/angular.js</a></p><p>Here is the expected syntax for commit messages.</p><pre>&lt;type&gt;(&lt;scope&gt;): &lt;subject&gt;<br>&lt;BLANK LINE&gt;<br>&lt;body&gt;<br>&lt;BLANK LINE&gt;<br>&lt;footer&gt;</pre><h4>&lt;type&gt;</h4><p>Must be one of the following:</p><ul><li><strong>feat</strong>: A new feature (will increment minor digit)</li><li><strong>fix</strong>: A bug fix (will increment patch digit)</li><li><strong>docs</strong>: Documentation only changes</li><li><strong>style</strong>: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)</li><li><strong>refactor</strong>: A code change that neither fixes a bug nor adds a feature</li><li><strong>perf</strong>: A code change that improves performance</li><li><strong>test</strong>: Adding missing or correcting existing tests</li><li><strong>chore</strong>: Changes to the build process or auxiliary tools and libraries such as documentation generation</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*miR9gxKv2Xj3XLf2AidlHQ.png" /></figure><h4>&lt;subject&gt;</h4><p>The subject contains succinct description of the change:</p><ul><li>use the imperative, present tense: “change” not “changed” nor “changes”</li><li>don’t capitalize first letter</li><li>no dot (.) at the end</li></ul><h4>&lt;scope&gt;</h4><p>We insert as scope references to our JIRA issues id(PA-1223)</p><h4>&lt;body&gt;</h4><p>Just as in the <strong>subject</strong>, use the imperative, present tense: “change” not “changed” nor “changes”. The body should include the motivation for the change and contrast this with previous behavior.</p><h4>&lt;footer&gt;</h4><p><strong>Breaking Changes</strong> should start with the word BREAKING CHANGE: with a space or two newlines. The rest of the commit message is then used for this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nXOocH2WU-Gtm-ley636hw.png" /></figure><h3>Enforcing commit messages syntax</h3><p>Obviously, all of this can only work when all the team respect these rules. To ensure that will can fully rely on automated versioning, we added some <a href="https://docs.gitlab.com/ee/administration/custom_hooks.html">custom hooks</a> in gitlab.</p><p>See <a href="https://gist.github.com/jtbonhomme/b88cfc3eda108fae75059ae83129d9cb">gitlab pre-receive custom hook · GitHub</a> to get more information about git hooks in Gitlab.</p><p>This hook is a simple shell script that let gitlab checks commit message format before it can be committed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e73b6aefd9d9d86881eee5f2c872432/href">https://medium.com/media/3e73b6aefd9d9d86881eee5f2c872432/href</a></iframe><p>The script makes your push command refused if any commit message in the branch does not respect the rules:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*fpaKqnxHiqFKKSWX3e9ZFA.png" /></figure><p>The hooks have to be installed manually in every repository. First, ssh into the docker container that run gitlab server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3226b9ab2e2e971acb96bc0a2a985602/href">https://medium.com/media/3226b9ab2e2e971acb96bc0a2a985602/href</a></iframe><h3>Micro-service version injection in Golang</h3><p>You may want to check a deployed microservice version from its REST API.</p><p>Let say you deliver the version information through a simple <em>version</em> endpoint.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dbbe801d0d9fc07231ffbc59e30f8c66/href">https://medium.com/media/dbbe801d0d9fc07231ffbc59e30f8c66/href</a></iframe><p>If your microservices are deployed as docker containers, you need to inject versioning data at build time.</p><p>We made it possible using <a href="https://golang.org/cmd/link/">Golang link -X flags</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64a8d912ac5a1634e171a2c37a7a8bd9/href">https://medium.com/media/64a8d912ac5a1634e171a2c37a7a8bd9/href</a></iframe><blockquote>Note that the package of the variable (<em>endpoint</em>) is declared with a relative path (<em>gitlab.private.fr/service.git/endpoint</em>)</blockquote><h3>See versioning in action</h3><p>At this point, we covered all the points that can help you to automate the versioning of your Golang microservices. It can be easily adapted to any other CI software.</p><p>You can find bellow a screenshot of our internal portal that allows us to monitor in real time all deployed microservices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6HV61YmypqvXhrt70FfDPA.png" /></figure><h3>InterCloud</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*WMybsO5QdyDWQxEk-WNYog.png" /></figure><p><a href="https://www.intercloud.com/">InterCloud</a> Platform is an application-aware platform offering private access to any cloud provider, securely and efficiently delivering cloud applications wherever they may be required.</p><p>InterCloud Platform is physically connected to all major cloud providers. This private network is completely isolated from all public networks, making it impervious to any of the cyber-attacks typically experienced by services running on the internet.</p><p>By the way, if you are a passionate developer; <a href="https://www.welcometothejungle.co/companies/intercloud/jobs/candidatures-spontanees">we hire</a> !</p><p>Positions currently open are SRE, Front-End and Back-End developer. Feel free to contact me for any information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*C-NSUgLJDW7Y_Uh5.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d465940142f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intercloud/microservices-automated-versioning-with-gitlab-ci-5d465940142f">Microservices automated versioning with Gitlab-CI</a> was originally published in <a href="https://medium.com/intercloud">InterCloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install NGINX reverse proxy with GitHub’s OAuth2]]></title>
            <link>https://medium.com/canal-tech/install-nginx-reverse-proxy-with-githubs-oauth2-b9acbd94ee97?source=rss-59a132142e65------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9acbd94ee97</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Jean-Thierry Bonhomme]]></dc:creator>
            <pubDate>Fri, 06 Nov 2015 23:00:00 GMT</pubDate>
            <atom:updated>2018-01-10T12:58:14.488Z</atom:updated>
            <content:encoded><![CDATA[<p>We at CANAL PLUS have many applications hosted on Amazon EC2. It is easy to set up and you can easily test and trash your instances as many times you want.</p><p>But, it also can be a bit more complicated if you want these services to be only used by people in your organisation. I was looking for an elegant way to restrict access to some internal dashboards and services, which would not imply to handle a new login/password dictionnary.</p><p>As we use Github for our public and private repositories, we decided to set up a reverse proxy with nginx and Github oauth2 authentication service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/0*hYw7PDGipg2khHfj.gif" /></figure><p>As I spent some times to (finaly) set a working configuration, I hope this article may help some of you.</p><p>I found a Go library: <a href="https://github.com/bitly/oauth2_proxy">Oauth2_proxy</a> that integrates with nginx and deals with all the oauth protocol for you. Tadaaa !</p><p>The principle is fairly simple. You set a nginx reverse proxy that receives incomming requests. It internaly sends these request to oauth2_proxy, who checks your Github credentials, and then “redirects” the trafic to your internal servers (upstream servers).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/0*pEMNd5AoUOrn6T0O.png" /></figure><p>As a result, you will have to log in with your Github credentials before you will access to the services that are protected with Oauth2_proxy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/0*YDHSSxCkIrSedtEq.png" /></figure><blockquote><em>OAuth2 is a protocol that lets external apps request authorization to private details in a user’s GitHub account without getting their password. This is preferred over Basic Authentication because tokens can be limited to specific types of data, and can be revoked by users at any time.</em></blockquote><p>Source: <a href="https://developer.github.com/v3/oauth/">Github Oauth API</a>.</p><h3>Register a github Application</h3><p>A registered OAuth application is assigned a unique Client ID and Client Secret. The Client Secret should not be shared. You may create a personal access token for your own use or implement the web flow below to allow other users to authorize your application.</p><p>Go to the <a href="https://github.com/settings/applications/new">Register a new OAuth application</a> page and fill all needed fields.</p><p>You will be given a unique Client Id and Client Secret that will be used by Oauth2_proxy service.</p><blockquote><em>People who may want to have more details can check the </em><a href="https://developer.github.com/v3/oauth/"><em>Github Oauth API</em></a><em>.</em></blockquote><h3>Install and configure nginx</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/0*AY1ZqQfeXOy3PCnj.png" /></figure><pre>sudo apt-get install nginx</pre><p>Then edit the configuration file /etc/nginx/sites-enabled/default to set up proxy pass to oauth2_proxy.</p><pre>server { listen 80; server_name your.company.com; location / { proxy_pass <a href="http://127.0.0.1:4180;">http://127.0.0.1:4180;</a> proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 1; proxy_send_timeout 30; proxy_read_timeout 30; } }</pre><p>This part send incoming requests on port 80 to 127.0.0.1:4180 (which is the default listening port of oauth2_proxy)</p><p>When Oauth2_proxy has authenticated your connection, it will redirect users on an ‘upstream server’</p><p>In this config, my upstream server is a simple http static file server. I make it listen on localhost:8090. Files are served from /var/www directory.</p><pre>server { listen 8090; root /var/www; location / { try_files $uri $uri/ index.html index.php =404; } }</pre><p>Then restart nginx:</p><p>sudo service nginx restart</p><h3>Install and configure oauth2_proxy</h3><p>Download <a href="http://developers.canal-plus.com/blog/install-nginx-reverse-proxy-with-github-oauth2/Prebuilt%20Binary">Prebuilt Binary</a> (current release is v2.0.1) or build with $ go get github.com/bitly/oauth2_proxy which will put the binary in $GOROOT/bin</p><p>Untar the archive, check the hash and copy the oauth2_proxy executable to /usr/bin</p><pre>tar xzvf oauth2_proxy-2.0.1.linux-amd64.go1.4.2.tar.gz md5sum oauth2_proxy 6be4b7734898081ed30558fff38b80cb oauth2_proxy sudo cp oauth2_proxy-2.0.1.linux-amd64.go1.4.2/oauth2_proxy /usr/bin/</pre><p>I use this configuration to set github as Oauth2 provider, and to restrict access to CANALPLUS’s github organisation members only. See <a href="https://github.com/bitly/oauth2_proxy/blob/master/README.md">Oauth_proxy README</a> for more options:</p><pre>oauth2_proxy -client-id=CLIENT_ID_PROVIDED_BY_GITHUB \ -client-secret=SECRET_KEY_PROVIDED_BY_GITHUB \ -provider=github \ -email-domain=* \ -upstream=http://127.0.0.1:8090 \ -cookie-secret=secretsecret \ -login-url=https://github.com/login/oauth/authorize \ -github-org=yourcompany \ -cookie-domain=your.company.com \ -cookie-secure=false</pre><blockquote><em>Note: you can also restrict access to a specific Github team under your organisation.</em></blockquote><h3>Configure oauth2_proxy as a Linux service</h3><p>Create a new script in /etc/init.d/oauth2_proxy</p><pre>#!/bin/sh ### BEGIN INIT INFO # Provides: # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO cmd=&quot;oauth2_proxy -client-id=CLIENT_ID_PROVIDED_BY_GITHUB \ -client-secret=SECRET_KEY_PROVIDED_BY_GITHUB \ -provider=github \ -email-domain=* \ -upstream=http://127.0.0.1:8090 \ -cookie-secret=secretsecret \ -login-url=https://github.com/login/oauth/authorize \ -github-org=yourcompany \ -cookie-domain=your.company.com \ -cookie-secure=false&quot; dir=&quot;&quot; name=`basename $0` pid_file=&quot;/var/run/$name.pid&quot; stdout_log=&quot;/var/log/$name.log&quot; stderr_log=&quot;/var/log/$name.err&quot; get_pid() { cat &quot;$pid_file&quot; } is_running() { [ -f &quot;$pid_file&quot; ] &amp;&amp; ps `get_pid` &gt; /dev/null 2&gt;&amp;1 } case &quot;$1&quot; in start) if is_running; then echo &quot;Already started&quot; else echo &quot;Starting $name&quot; cd &quot;$dir&quot; echo $cmd if [ -z &quot;$user&quot; ]; then sudo $cmd &gt;&gt; &quot;$stdout_log&quot; 2&gt;&gt; &quot;$stderr_log&quot; &amp; else sudo -u &quot;$user&quot; $cmd &gt;&gt; &quot;$stdout_log&quot; 2&gt;&gt; &quot;$stderr_log&quot; &amp; fi echo $! &gt; &quot;$pid_file&quot; if ! is_running; then echo &quot;Unable to start, see $stdout_log and $stderr_log&quot; exit 1 fi fi ;; stop) if is_running; then echo -n &quot;Stopping $name..&quot; kill `get_pid` for i in {1..10} do if ! is_running; then break fi echo -n &quot;.&quot; sleep 1 done echo if is_running; then echo &quot;Not stopped; may still be shutting down or shutdown may have failed&quot; exit 1 else echo &quot;Stopped&quot; if [ -f &quot;$pid_file&quot; ]; then rm &quot;$pid_file&quot; fi fi else echo &quot;Not running&quot; fi ;; restart) $0 stop if is_running; then echo &quot;Unable to stop, will not attempt to start&quot; exit 1 fi $0 start ;; status) if is_running; then echo &quot;Running&quot; else echo &quot;Stopped&quot; exit 1 fi ;; *) echo &quot;Usage: $0 {start|stop|restart|status}&quot; exit 1 ;; esac exit 0</pre><p>Then make it start with Linux, and start the program:</p><pre>sudo update-rc.d oauth2_proxy defaults 95 10 sudo service oauth2_proxy start</pre><h3>Et voila !</h3><p>Files served under /var/www now require to enter your github credentials. Only your company team will be allowed to access to the server.</p><p><em>Originally published at </em><a href="http://developers.canal-plus.com/blog/install-nginx-reverse-proxy-with-github-oauth2/"><em>developers.canal-plus.com</em></a><em> on November 6, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9acbd94ee97" width="1" height="1" alt=""><hr><p><a href="https://medium.com/canal-tech/install-nginx-reverse-proxy-with-githubs-oauth2-b9acbd94ee97">Install NGINX reverse proxy with GitHub’s OAuth2</a> was originally published in <a href="https://medium.com/canal-tech">CANAL+ TECH</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>