<?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 Eduardo Nicastro on Medium]]></title>
        <description><![CDATA[Stories by Eduardo Nicastro on Medium]]></description>
        <link>https://medium.com/@edunicastro?source=rss-7295af6f4ec6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*LwXIuPkL3kKuPfDF.</url>
            <title>Stories by Eduardo Nicastro on Medium</title>
            <link>https://medium.com/@edunicastro?source=rss-7295af6f4ec6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 20:08:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@edunicastro/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[How to Properly Set Up Personal/Professional Github Accounts]]></title>
            <link>https://medium.com/@edunicastro/how-to-properly-set-up-personal-professional-github-accounts-1c21b14483b1?source=rss-7295af6f4ec6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c21b14483b1</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Eduardo Nicastro]]></dc:creator>
            <pubDate>Thu, 23 Sep 2021 15:13:11 GMT</pubDate>
            <atom:updated>2021-09-23T15:13:11.101Z</atom:updated>
            <content:encoded><![CDATA[<p>I&#39;ve recently joined <a href="https://www.linkedin.com/in/eduardonicastro/">FullStackLabs</a>, and had to <strong>create a professional github account</strong>.</p><p>If you&#39;ve a Software Engineer like me, you probably had to do the same thing, and <strong>managing two Github accounts on the same machine</strong> safely is something you also had to deal with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*ouk8ZFrvqDpqeYX_Y_CS8Q.png" /></figure><p>This article explains how I managed to configure my development machine to <strong>use both accounts efficiently</strong>.</p><p>With this setup, <strong>vscode will also magically work correctly</strong>, meaning you won&#39;t have to manually configure anything in the editor.</p><h3>1. Create a folder for your professional account</h3><p>The first thing you want to do is create a new folder for your professional account. When you run any git commands from inside that folder, your professional gh account will be used.</p><p>I use a <strong>~/code</strong> directory for all my projects, and I created my professional folder under <strong>~/code/FSL</strong></p><h3>2. Create the SSH keys</h3><p>After creating the folder, you should <strong>generate a ssh key for each of your accounts</strong>. If you already have one ssh key and are adding a new one, that&#39;s fine, just make sure you end up with two sets of private/public keys (4 files total).</p><ul><li>Run ssh-keygen -t rsa -b 4096 -C &quot;your_email@example.com&quot;</li><li>You&#39;ll be prompted <em>&quot;Enter a file in which to save the key&quot;</em>, I suggest you create a file with your github personal and professional user. <em>In my case, I used </em><strong><em>edumueller</em></strong><em> and </em><strong><em>edumuellerFSL</em></strong><em>.</em></li></ul><h3>3. Add each key to the respective GitHub account</h3><ul><li>To do so, follow the official github instructions <a href="https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/">here</a></li></ul><h3>3. Create a .conf file for each key pair</h3><p>Create two different <strong>.conf</strong> files, here are the two files I have created, make sure to update the folder and paths:</p><h3>3.1 Personal Account .conf file</h3><blockquote># ~/git-edumueller.conf<br>[user]<br> email = <a href="/service/mailto:edu.nicastro@gmail.com">edu.nicastro@gmail.com</a><br> name = Eduardo Nicastro</blockquote><blockquote>[github]<br> user = “edumueller”</blockquote><blockquote>[core]<br> sshCommand = “ssh -i ~/.ssh/edumueller”</blockquote><h3>3.2 Professional Account .conf file</h3><blockquote># ~/git-edumuellerFSL.conf<br>[user]<br> email = <a href="/service/mailto:enicastro@fullstacklabs.co">enicastro@fullstacklabs.co</a><br> name = Eduardo Nicastro</blockquote><blockquote>[github]<br> user = “edumuellerFSL”</blockquote><blockquote>[core]<br> sshCommand = “ssh -i ~/.ssh/edumuellerFSL”</blockquote><h3>4. Create a <strong>~/.gitconfig</strong> file</h3><p>Here&#39;s where the magic happens, this file will decide what .conf file to use based on the path.</p><blockquote>[include]<br> path = ~/git-edumueller.conf<br>[includeIf “gitdir:~/code/<strong>FSL</strong>/”]<br> path = ~/git-edumuellerFSL.conf</blockquote><p>There you go! Now try creating and cloning private test projects outside and inside the<em> &lt;professional_account_path&gt;</em> and commit/push to verify the correct user and account was used.</p><p>This approach would also work for multiple accounts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c21b14483b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to set up a SSH tunnel to run PHPUnit tests in CircleCI and securing it using EC2 Instance…]]></title>
            <link>https://medium.com/@edunicastro/how-to-set-up-a-ssh-tunnel-to-run-phpunit-tests-in-circleci-and-securing-it-using-ec2-instance-a831ebdbaed0?source=rss-7295af6f4ec6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a831ebdbaed0</guid>
            <category><![CDATA[ec2-instance-connect]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[Eduardo Nicastro]]></dc:creator>
            <pubDate>Tue, 21 Jan 2020 22:32:04 GMT</pubDate>
            <atom:updated>2020-01-21T22:46:27.187Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to set up a secure SSH tunnel to run PHPUnit tests in CircleCI using EC2 Instance Connect (AWS)</h3><p>To increase security in our company, we recently limited the access to our AWS EC2 Database instance to allow only the ips in it’s VPC.</p><p>However, we ended up having trouble running our automated PHPUnit tests since circleci could no longer connect to our DB remotely.</p><p>The first and simplest solution that came to mind was whitelisting circleci’s ip. It turns out it was a little bit more complicated than that, and here’s how I solved it.</p><h3>The Tunnel</h3><p>CircleCI dynamically creates a brand new instance to run the unit tests, and there is no way to antecipate the ip or the range of ips that circle would use.</p><p>The most obvious solution was to let the circleci instances into our VPC. But how to secure it properly ? Surely circle didn’t need access to the whole network, only to that one database intance so a tunnel would suffice.</p><p>So I created a brand new EC2 instance that would be used as a tunnel for the connections between circle and the database.. Which brings us to our next security problem.</p><p>Now we had a EC2 instance that had access to our database and we needed to allow ssh acccess to a number of unknown instances from circle.</p><p>And that’s when I found <strong>EC2 Instance Connect</strong>:</p><blockquote>With EC2 Instance Connect, you can control SSH access to your instances using AWS Identity and Access Management (IAM) policies as well as audit connection requests with AWS CloudTrail events. In addition, you can leverage your existing SSH keys or further enhance your security posture by generating one-time use SSH keys each time an authorized user connects.</blockquote><p><a href="https://aws.amazon.com/about-aws/whats-new/2019/06/introducing-amazon-ec2-instance-connect/">Introducing Amazon EC2 Instance Connect</a></p><h3>The Solution</h3><p>So finally, what I had to do was</p><ol><li>Create an AWS user with EC2 Instance Connect privileges for that one instance</li><li>Configure circleci’s aws-cli with the user’s credentials, that were kept safely inside circleci’s settings</li><li>Generate a fresh ssh key each time I built a circleci instance, then push it to my EC2 tunnel instance</li><li>Run the ssh tunnel</li><li>Run the tests as if they were being run locally</li></ol><p>It worked as a charm, and the best part is: the keys expire after a few seconds, making it even more secure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a831ebdbaed0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seu 1º Proxy grátis com tinyproxy e AWS EC2 em 20 minutos]]></title>
            <link>https://medium.com/@edunicastro/seu-1%C2%BA-proxy-gr%C3%A1tis-com-tinyproxy-e-aws-ec2-em-20-minutos-ff8a26d129f6?source=rss-7295af6f4ec6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff8a26d129f6</guid>
            <dc:creator><![CDATA[Eduardo Nicastro]]></dc:creator>
            <pubDate>Fri, 27 Dec 2019 00:16:01 GMT</pubDate>
            <atom:updated>2019-12-29T18:01:55.490Z</atom:updated>
            <content:encoded><![CDATA[<p>Um tutorial passo a passo de como criar seu próprio proxy grátis com tinyproxy e um container EC2 da AWS, além de configurar o filtro de url.</p><h4>1. Crie uma conta na AWS</h4><p>Vá até o <a href="http://aws.amazon.com/">site da aws</a> e crie uma conta grátis. Você vai precisar de um cartão de crédito mas a Amazon não será feita qualquer cobrança. Também será verificado seu telefone celular. Você pode escolher micro instâncias que são grátis, elas são suficientes para rodar o proxy.</p><h4>2. Crie uma instância EC2</h4><p>Após criar a sua conta acima, faça o login no <a href="https://console.aws.amazon.com/"><strong>AWS Management Console</strong></a><strong> </strong>e procure o serviço <strong>EC2</strong> na dashboard da página inicial. Na <strong>Dashboard do Serviço EC2, </strong>inicialize uma instância Ubuntu que está marcada como Free tier eligible<strong>, </strong>conforme mostra a imagem abaixo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kBxezC0kOjeB7MiG4VbVGg.png" /><figcaption>Elastic Container com Ubuntu (free)</figcaption></figure><p>Garanta que salvou corretamente o arquivo chave SSH (.pem) pois ele será necessário para conectar ao servidor.</p><h4>3. Istale o Tinyproxy</h4><p>O tinyproxy é um servidor de proxy de HTTP/HTTPS pequeno e rápido.<br>Para conectar via SSH com a sua instância a partir do terminal (linux/git bash):</p><pre>ssh -i ~/.ssh/mykeys.pem ubuntu@54.84.12.216</pre><pre><br># O caminho ~/.ssh/mykeys.pem é o caminho p/ a chave SSH que baixamos acima<br># ubuntu é o usuário padrão do container<br># O valor depois do @ é o ip ou public dns da sua instância. Marquei em laranja no print screen abaixo aonde localizar essa informação</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_D7CXGGJpGZ81yKzlYJvDg.png" /><figcaption>IP/DNS público</figcaption></figure><p><em>Obs (Windows):</em><strong><em> </em></strong><em>Caso esteja usando o Windows, o servidor via SSH utilizando o Putty.</em></p><p>Após conectar à instância via SSH, execute o comando:</p><pre>sudo apt-get install tinyproxy</pre><h3>4. Configure o Tinyproxy</h3><p>Comece editando o arquivo de configuração do tinyproxy que foi criado após a instalação:</p><pre>sudo nano /etc/tinyproxy/tinyproxy.conf</pre><p>Comente todas as linhas <strong>Allow </strong>colocando um # no seu início para que sejam aceitas conexões de qualquer ip:</p><pre>#Allow 127.0.0.1<br>#Allow 192.168.0.0/16<br>#Allow 172.16.0.0/12<br>#Allow 10.0.0.0/8</pre><p>*Passo Opcional: Se quiser fazer com que o proxy seja invisível, mude o valor do <strong>DisableViaHeader</strong> para <strong>Yes</strong>.</p><pre>DisableViaHeader Yes</pre><p><strong>5. Configure uma whitelist ou filtro</strong></p><p>Para garantir que seu proxy não vai ser usado por pessoas aleatórias da internet ou para fins indesejados, você pode facilmente configurar um filtro de domínios ou urls. Para isso, encontre as linhas abaixo e mude seus valores para os seguintes:</p><pre>Filter &quot;/etc/tinyproxy/whitelist&quot;<br>FilterURLs Yes<br>FilterDefaultDeny Yes<br>FilterExtended On<br>FilterURLs On</pre><p>Crie o arquivo de texto no caminho “/etc/tinyproxy/whitelist”, esse arquivo deve conter em cada linha as URLs de destino que o proxy <strong>não deve bloquear</strong>.</p><p>Também existe a possibilidade de usar expressões regulares nos valores das linhas que devem ser filtradas mas isso não será abordado nesse tutorial.</p><h4>6. Reinicie o serviço Tinyproxy</h4><pre>sudo service tinyproxy restart</pre><h4>7. Abra a porta 8888 do servidor do Tinyproxy:</h4><p>Em <strong>EC2 Management Console</strong> vá até <strong>Security Groups</strong> e crie um grupo que aceite conexões nas portas 22 e 8888. Aplique esse grupo à instância EC2 do proxy. Além disso, é altamente recomendado limitar os IPs dos usuários na configuração <strong>Source</strong>. Proxies que ficam abertos para todos podem ser descobertos por scanners e usados por pessoas aleatórias, consumindo utilização de banda na Amazon, o que pode vir a gerar cobranças.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/0*Bp6o0m-qMWb9oqOS.png" /><figcaption>EC2</figcaption></figure><h4>8. Palavras finais</h4><p>Nesse tutorial, criamos uma instância EC2 grátis na AWS, depois instalamos e configuramos o Tinyproxy de forma que possibilita que ela seja usada como um proxy grátis.</p><p>Além disso, configuramos o acesso à instância e limitamos as URLs que podem ser usadas pelo proxy para controlar a sua utlização e evitar que seja usado para outros fins.</p><p>Para maiores informações e possibilidades de configuração do Tinyproxy, leia a <a href="https://tinyproxy.github.io/">(documentação)</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff8a26d129f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>