<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
   <channel>
      <title>Alexandre Guimarães Malucelli</title>
      <description></description>
      <link>https://malucelli.net</link>
      <atom:link href="https://malucelli.net/feed.xml" rel="self" type="application/rss+xml"/>
      
         <xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><item>
            <title>AWS CloudWatch Logs for Chef</title>
            
            <description>&lt;p&gt;Last year I released an unofficial &lt;a href="https://www.chef.io/"&gt;Chef Cookbook&lt;/a&gt; on &lt;a href="https://supermarket.chef.io/cookbooks/aws-cloudwatchlogs"&gt;Chef Supermarket&lt;/a&gt; that install and configure &lt;a href="https://aws.amazon.com/cloudwatch/"&gt;AWS CloudWatch Logs&lt;/a&gt; Agent.&lt;/p&gt;

&lt;p&gt;AWS CloudWatch Logs is great service, it allows you to monitor your log files in centralized way in a nearly real-time through AWS Console, and also allows you to search in logs for specific phrases, values, or patterns.&lt;/p&gt;

&lt;p&gt;In order to help the deploy of CloudWatch Logs configurations, I started developing &lt;a href="https://github.com/amalucelli/chef-cloudwatchlogs"&gt;this cookbook&lt;/a&gt; when we at &lt;a href="https://fluig.com/identity"&gt;fluig Identity&lt;/a&gt;, chose AWS CloudWatch Logs as the solution for centralize all the logs that our applications generate &lt;em&gt;(today is about 250GB per month)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Below I’m going to show you how the cookbook works and how you can use it in your Chef.&lt;/p&gt;

&lt;h2 id="usage"&gt;Usage&lt;/h2&gt;

&lt;p&gt;First add this cookbook to your base recipe to install the agent in all of your servers &lt;em&gt;(you can use berks to download directly from Chef Supermarket)&lt;/em&gt;:&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-ruby" data-lang="ruby"&gt;&lt;span class="n"&gt;cookbook&lt;/span&gt; &lt;span class="s1"&gt;'aws-cloudwatchlogs'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'~&amp;gt; 1.1.6'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You need to configure the following node attributes by an &lt;code class="highlighter-rouge"&gt;environment&lt;/code&gt; or &lt;code class="highlighter-rouge"&gt;role&lt;/code&gt;, so the recipe can configure the agent by your specific configuration. All attributes are described at CloudWatch Logs &lt;a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AgentReference.html"&gt;official documentation&lt;/a&gt;, so please take a visit to understand and adapt it to your need.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-ruby" data-lang="ruby"&gt;&lt;span class="n"&gt;default_attributes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="s1"&gt;'aws_cwlogs'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s1"&gt;'region'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'your_aws_region'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'aws_access_key_id'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'your_aws_access_key'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'aws_secret_access_key'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'your_aws_secret_key'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s1"&gt;'log'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="s1"&gt;'syslog'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s1"&gt;'datetime_format'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'%b %d %H:%M:%S'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'file'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'/var/log/syslog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'buffer_duration'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'5000'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'log_stream_name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'{instance_id}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'initial_position'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'start_of_file'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'log_group_name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'/var/log/syslog'&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you don’t specify AWS credentials, the CloudWatch Logs Agent will attempt to use the AWS IAM Role assigned to the instance.&lt;/p&gt;

&lt;p&gt;You can also opt to configure by declaring it in another cookbook at a higher precedence level.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-ruby" data-lang="ruby"&gt;&lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'aws_cwlogs'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'region'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'your_aws_region'&lt;/span&gt;
&lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'aws_cwlogs'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'aws_access_key_id'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'your_aws_access_key'&lt;/span&gt;
&lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'aws_cwlogs'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'aws_secret_access_key'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'your_aws_secret_key'&lt;/span&gt;
&lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'aws_cwlogs'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'log'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'syslog'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="s1"&gt;'datetime_format'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'%b %d %H:%M:%S'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s1"&gt;'file'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'/var/log/syslog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s1"&gt;'buffer_duration'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'5000'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s1"&gt;'log_stream_name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'{instance_id}'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s1"&gt;'initial_position'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'start_of_file'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s1"&gt;'log_group_name'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'/var/log/syslog'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Once you defined those attributes, you will need to reference &lt;code class="highlighter-rouge"&gt;aws_cwlogs&lt;/code&gt; resource in one of your recipes, by doing:&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-ruby" data-lang="ruby"&gt;&lt;span class="n"&gt;include_recipe&lt;/span&gt; &lt;span class="s1"&gt;'aws-cloudwatchlogs'&lt;/span&gt;

&lt;span class="n"&gt;aws_cwlogs&lt;/span&gt; &lt;span class="s1"&gt;'syslog'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'aws_cwlogs'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'log'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'syslog'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This will create a unique log configuration file that will be stored in &lt;code class="highlighter-rouge"&gt;etc/config&lt;/code&gt; directory of your CloudWatch Logs Agent.&lt;/p&gt;

&lt;p&gt;If you have more that one &lt;code class="highlighter-rouge"&gt;log&lt;/code&gt; attribute, each log referred will be created in its own configuration file. This avoid us to create invalid configurations in servers that don’t have the log specified.&lt;/p&gt;

&lt;p&gt;For a complete documentation of the cookbook, please take a look at the &lt;a href="https://github.com/amalucelli/chef-cloudwatchlogs"&gt;project on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id="example"&gt;Example&lt;/h2&gt;

&lt;p&gt;Those attributes used before will generate the CloudWatch Logs configuration below.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-groovy" data-lang="groovy"&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;syslog&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;datetime_format&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="nl"&gt;H:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="nl"&gt;M:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;S&lt;/span&gt;
&lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;/var/&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;syslog&lt;/span&gt;
&lt;span class="n"&gt;buffer_duration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;
&lt;span class="n"&gt;log_stream_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="n"&gt;instance_id&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;initial_position&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;start_of_file&lt;/span&gt;
&lt;span class="n"&gt;log_group_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;/var/&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;syslog&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt;: You can configure as many logs as you need with the &lt;code class="highlighter-rouge"&gt;log&lt;/code&gt; attribute.&lt;/p&gt;

&lt;h2 id="whats-next"&gt;What’s next?&lt;/h2&gt;

&lt;p&gt;Currently, this cookbook was develop and tested only in Ubuntu, but, of course, pull requests are always welcome. If you have any questions, please feel free to create a &lt;a href="https://github.com/amalucelli/chef-cloudwatchlogs/issues/new"&gt;New Issue&lt;/a&gt; on the project.&lt;/p&gt;
</description>
            <pubDate>Sun, 21 May 2017 00:00:00 -0300</pubDate>
            <link>https://malucelli.net/2017/05/21/aws-cloudwatch-logs-for-chef/</link>
            <guid isPermaLink="true">https://malucelli.net/2017/05/21/aws-cloudwatch-logs-for-chef/</guid>
         </item>
      
         <item>
            <title>PPTP VPN on macOS Sierra</title>
            
            <description>&lt;p&gt;Apple stopped the support for it’s builtin PPTP VPN client on macOS Sierra, but they kept their libraries, so it’s still possible to create a PPTP VPN connection over command line without using any 3rd party clients, like &lt;a href="https://www.flowvpn.com"&gt;FlowVPN&lt;/a&gt; or &lt;a href="https://www.shimovpn.com"&gt;Shimo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I know that PPTP VPN has become outdated and is less secure than other protocols, but in a corporate world you sometimes don’t have a choice.&lt;/p&gt;

&lt;p&gt;The following procedure will show how you can create a PPTP VPN on macOS Sierra. It’s based on my own configuration (&lt;em&gt;MPPE-128&lt;/em&gt;), so you might have to adapt it to your need.&lt;/p&gt;

&lt;p&gt;The procedure is quite simple, you first need to create a file in &lt;code class="highlighter-rouge"&gt;/etc/ppp/peers&lt;/code&gt; with a name that represent your domain, or company, so in my case I will call it &lt;code class="highlighter-rouge"&gt;vpn.example.com&lt;/code&gt;.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo touch&lt;/span&gt; /etc/ppp/peers/vpn.example.com&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This file will contain the configuration that &lt;code class="highlighter-rouge"&gt;pppd&lt;/code&gt; daemon will reference and try to connect.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-bash" data-lang="bash"&gt;plugin PPTP.ppp
noauth
&lt;span class="c"&gt;# logfile /tmp/ppp.log&lt;/span&gt;
remoteaddress &lt;span class="s2"&gt;"vpn.example.com"&lt;/span&gt;
user &lt;span class="s2"&gt;"username"&lt;/span&gt;
password &lt;span class="s2"&gt;"mYS3cUr3P@ssW0rd!"&lt;/span&gt;
redialcount 1
redialtimer 5
idle 1800
&lt;span class="c"&gt;# mru 1368&lt;/span&gt;
&lt;span class="c"&gt;# mtu 1368&lt;/span&gt;
receive-all
novj 0:0
ipcp-accept-local
ipcp-accept-remote
&lt;span class="c"&gt;# noauth&lt;/span&gt;
refuse-eap
refuse-pap
refuse-chap-md5
hide-password
mppe-stateless
mppe-128
&lt;span class="c"&gt;# require-mppe-128&lt;/span&gt;
looplocal
nodetach
&lt;span class="c"&gt;# ms-dns 8.8.8.8&lt;/span&gt;
usepeerdns
&lt;span class="c"&gt;# ipparam gwvpn&lt;/span&gt;
defaultroute
debug&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now you only need start the &lt;code class="highlighter-rouge"&gt;pppd&lt;/code&gt; daemon with the following command and that’s it.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;pppd call vpn.example.com&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;em&gt;Note: This configuration will also change your default route to the VPN.&lt;/em&gt;&lt;/p&gt;
</description>
            <pubDate>Tue, 16 May 2017 00:00:00 -0300</pubDate>
            <link>https://malucelli.net/2017/05/16/pptp-vpn-on-macos-sierra/</link>
            <guid isPermaLink="true">https://malucelli.net/2017/05/16/pptp-vpn-on-macos-sierra/</guid>
         </item>
      
         <item>
            <title>Testing Amazon SES SMTP with OpenSSL</title>
            
            <description>&lt;p&gt;Over the last few months, we are using &lt;a href="https://aws.amazon.com/ses"&gt;Amazon Simple Email Service (SES)&lt;/a&gt; as our default mail service at &lt;a href="https://fluig.com/identity"&gt;fluig Identity&lt;/a&gt;. AWS SES is just like any other SMTP service, it also requires a username and password for authentication, but as SES is a AWS service, those credentials are based on IAM credentials, so &lt;em&gt;Access Key ID&lt;/em&gt; in this case will be our username, and &lt;em&gt;Secret Access Key&lt;/em&gt;, using a &lt;em&gt;HMAC-SHA256&lt;/em&gt; algorithm, will be our password.&lt;/p&gt;

&lt;p&gt;This tutorial will show you how you can simulate a communication with AWS SES SMTP interface through OpenSSL, where you can troubleshoot IAM problems before setting them up in your application.&lt;/p&gt;

&lt;p&gt;For this example, &lt;code class="highlighter-rouge"&gt;AKIAIOSFODNN7EXAMPLE&lt;/code&gt; will be our &lt;em&gt;Access Key ID&lt;/em&gt;, &lt;code class="highlighter-rouge"&gt;wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY&lt;/code&gt; our &lt;em&gt;Secret Access Key&lt;/em&gt; and &lt;em&gt;noreply@malucelli.net&lt;/em&gt; the e-mail address registered and verified in AWS SES.&lt;/p&gt;

&lt;p&gt;To create a password with &lt;em&gt;HMAC-SHA256&lt;/em&gt; algorithm, the first thing we need to do is to encode our &lt;em&gt;Secret Access Key&lt;/em&gt;. You can use the Python function below to encode a string with &lt;em&gt;HMAC-SHA256&lt;/em&gt;.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="c1"&gt;#!/usr/bin/env python
&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;b64encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"{0}{1}"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\x02&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hmac&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'utf-8'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s"&gt;'SendRawEmail'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;digestmod&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now you can simply call the function by passing the &lt;em&gt;Secret Access Key&lt;/em&gt; as a parameter, that you will get your password encoded in &lt;em&gt;HMAC-SHA256&lt;/em&gt;.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;python encode.py &lt;span class="s2"&gt;"wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY"&lt;/span&gt;
AlRfBgIG4YXDUfEVX5UTIZKnYjvlGay7eQtqp1ifwd7Z&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To communicate with a AWS SES SMTP interface, both username and password need to be encoded in &lt;em&gt;base64&lt;/em&gt;, as you can see below.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"AKIAIOSFODNN7EXAMPLE"&lt;/span&gt; | &lt;span class="nb"&gt;base64
&lt;/span&gt;&lt;span class="nv"&gt;QUtJQUlPU0ZPRE5ON0VYQU1QTEU&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"AlRfBgIG4YXDUfEVX5UTIZKnYjvlGay7eQtqp1ifwd7Z"&lt;/span&gt; | &lt;span class="nb"&gt;base64
&lt;/span&gt;&lt;span class="nv"&gt;QWxSZkJnSUc0WVhEVWZFVlg1VVRJWktuWWp2bEdheTdlUXRxcDFpZndkN1o&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Also the communication needs to be done using &lt;em&gt;Transport Layer Security (TLS)&lt;/em&gt;, so we will use &lt;code class="highlighter-rouge"&gt;openssl&lt;/code&gt; rather than &lt;code class="highlighter-rouge"&gt;telnet&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the example below, we will open a SMTP connection, authenticate using our IAM credential encoded and send a simple message to myself.&lt;/p&gt;

&lt;figure class="highlight"&gt;&lt;pre&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;openssl s_client &lt;span class="nt"&gt;-crlf&lt;/span&gt; &lt;span class="nt"&gt;-quiet&lt;/span&gt; &lt;span class="nt"&gt;-starttls&lt;/span&gt; smtp &lt;span class="nt"&gt;-connect&lt;/span&gt; email-smtp.us-east-1.amazonaws.com:587

HELO malucelli.net
AUTH LOGIN
&lt;span class="nv"&gt;QUtJQUlPU0ZPRE5ON0VYQU1QTEU&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
&lt;span class="nv"&gt;QWxSZkJnSUc0WVhEVWZFVlg1VVRJWktuWWp2bEdheTdlUXRxcDFpZndkN1o&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
MAIL FROM: &amp;lt;noreply@malucelli.net&amp;gt;
RCPT TO: &amp;lt;alexandre@malucelli.net&amp;gt;
DATA
Hi, this is a example mail.
&lt;span class="nb"&gt;.&lt;/span&gt;
QUIT&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This saved me time while we were implementing AWS SES, where I could test IAM credentials before setting them up in our applications. I hope this help you as well.&lt;/p&gt;
</description>
            <pubDate>Sun, 14 May 2017 00:00:00 -0300</pubDate>
            <link>https://malucelli.net/2017/05/14/testing-amazon-ses-smtp-with-openssl/</link>
            <guid isPermaLink="true">https://malucelli.net/2017/05/14/testing-amazon-ses-smtp-with-openssl/</guid>
         </item>
      
         <item>
            <title>My Personal Dotfiles</title>
            
            <description>&lt;p&gt;The name &lt;em&gt;“dotfiles”&lt;/em&gt; are derived from Unix-like configuration files that start with a dot (like &lt;em&gt;.bash_profile&lt;/em&gt;, &lt;em&gt;.vimrc&lt;/em&gt;, etc), and are common to serve as the files that you can use to customize your system and your apps.&lt;/p&gt;

&lt;p&gt;Today already exists a large community around this, with a &lt;a href="https://github.com/search?q=dotfiles"&gt;big number of repositories&lt;/a&gt; ready to go.&lt;/p&gt;

&lt;p&gt;I have some of my friends that already did and shared their own dotfiles, so I decided to share mine as well!&lt;/p&gt;

&lt;p&gt;In the beginning, I did a few research and I tried some dotfiles, but none pleased me as the &lt;a href="https://github.com/mathiasbynens/dotfiles"&gt;@mathiasbynens/dotfiles&lt;/a&gt;, which ended as the base of my dotfiles.&lt;/p&gt;

&lt;p&gt;I created a &lt;a href="https://github.com/amalucelli/dotfiles"&gt;repository on GitHub&lt;/a&gt;, with all necessary steps and files that are included in this configuration. It covers &lt;strong&gt;Terminal&lt;/strong&gt;, &lt;strong&gt;Git&lt;/strong&gt;, &lt;strong&gt;Bash&lt;/strong&gt;, &lt;strong&gt;Sublime Text&lt;/strong&gt; and &lt;strong&gt;Vim&lt;/strong&gt; configurations and preferences. I hope you like it!&lt;/p&gt;

&lt;p&gt;Fell free to use and customize. If you wanna contribute with anything, just &lt;a href="https://github.com/amalucelli/dotfiles/issues"&gt;let me know&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The final result looks like this:&lt;/p&gt;

&lt;h3 id="terminal"&gt;Terminal&lt;/h3&gt;

&lt;p&gt;&lt;img src="/uploads/2015/10/dotfiles-terminal.png" alt="Terminal" data-action="zoom" /&gt;&lt;/p&gt;

&lt;h3 id="vim"&gt;Vim&lt;/h3&gt;

&lt;p&gt;&lt;img src="/uploads/2015/10/dotfiles-vim.png" alt="Vim" data-action="zoom" /&gt;&lt;/p&gt;
</description>
            <pubDate>Tue, 20 Oct 2015 00:00:00 -0200</pubDate>
            <link>https://malucelli.net/2015/10/20/my-personal-dotfiles/</link>
            <guid isPermaLink="true">https://malucelli.net/2015/10/20/my-personal-dotfiles/</guid>
         </item>
      
         <item>
            <title>Missing xcrun on OS X El Capitan</title>
            
            <description>&lt;p&gt;Today I updated my MacBook to the latest version of OS X, &lt;a href="https://www.apple.com/osx/elcapitan-preview/"&gt;El Capitan&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The upgrade ran successfully and everything seemed great, except when I open the Terminal and realized that some of the commands that I use daily, like &lt;em&gt;git&lt;/em&gt; or &lt;em&gt;brew&lt;/em&gt;, started giving me the error below:&lt;/p&gt;

&lt;div class="language-bash highlighter-rouge"&gt;&lt;div class="highlight"&gt;&lt;pre class="highlight"&gt;&lt;code&gt;xcrun: error: invalid active developer path &lt;span class="o"&gt;(&lt;/span&gt;/Library/Developer/CommandLineTools&lt;span class="o"&gt;)&lt;/span&gt;, missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I found after a few &lt;em&gt;googling&lt;/em&gt; that this error is origined by the lack of &lt;strong&gt;Xcode Command Line Tools&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The wired part is that I had the Command Line Tools installed in Yosemit. I guess that El Capitan remove it by default.&lt;/p&gt;

&lt;p&gt;I only had to reinstall Xcode Command Line Tools with the command below, to fix the problem.&lt;/p&gt;

&lt;div class="language-bash highlighter-rouge"&gt;&lt;div class="highlight"&gt;&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;xcode-select &lt;span class="nt"&gt;--install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
            <pubDate>Thu, 01 Oct 2015 00:00:00 -0300</pubDate>
            <link>https://malucelli.net/2015/10/01/missing-xcrun-on-os-x-el-capitan/</link>
            <guid isPermaLink="true">https://malucelli.net/2015/10/01/missing-xcrun-on-os-x-el-capitan/</guid>
         </item>
      
         <item>
            <title>Ciao Mondo</title>
            
            <description>&lt;p&gt;Hey! If you don’t know me, first take a look at &lt;a href="http://malucelli.net/about/"&gt;my profile&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;This blog begins with the urge to write again, to share some of my knowledge, learnings, thoughts, projects and moments of my life that worth a post. &lt;/p&gt;

&lt;p&gt;I had a personal blog years ago, but at the time, it was not my priority and I was not committed to the project, so I always had an excuse to abandon the blog.&lt;/p&gt;

&lt;h2 id="the-challenge"&gt;The Challenge&lt;/h2&gt;

&lt;p&gt;Write is a challenge to me, it demands time and a lot of concentration, two things that will be difficult to me at beginning. Actually, I’m very excited with this project, because it will help me to take a time to put my thoughts together.&lt;/p&gt;

&lt;p&gt;As you can see, I’m also writing in english. This time I chose only english because of the technical content that I’ll produce.&lt;/p&gt;

&lt;p&gt;I tend to write about:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Articles about DevOps - tools, cookbooks, culture&lt;/li&gt;
  &lt;li&gt;Projects I’m working on&lt;/li&gt;
  &lt;li&gt;Things that don’t fill in 140 characters&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id="blogging-platform"&gt;Blogging Platform&lt;/h2&gt;

&lt;p&gt;I gave a chance to &lt;a href="http://jekyllrb.com/"&gt;Jekyll&lt;/a&gt; and hosted the blog at &lt;a href="https://pages.github.com/"&gt;GitHub Pages&lt;/a&gt;. I already knew some blogs that were built with this setup, and the performance of those sites was something that shined my eyes. &lt;/p&gt;

&lt;p&gt;I’ll not blog about &lt;a href="https://www.google.com.br/search?q=how%20to%20setup%20jekyll%20with%20github%20pages"&gt;“how to setup jekyll with github pages”&lt;/a&gt; because there are a thousands over the internet.&lt;/p&gt;

&lt;p&gt;In short: I’m enjoying so far, is pure static content with markdown language, you should try it!&lt;/p&gt;
</description>
            <pubDate>Mon, 18 May 2015 00:00:00 -0300</pubDate>
            <link>https://malucelli.net/2015/05/18/ciao-mondo/</link>
            <guid isPermaLink="true">https://malucelli.net/2015/05/18/ciao-mondo/</guid>
         </item>
      
   </channel>
</rss>