<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.5">Jekyll</generator><link href="https://gpestana.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://gpestana.com/" rel="alternate" type="text/html" /><updated>2024-02-26T09:24:02+00:00</updated><id>https://gpestana.com/feed.xml</id><title type="html">gpestana spaceship</title><subtitle>@gpestana spaceship</subtitle><entry><title type="html">Coin Flipping Request Delegation</title><link href="https://gpestana.com/posts/coin-flipping-req-delegation" rel="alternate" type="text/html" title="Coin Flipping Request Delegation" /><published>2019-04-21T12:04:14+00:00</published><updated>2019-04-21T12:04:14+00:00</updated><id>https://gpestana.com/posts/coin-flipping-req-delegation</id><content type="html" xml:base="https://gpestana.com/posts/coin-flipping-req-delegation"><![CDATA[<p>The goal of Coin Flipping Request Delegation (CFRD) is to add plausible deniability of routing and lookup requests in P2P networks,
with special emphasis on DHT networks. The CFRD lookup protocol works by probabilistically creating a new lookup from a received
routing request.</p>

<h3 id="cfrd-in-kademlia-dht">CFRD in Kademlia DHT</h3>

<p>In a Kademlia lookup request (as defined by these <a href="http://xlattice.sourceforge.net/components/protocol/kademlia/specs.html">specs</a>),
the lookup initiator creates an ordered shortlist containing k peers closest to the <code class="language-plaintext highlighter-rouge">ID</code> of the <code class="language-plaintext highlighter-rouge">contentID</code> requested. The shortlist 
is ordered by proximity and is first populated with peers in the initiator’s bucket list. Each iteration of the protocol consists of 
selecting α of the closest peers to the <code class="language-plaintext highlighter-rouge">contentID</code> in the shortlist and issue in parallel a FIND_VALUE request to them. The responses
contain a set of the closest peers of each of the peers which that received the <code class="language-plaintext highlighter-rouge">FIND_VALUE</code> request. This information is added to the
shortlist in a way that it maintains its order (i.e. first peers are closer to the <code class="language-plaintext highlighter-rouge">contentID</code>). This protocol proceeds until 1) a peer
responds with <code class="language-plaintext highlighter-rouge">STORE</code> message (value found); 2) an iteration in which no new peer is added to the shortlist (value not found) and;
3) lookup timeout.</p>

<p>The <code class="language-plaintext highlighter-rouge">CFRD</code> construction transforms <code class="language-plaintext highlighter-rouge">FIND_VALUE</code> requests into new <code class="language-plaintext highlighter-rouge">FIND_VALUE</code> requests in a probabilistic way. When a peer receives a 
<code class="language-plaintext highlighter-rouge">FIND_VALUE</code> request, it will flip a coin to decide whether to respond to the request or instead start a lookup request itself. Once the
lookup is resolved by the new peer (which is not the original initiator), it will cache the content and reply to the peer which initially
asked for the content with a <code class="language-plaintext highlighter-rouge">STORE</code> message.</p>

<p>This mechanism adds plausible deniability to DHT lookups, since (privacy) adversaries monitoring network requests (locally and to a certain 
threshold) will not be able to distinguish between original content lookups from lookups that were initiated because of the CFRD mechanism. 
This mechanism aims at decoupling peer behaviour (network request) from user behaviour (interests and personal behaviour).</p>

<p>Comments and discussions on <a href="https://github.com/gpestana/notes/issues/23">github</a>.</p>]]></content><author><name></name></author><category term="p2p" /><category term="dht" /><category term="privacy" /><summary type="html"><![CDATA[The goal of Coin Flipping Request Delegation (CFRD) is to add plausible deniability of routing and lookup requests in P2P networks, with special emphasis on DHT networks. The CFRD lookup protocol works by probabilistically creating a new lookup from a received routing request.]]></summary></entry><entry><title type="html">Everyone is naked: Privacy in P2P networks</title><link href="https://gpestana.com/posts/everyone-is-naked" rel="alternate" type="text/html" title="Everyone is naked: Privacy in P2P networks" /><published>2019-03-01T12:04:14+00:00</published><updated>2019-03-01T12:04:14+00:00</updated><id>https://gpestana.com/posts/everyone-is-naked</id><content type="html" xml:base="https://gpestana.com/posts/everyone-is-naked"><![CDATA[<p>The ethos of the P2P community and the decentralized web is based on a new paradigm where people and communities can interoperate and collaborate without the need for external stewardship. This new paradigm opens doors for user self-sovereignty, personal data ownership and freedom from central authorities which incentives tend to lock-in their users and to hold and monetize private data in order to maximize their profits. However, P2P and decentralized protocols are complex and collaboration between multiple parties often leaks metadata that can be used to target individuals and communities. While centralized systems disclose user’s behaviour and social graph to one centralized entity, naive decentralized systems potentially disclose that information to everyone in the network. While it is clear that current systems are not focusing on user privacy, failing to deliver it will render decentralized systems unusable and unattractive for mass adoption or as a viable alternative to centralized systems.</p>

<p><a href="https://news.ycombinator.com/item?id=15109637">Download and read the full paper here</a></p>]]></content><author><name></name></author><category term="P2P" /><category term="privacy" /><category term="research" /><category term="talk" /><summary type="html"><![CDATA[The ethos of the P2P community and the decentralized web is based on a new paradigm where people and communities can interoperate and collaborate without the need for external stewardship. This new paradigm opens doors for user self-sovereignty, personal data ownership and freedom from central authorities which incentives tend to lock-in their users and to hold and monetize private data in order to maximize their profits. However, P2P and decentralized protocols are complex and collaboration between multiple parties often leaks metadata that can be used to target individuals and communities. While centralized systems disclose user’s behaviour and social graph to one centralized entity, naive decentralized systems potentially disclose that information to everyone in the network. While it is clear that current systems are not focusing on user privacy, failing to deliver it will render decentralized systems unusable and unattractive for mass adoption or as a viable alternative to centralized systems.]]></summary></entry><entry><title type="html">Privacy preserving engineering</title><link href="https://gpestana.com/posts/privacy-preserving-engineering" rel="alternate" type="text/html" title="Privacy preserving engineering" /><published>2019-02-01T12:04:14+00:00</published><updated>2019-02-01T12:04:14+00:00</updated><id>https://gpestana.com/posts/privacy-preserving-engineering</id><content type="html" xml:base="https://gpestana.com/posts/privacy-preserving-engineering"><![CDATA[<p>One thing that is interesting about P2P and decentralised networks is that they tend to the “property extreme” (!lacking of a better name..). Consider, for example, scalability. P2P networks have better <em>potential</em> to scale compared to centralised (and distributed) client-server systems. That <em>potential</em> comes from the fact that network users can contribute with resources for the network to function, resulting on very interesting and self-sustained ecosystem in which scalability is elastic and self-regulated. The problem is how complex it is for designers and developers to turn that <em>potential</em> into reality: P2P protocols and networks are hard to design and to implement. It’s hard to get all the pieces right: from low level networking to peer interaction protocols, incentives design, security, trust, privacy (and the list goes on..). Potential and complexity are the forces behind the “property extreme” in P2P decentralised systems: a system can potentially provide very good scalability but if it is poorly designed and implemented scalability will end up being a bottleneck instead of an edge.</p>

<p>Same goes for privacy. One of the most interesting propositions of P2P and decentralised networks is its potential for respecting user’s privacy by design. Privacy by design becomes even more promising when compared to the current state of affairs in which the services we use online are owned by companies with the means and the incentives to register everything about their users. In P2P and decentralised networks, there is no central entity which sieves through all what happens in the network. However, P2P designs often require many to many communication patterns and collaboration. Users in the network often work as message relayers (one of the ways for everyone to contribute with resources to the network) and need to make decisions based on their partial view of the state of the network. With such constraints, network users (or peers) need to collaborate and learn about each other’s partial view of the network state. At a higher level, these interactions often result on a lot of systemic leakage of privacy-sensitive information: what a peers knows over time may disclose what she’s been up to. Or correlating the message patterns over time of a subset of network peers may disclose what data they are consuming or serving. This information leakage is even more important because it is disclosed not to one entity as in centralised systems, but potentially to the whole network. Again, the “property extreme” is at play: there is a lot of potential to design and implement systems with the best privacy properties, but it will most likely be leaking private data all over the place.</p>

<p>So there is a problem: it is hard to design and implement P2P and decentralised networks and ensure the correct properties. For privacy preserving networks, there is lack of primitives and implemented protocols that can be easily used and adapted by developers. There is also a rather large chasm between academic research on anonymous communications and privacy preserving networking and the mechanisms and protocols implemented by current P2P projects. I argue that if we want to design and build privacy preserving networks, we need as a community to invest more time on:</p>

<ul>
  <li>building modular and easy to use primitives and protocols for privacy preserving P2P networks;</li>
  <li>improve developer and system designer awareness about privacy enhancing technologies;</li>
  <li>close the gap between academia and industry: bring the of the art on research of privacy preserving networks to the industry as soon as possible;</li>
  <li>measure and assess privacy in current P2P networks and understand how to improve it.</li>
</ul>

<p><strong>Privacy preserving engineering</strong> is not a thing. Yet. We at hashmatter are working on projects that enable developers and P2P system designers to build privacy preserving networks. We’re building p3lib, is a library with modular privacy preserving primitives and protocols (p3) for routing and messaging in P2P networks. We’ve also started PPP, a list of primitives and protocols that can be used in networked systems for improving privacy and anonymity. And we’ve been also researching on privacy preserving networks. We also believe that the community could use more network security and privacy audits of P2P networks, so we are also putting those efforts together.</p>]]></content><author><name></name></author><category term="security" /><category term="privacy-preserving-networks" /><category term="P2P" /><summary type="html"><![CDATA[One thing that is interesting about P2P and decentralised networks is that they tend to the “property extreme” (!lacking of a better name..). Consider, for example, scalability. P2P networks have better potential to scale compared to centralised (and distributed) client-server systems. That potential comes from the fact that network users can contribute with resources for the network to function, resulting on very interesting and self-sustained ecosystem in which scalability is elastic and self-regulated. The problem is how complex it is for designers and developers to turn that potential into reality: P2P protocols and networks are hard to design and to implement. It’s hard to get all the pieces right: from low level networking to peer interaction protocols, incentives design, security, trust, privacy (and the list goes on..). Potential and complexity are the forces behind the “property extreme” in P2P decentralised systems: a system can potentially provide very good scalability but if it is poorly designed and implemented scalability will end up being a bottleneck instead of an edge.]]></summary></entry><entry><title type="html">Why everyone should use Tor</title><link href="https://gpestana.com/posts/why-everyone-should-use-tor" rel="alternate" type="text/html" title="Why everyone should use Tor" /><published>2018-01-01T12:04:14+00:00</published><updated>2018-01-01T12:04:14+00:00</updated><id>https://gpestana.com/posts/why-everyone-should-use-tor</id><content type="html" xml:base="https://gpestana.com/posts/why-everyone-should-use-tor"><![CDATA[<p>It’s <a href="https://www.newyorker.com/news/news-desk/cambridge-analytica-and-the-perils-of-psychographics">been</a> <a href="https://www.youtube.com/watch?v=mpbeOCKZFfQ">interesting</a> <a href="https://github.com/SINTEF-9012/grindr-privacy-leaks">weeks</a> for those who have been thinking about online privacy and data protection and what does it mean in today’s hyper connected society. Although this is a multi layered problem - personal data can be collected at different network layers and in multiple ways- one of the most effective ways to protect our personal data is to use the <a href="https://www.torproject.org/">Tor network</a>.</p>

<p>When I tell friends and non so technical people that they should be accessing the web through technologies that are used to access the dark web, I’m often received surprised reactions, fear, confusion and even disgust. Although it is not hard to explain how Tor works and why is it used for illicit purposes, it’s been harder to explain why everyone should leverage Tor on a daily basis.</p>

<p>In a nutshell, the reason why you should use Tor is privacy, personal protection and economics. Yes, the technology that powers part of the dark web can be used for very good and legit purposes - as a matter of fact, the bulk of the traffic going through Tor is exactly that. But surprise, surprise: just like any other technology, it’s all about how it is put into use. So let me lay out why I believe using Tor is important for you and our society:</p>

<p>The first reason is that internet providers and governments have the tools and the will to track online behavior of users and citizens, respectively. This is a fact and it was demonstrated by the documents leaked by Snowden and Manning about internet surveillance programs carried out by the US and EU intelligent services. You may trust your government and thus not be concerned about the fact that your government is able to collect all your online activity - and of your families. Remember though, that the data is not only collected but also stored, and with the current volatility in the world, are we able to ensure that sensitive data about ourselves and our families will not be used against us in the future by some sketchy people that got to govern us? We do not need nor have to take that risk.</p>

<p>Another reason is essentially that our lives are more connected than ever. The danger of having more devices in our home connected to the internet is that it opens doors to surveillance and targeted attacks. Unfortunately there have been cases of attackers being able to speak to a baby through babycam which is connected to the internet.</p>

<p>Apart from those targeted attacks, the fact that we are more connected than even gives companies and corporations the capabilities to harvest more and more data about our private data. Where do we usually access the internet? Which websites do we use the most? What are our interests? Which services do we use? All this data can be easily harvested and ultimately put together to make a accurate profile of who we are. This data can easily be used for business purposes without our consent, discrimination and criminal purposes.</p>

<p>Technologies like Tor create a privacy layer which allows you to protect your online privacy and sensitive data leaks.</p>

<p>The 3rd point I’d like to make is economics. Using these technologies is basically making illicit data harvesting hard. So hard that it becomes nonviable to do so. It’s all about economics: if we all make it hard for attackers and companies to illegally gather people’s data, then it becomes just too expensive for them to do so. It becomes too expensive for companies like Cambridge Analytica to profile people’s based on their data in order to change the course of democratic elections. Or it becomes really expensive for rogue governments to spy on their citizens looking for opportunities to silent opponents. Same goes for those who are selling your data to the highest bidder. If enough people turn their privacy shields on, this business model will not be viable anymore. So it becomes almost an ethically and moral imperative to protect your personal data. Not only for yourself, but for a fairer and more secure online society.</p>

<p>If you are still not convinced and you still don’t see a reason why you nor anyone else should use technologies that hide user’s online activity, think about the journalists, whistle blowers, political dissidents, NGOs and other citizens at risk that use Tor to communicate and share information safely, without being traced by potential rogue governments or any malintended actors. In those cases, it is life threatening to use the internet without the privacy and security provided by Tor.</p>]]></content><author><name></name></author><category term="tor" /><category term="security" /><category term="privacy" /><summary type="html"><![CDATA[It’s been interesting weeks for those who have been thinking about online privacy and data protection and what does it mean in today’s hyper connected society. Although this is a multi layered problem - personal data can be collected at different network layers and in multiple ways- one of the most effective ways to protect our personal data is to use the Tor network.]]></summary></entry><entry><title type="html">In Pursuit of Private DHTs</title><link href="https://gpestana.com/posts/private-dhts" rel="alternate" type="text/html" title="In Pursuit of Private DHTs" /><published>2018-01-01T12:04:14+00:00</published><updated>2018-01-01T12:04:14+00:00</updated><id>https://gpestana.com/posts/private-dhts</id><content type="html" xml:base="https://gpestana.com/posts/private-dhts"><![CDATA[<p>Services based on P2P and decentralized networks are reaching mass adoption (e.g. Bitcoin, Ethereum, IPFS, Dat). People are calling this new wave of distributed and decentralized systems the Web 3.0. Many of these services and networks rely heavily on Distributed Hash Tables (DHTs) - e.g. IPFS, bittorrent - or use it as an important building block (e.g. Ethereum). It is expected that DHTs will be an important building block for many networks and services for the Web 3.0.</p>

<p>Distributed hash tables are powerful protocols that enable content discovering and routing in P2P networks. In “vanilla” DHT implementations (e.g. Kademlia, Chord), peer interactions leak a lot of information about who is in the network, who stores what files and who are the producers and consumers of content. This gives potential attackers a good picture of the network with fewer resources and hinders anonymous and private interactions over P2P DHT overlay networks.</p>

<p>Some of the desirable properties of a private and metadata resistant DHT are:</p>

<ul>
  <li>Anonymity for producers of content: tracking down who was the originator of content stored in the DHT should not be possible.</li>
  <li>Anonymity for consumers of content: nodes that request content from the DHT should not be linked to the requested content by external actors.</li>
  <li>Plausible deniability of the files hosted in the network nodes: when peers query for content in the DHT, they should not be able to identify which peers are storing the content.</li>
</ul>

<p>The information leaked by DHTs can be used to target and censor individuals, communities and services. Private, anonymous and metadata resistant systems are important for ensuring that our privacy is protected against attackers. Thus, given the importance DHTs will have in future services and networks, it is important to research and develop protocols and primitives that keep DHT users anonymous.</p>

<p><a href="https://github.com/gpestana/notes/issues/8">Research on metadata resistant DHT (Github)</a></p>]]></content><author><name></name></author><category term="security" /><category term="privacy" /><category term="dht" /><summary type="html"><![CDATA[Services based on P2P and decentralized networks are reaching mass adoption (e.g. Bitcoin, Ethereum, IPFS, Dat). People are calling this new wave of distributed and decentralized systems the Web 3.0. Many of these services and networks rely heavily on Distributed Hash Tables (DHTs) - e.g. IPFS, bittorrent - or use it as an important building block (e.g. Ethereum). It is expected that DHTs will be an important building block for many networks and services for the Web 3.0.]]></summary></entry><entry><title type="html">The moral imperative to leave social networks</title><link href="https://gpestana.com/posts/moral-imperative-social-networks" rel="alternate" type="text/html" title="The moral imperative to leave social networks" /><published>2017-03-05T12:04:14+00:00</published><updated>2017-03-05T12:04:14+00:00</updated><id>https://gpestana.com/posts/moral-imperative-social-networks</id><content type="html" xml:base="https://gpestana.com/posts/moral-imperative-social-networks"><![CDATA[<p>there is a moral imperative to leave the main social networks if they continue to operate as they do. while connecting people is a noble thing, exploiting them for money is unethical to say the least.</p>

<p>the dopamine shots carefully engineered to hook us up are ethically and morally wrong. those strategies do not improve user’s well being or satisfaction with the product. users come back because they become addicted to it. not because the product makes them happier in the long run or because there are other benefits besides the easy and quick addiction fix. let’s get this straight: these corporations are engineering their product to make people addicted, so they can sell user’s data and attention for profit.</p>

<p>there are some ways to fight against those practices. one is to unplug from social networks which use unethical tactics to get users hooked up. our best weapon is the network effect those social networks feed from, although that’s our biggest weakness too. if there are not enough people taking a step back and stop being cannon fodder in the battle for attention and profit, there is no incentive for companies to change their strategies. I believe, though, that it is still the best legal weapon we can use.</p>

<p>many people have spoken out about this before. many have left social networks while others were not able to completely unplug. there is, though, a moral imperative to do so. I’m afraid the modus operandus of social networks have become natural for the younger generations. those companies are now speaking openly about their tactics [1],[2]. they are more transparent than ever about the strategies they use to hook us up because it is slowly becoming generally acceptable. although we live longer and more connected nowadays, it feels that we grow older much faster: the gap between my generation values and those of younger generations have widen faster than ever before. it might be too late to change the course of things: the future around the corner may bring state and corporate surveillance and individual’s’ attention treated as a commercial commodity. But I will fight against it.</p>

<hr />

<p>[1] <a href="https://www.axios.com/sean-parker-facebook-exploits-a-vulnerability-in-humans-2507917325.html">Sean Parker: Facebook was designed to exploit human “vulnerability”</a>
[2] <a href="https://techcrunch.com/2017/02/13/dopamine-labs-slings-tools-to-boost-and-reduce-app-addiction">Dopamine Labs</a></p>]]></content><author><name></name></author><category term="social-network" /><category term="ethics" /><summary type="html"><![CDATA[there is a moral imperative to leave the main social networks if they continue to operate as they do. while connecting people is a noble thing, exploiting them for money is unethical to say the least.]]></summary></entry><entry><title type="html">kapacitor-unit: unit tests framework for TICKscripts</title><link href="https://gpestana.com/posts/kapacitor-unit" rel="alternate" type="text/html" title="kapacitor-unit: unit tests framework for TICKscripts" /><published>2017-02-01T12:04:14+00:00</published><updated>2017-02-01T12:04:14+00:00</updated><id>https://gpestana.com/posts/kapacitor-unit</id><content type="html" xml:base="https://gpestana.com/posts/kapacitor-unit"><![CDATA[<p>This post discusses ideas for a proof of concept for a unit test framework for Kapacitor’s TICKscripts and alerts. If you are not familiar with Kapacitor and the TICK script I really suggest you to go ahead and check <a href="https://www.influxdata.com/">InfluxData’s website</a> and learn more about it! In short, the TICK stack is a time series data platform that allows you to easily store, analyse and act on time series data at scale.</p>

<p>When you rely heavily on the TICK stack to make sure your systems are up and running all the time, the amount of TICKscripts will potentially become harder to manage. In addition, every time you need to change the parameters of an alert – which can be quite often –, a lot of time is spent on making sure that the alert works as intended and that the TICKscript is correct.</p>

<p>When you rely heavily on the TICK stack to make sure your systems are up and running all the time, the amount of TICKscripts will potentially become harder to manage. In addition, every time you need to change the parameters of an alert – which can be quite often –, a lot of time is spent on making sure that the alert works as intended and that the TICKscript is correct.</p>

<p>When testing a task, you can always define multiple <a href="https://docs.influxdata.com/kapacitor/v1/introduction/getting-started/">recordings</a> and replay them to check whether the task behaves as expected or not. Though, this approach still has a couple of issues: there is a lot of manual work to record and replay the test data and it is not easy to keep the recordings up to date with changing TICKscripts.</p>

<p>Another problem with manually testing the TICKscripts is the amount of manual (or funny scripting) needed to load the tasks, enable, replay recordings, check the results, and tear down test databases. All of these actions should be made against a non production Influxdb/Kapacitor.</p>

<p>In this blog post, I propose way to test TICKscripts in an automated way, using kapacitor-unit.</p>

<h3 id="reasons-for-using-kapacitor-unit">Reasons for using kapacitor-unit</h3>

<ol>
  <li>When you rely heavily on the TICK stack to make sure your systems are up and running all the time, the amount of TICKscripts will potentially become harder to manage.</li>
  <li>When creating new (and complex) TICKscripts, it is hard to test all possible cases before getting the script into production. Record and replay features are helpful, but still require a lot of manual work and a reliable set of recorded data, which might not be easy to get.</li>
  <li>In addition, every time you need to change the parameters of an alert – which can be quite often –, a lot of time is spent on making sure that the alert works as intended and that the TICKscript is correct.</li>
  <li>Currently, there is no easy way to run tests over multiple TICKscripts, check the results and provide proper reporting.</li>
</ol>

<h3 id="the-idea">The idea</h3>

<p>The main goal of kapacitor-unit is to streamline and make it easier to run a battery of tests against TICKscripts. A TICKscript should be tested independently. There should be an easy and streamlined way to define the data to run in the tests, compare the Kapacitor results with the expected results and provide test reporting. All the tests whould against a dedicated Kapacitor.</p>

<h3 id="how-to-use-it">How to use it</h3>

<p>First, define test definitons in a test configuration file:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Test case for alert_weather.tick
tests:
   # This is the configuration for a test case. The 'name' must be unique in the
   # same test configuration. 'description' is optional
  - name: Alert weather:: warning
    description: Task should trigger Warning when temperature raises about 80 

    # 'task_script' defines the name of the file of the tick script to be loaded
    # when running the test
    task_script: alert_weather.tick

    db: weather
    rp: default 

     # 'data' is an array of data in the line protocol
    data:
      - weather,location=us-midwest temperature=75
      - weather,location=us-midwest temperature=82

    # Alert that should be triggered by Kapacitor when test data is running 
    # against the task
    expects: warning


  - name: Alert no. 2
    task_id: alert_weather.tick
    db: weather
    rp: default 
    data:
      - weather,location=us-midwest temperature=80
      - weather,location=us-midwest temperature=82
    expects: warning
</code></pre></div></div>

<p>After installing kapacitor-unit with the go tooling (go install github.com/gpestana/kapacitor-unit/kapacitor-unit), provide the test configuration file and kapacitor hosts. Optionally, you can provide a path for the directory where the TICKscripts are. If this path is not provided, kapacitor-unit assumes that the TICKscripts are loaded and enabled already.</p>

<p>To run the tests:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kapacitor-unit -kapacitor http://localhost:9092 -dir ../tickscripts -tests tests_conf.yaml
</code></pre></div></div>

<p>A good practice is to run a disposable Kapacitor for running the taks and load the test data. This can be easily done with docker, so a ready-to-use Docker configurations is also part of the project.</p>

<h3 id="wrapping-up">Wrapping up</h3>

<p>For now, these are the main ideas behind the kapacitor-unit. The main goal of kapacitor-unit is to make it easy and automated to test TICKscripts. To check how kapacitor-unit development is going, check <a href="https://github.com/gpestana/kapacitor-unit">github.com/gpestana/kapacitor-unit</a>.</p>]]></content><author><name></name></author><category term="code" /><category term="kapacitor-unit" /><summary type="html"><![CDATA[This post discusses ideas for a proof of concept for a unit test framework for Kapacitor’s TICKscripts and alerts. If you are not familiar with Kapacitor and the TICK script I really suggest you to go ahead and check InfluxData’s website and learn more about it! In short, the TICK stack is a time series data platform that allows you to easily store, analyse and act on time series data at scale.]]></summary></entry><entry><title type="html">Notes on AWS ECS configuration and secret management</title><link href="https://gpestana.com/posts/aws-secrets-management" rel="alternate" type="text/html" title="Notes on AWS ECS configuration and secret management" /><published>2017-02-01T12:04:14+00:00</published><updated>2017-02-01T12:04:14+00:00</updated><id>https://gpestana.com/posts/aws-secrets-management</id><content type="html" xml:base="https://gpestana.com/posts/aws-secrets-management"><![CDATA[<p>Best practices for managing secrets and configurations in ECS containers:</p>

<p><strong>Requirements:</strong></p>

<ul>
  <li>configurations and secrets stored in paramter store and/or S3 bucket;</li>
  <li>encrypt secrets;</li>
  <li>do not push configurations to git/version control system;</li>
  <li>transparent to apps (e.g. it should be completely transparent for backend; it should not have code for pulling configurations/secrets from anywhere) this follows the 12 factor app style (https://12factor.net/);</li>
  <li>automatic reloads new configurations when these change upstream;</li>
</ul>

<p><a href="https://github.com/gpestana/envaws"><code class="language-plaintext highlighter-rouge">envaws</code></a> created by me and presented at the Nordics AWS conf. IMO, the best way to approach the problem: it completely makes the handling of configurations and secrets transparent to the application. In the Dockerfile, by running: CMD envaws yarn start, the envaws will fetch the configurations from AWS parameterstore and/or S3 and populate the given command process with the configurations as env variables. As a bonus, we get also a polling mechanism out of the box: if the configurations change upstream, the docker container is rebooted and fetches the new configurations.</p>

<p><a href="https://github.com/segmentio/chamber"><code class="language-plaintext highlighter-rouge">chamber</code></a> similar to envaws, but without the poller (so it does not automatically reload if configurations change); Needs more configuration; It is an overkill if we consider the requirements above, since it has a lot more functionality.</p>

<p><code class="language-plaintext highlighter-rouge">fetch configurations at start in container</code>: this option is not compliant with the ‘transparent for application’ requirement. in this case, the ECS task would have to run aws commands to fetch the configurations from AWS parameter store.</p>]]></content><author><name></name></author><category term="best-practices" /><category term="devops" /><category term="AWS" /><summary type="html"><![CDATA[Best practices for managing secrets and configurations in ECS containers:]]></summary></entry><entry><title type="html">Managing credentials in production</title><link href="https://gpestana.com/posts/managing-creds-production" rel="alternate" type="text/html" title="Managing credentials in production" /><published>2017-02-01T12:04:14+00:00</published><updated>2017-02-01T12:04:14+00:00</updated><id>https://gpestana.com/posts/managing-creds-production</id><content type="html" xml:base="https://gpestana.com/posts/managing-creds-production"><![CDATA[<p>Every software must deal and manage credentials at some point. I will define credentials in the context of this article as secrets that must be protected at all costs, under risk of seriously compromising the security of production systems. There are several points to have in mind when managing credentials of productions systems:</p>

<p><strong>Credentials storage should be kept secret by encryption and a strong access management</strong>. Credentials must never be transported but stored. Never send credentials over email or any other means. Store the credentials and protect them with a strong and auditable access management. Any person or system who wants to access credentials must know where and how to get the credentials from and prove its identity.</p>

<p><strong>Credentials database must be regularly backed up and easily restored</strong>. For obvious reasons. The backup must be explicitly and automatically updated when there is credential revocation.</p>

<p><strong>Credentials revocation should be fast</strong>. This is important to swiftly respond when credentials are compromised.</p>

<p><strong>Credentials must have a single purpose and protect a limited domain</strong>. This means that you should not use the same credential to protect different systems or domains, decreasing the danger when a credential is compromised. It is better to have multiple credentials for different domains and have an easy system to manage credentials than using few master credentials. Putting all eggs in one basket is too risky when it comes to credentials.</p>

<p><strong>Credentials must never, ever, be stored on a general purpose version control systems (VCS)</strong>. Even if the VCS is private, it is hard to ensure that in the long run the current and old credentials are not accessible by people who should not. Some forget that ultimately, the VCS never forget and it’s easily searchable. It is obvious that you should be extra careful with pushing credentials upstream to public repositories, but still we witness a bunch of credentials being compromised everyday in GitHub.</p>

<h3 id="in-practice">In practice</h3>
<p>Although it may seem complex to setup a credential management system which respects all the principles mentioned above, there are open source projects which will make our life easier. <a href="https://www.consul.io/">Consul</a> and <a href="https://www.vaultproject.io/">Vault</a> by Hashicorp can be easily deployed as part of a credential management system which respects all the principles mentioned. In another post we’ll see how store and manage production credentials in a secure and usable way.</p>

<p><a href="https://news.ycombinator.com/item?id=15109637">Comments and discussion</a></p>]]></content><author><name></name></author><category term="devops" /><category term="best-practices" /><summary type="html"><![CDATA[Every software must deal and manage credentials at some point. I will define credentials in the context of this article as secrets that must be protected at all costs, under risk of seriously compromising the security of production systems. There are several points to have in mind when managing credentials of productions systems:]]></summary></entry><entry><title type="html">Don’t trust the data</title><link href="https://gpestana.com/posts/dont-trust-the-data" rel="alternate" type="text/html" title="Don’t trust the data" /><published>2017-01-01T12:04:14+00:00</published><updated>2017-01-01T12:04:14+00:00</updated><id>https://gpestana.com/posts/dont-trust-the-data</id><content type="html" xml:base="https://gpestana.com/posts/dont-trust-the-data"><![CDATA[<blockquote>
  <p>This post is part of the series “The Zen of Data Pipelines” which explores how to build scalable and robust data systems. Most of the ideas and best practices described in this series were learned while implementing and maintaining a large scale data pipeline at
<a href="https://www.f-secure.com/en">F-Secure</a> for the Rapid Detection Service. You can find more posts of this series in this blog or all series content on <a href="https://app.gitbook.com/o/pRmOAeaSI6yinudB5HeK/s/-Le1AERfaHFo3s3yrjVJ/">Gitbook</a>.</p>
</blockquote>

<p>Data is messy. No matter how reliable the data sources are, your system can never trust its input. The system must gracefully handle input which does not comply with the specs or is corrupted. Statistically, a data pipeline that handles large amount of data has more probability of getting wrong or corrupted input. If the system does not handle those cases gracefully, services will break, data processing halt or significantly reduce performance. Even worse, data processing may work just fine but produce wrong results without providing any visibility of the problem.</p>

<p>There are some strategies to handle corrupted or unexpected data. First and foremost, sanitize the input data at the beginning of the pipeline before the data processing starts. This step is essential since external data sources may push corrupted data. Another strategy is to wrap all the data input in a well defined payload. Defining a common format for every data unit processed by the pipeline ensures that all services know what to expect: it works as a contract between services. Sanitizing and wrapping the input on a well defined data format standardizes how the data looks like and defines a contract between all services, regardless of the data source or data type. The goal with this pre-processing step is to make sure the data to process is ‘clean’ and obeys a contract which all services understand.</p>

<p>Pre-processing can be divided into two stages: the pre-processing of raw data coming from external data sources and the pre-processing in each service of the pipeline. While the raw pre-processing aims at making sure that input data is not corrupted and its format respects a well defined format, the goal of the pre-processing in each service is to prevent misbehaving services from introducing unexpected data payload.</p>

<p>Another important strategy is to define (and document) what data transformations are performed by every service: which data fields may be modified, added or removed. Having clear contracts for each service helps to understand what input each service is expecting and what is the format of its output, what data transformations each service performs and so on. Conceptually, each service is a building block from which data flows to and from. To have a well defined and documented contract for each service goes a long way to make sure data is piped smoothly between all building blocks of the system.</p>

<p>Be sure to create common libraries shared by services that handle the service pre-processing logic. Those libraries should handle errors (e.g. corrupted data, missing data, etc…) in an uniform way. Preferably, error logs and service metrics should be pushed upstream. That data should be used to trigger alerts when critical errors happen during the data parsing and sanitizing.</p>

<p>In case of critical pre-processing errors, the data units that cause the error must be dropped from the processing pipeline. That data should be stored on a dedicated data store for corrupted data for further inspection and recovery. It’s important to have the tooling to inspect and recover the corrupted data in place. Bugs introduced into services or sudden misbehaving of data sources may generate huge amounts of corrupted data quickly. Being able to promptly inspect and debug why the data is corrupted during the pre-processing stages is a great place to be when maintaining large data pipelines. The tooling for recovering corrupted data can be more complex. It should read data from the corrupted data buffer, make the necessary transformations for turning it into valid data and push it to the correct buffer or service in the pipeline. Although recovering corrupted data can be complex, in some contexts data just can’t be lost. In those cases, having automated tooling will save you in mayday situations when tons of data are being discarded by the system for being considered corrupted.</p>

<p><br />
<strong>Takeaway</strong>: Don’t trust the input data. Inspect and sanitize the input before processing it. Wrap the input data in a higher data format. Implement logic that handles gracefully unexpected data payload in every processing service, even if the data has been sanitized and verified before. Have a mechanism in place to store data with corrupted payload and the tooling to recover it. Data format errors should be visible and unified across all services.</p>]]></content><author><name></name></author><category term="data-pipeline" /><category term="microservices" /><category term="best-practices" /><summary type="html"><![CDATA[This post is part of the series “The Zen of Data Pipelines” which explores how to build scalable and robust data systems. Most of the ideas and best practices described in this series were learned while implementing and maintaining a large scale data pipeline at F-Secure for the Rapid Detection Service. You can find more posts of this series in this blog or all series content on Gitbook.]]></summary></entry></feed>