<?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 Bartłomiej Patrzyk on Medium]]></title>
        <description><![CDATA[Stories by Bartłomiej Patrzyk on Medium]]></description>
        <link>https://medium.com/@bpatrzyk?source=rss-ddec3c875acc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*sRPoZtm4ot8L11d8</url>
            <title>Stories by Bartłomiej Patrzyk on Medium</title>
            <link>https://medium.com/@bpatrzyk?source=rss-ddec3c875acc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 22:14:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bpatrzyk/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[Limiting failed ssh login attempts with fail2ban]]></title>
            <link>https://medium.com/swmansion/limiting-failed-ssh-login-attempts-with-fail2ban-7da15a2313b?source=rss-ddec3c875acc------2</link>
            <guid isPermaLink="false">https://medium.com/p/7da15a2313b</guid>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[fail2ban]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Bartłomiej Patrzyk]]></dc:creator>
            <pubDate>Fri, 22 Mar 2019 10:15:04 GMT</pubDate>
            <atom:updated>2019-03-22T10:15:04.555Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x5i0rSGqldEIRkKEaeYuWA.png" /></figure><p>SSH is quite secure, especially if you take reasonable precautions, such as requiring key pair based authentication. However, there are still a lot of bots out there in the wild that tries to find vulnerable hosts by attempting to log in with common compromised usernames and passwords such as <em>root/root</em> or <em>admin/admin</em>. While it is unlikely they will succeed, they will still consume your bandwidth and generate massive amounts of logs.</p><p>One approach to minimize the number of brute-force login attempts is to change the default port SSH listens on. However, it’s not considered good practice — first of all, one has to remember to set a proper non-default port each time they connect to the server. Moreover, it might create another security vulnerability if the chosen port is greater than 1024. Typically, only root can bind to port numbers lower than 1024. However, if a higher port number is used for SSH, under certain circumstances users with no root access can substitute SSH daemon with another, possibly malicious, service.</p><p>A better way to solve the problem at hand is to use a tool that will block the attacker from accessing SSH server. One of such widely-adopted tools is <strong>fail2ban</strong> (<a href="https://www.fail2ban.org/">https://www.fail2ban.org</a>). By analyzing logs, <em>fail2ban</em> discovers repeated failed authentication attempts and automatically sets firewall rules to drop traffic originating from the offender’s IP address.</p><h3>Installing fail2ban on Ubuntu</h3><h4>Manual installation</h4><p>Installing <em>fail2ban</em> on Ubuntu (and other Debian-based distributions) is straightforward:</p><pre>$ sudo apt install fail2ban</pre><p>That’s it! <em>fail2ban</em> should be up and running with the default configuration, and it should be configured to start automatically on system startup.</p><h4>Installing with Ansible</h4><p>On Debian-based distributions you can install <em>fail2ban</em> with Ansible by adding <em>apt</em> task in the playbook file:</p><pre>tasks:<br>  - name: install fail2ban<br>    apt:<br>      name: fail2ban<br>      state: present<br>      update_cache: yes</pre><h3>Checking if it works</h3><p>You can check if the service is up with the following command:</p><pre>$ sudo systemctl status fail2ban</pre><p>The output should be similar to the following — the service status should be active:</p><pre>fail2ban.service - Fail2Ban Service<br>Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)<br>Active: active (running) since Sun 2019-02-24 10:21:18 UTC; 2h 42min ago</pre><pre>(... omitted for brevity ...)</pre><p>Let’s see how did <em>fail2ban</em> alter <em>iptables</em> rules:</p><pre>$ sudo iptables -L -n -v</pre><p>You should also see that there is a new chain <em>f2b-sshd</em> in <em>iptables</em> config that is referenced in the INPUT chain rule:</p><pre>Chain INPUT (policy ACCEPT 777 packets, 80681 bytes)</pre><pre>pkts bytes target     prot opt in     out     source               destination<br>1250 93157 f2b-sshd   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 22</pre><pre>(... omitted for brevity ...)</pre><pre>Chain f2b-sshd (1 references)<br>pkts bytes target     prot opt in     out     source               destination<br>1223 90505 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0</pre><p><em>fail2ban</em> package contains a tool called <em>fail2ban-client</em>. It allows you to check the status of the service and interact with it (e.g., it lets you manually ban and unban IP addresses, enable and disable jails, etc.)</p><p>Let’s see which jails are active:</p><pre>$ sudo fail2ban-client status</pre><pre>Status<br>|- Number of jail:        1<br>`- Jail list:        sshd</pre><p>There is only a single jail — <em>sshd</em> — which is responsible for monitoring SSH server logs for failed login event and setting firewall rules to block further attempts.</p><p>Now we can check the statistics for <em>sshd</em> jail:</p><pre>$ sudo fail2ban-client status sshd</pre><pre>Status for the jail: sshd<br>|- Filter<br>|  |- Currently failed:        0<br>|  |- Total failed:        0<br>|  `- File list:        /var/log/auth.log<br>`- Actions<br>|- Currently banned:        0<br>|- Total banned:        0<br>`- Banned IP list:</pre><p>As we can see, there were no failed logins so far. Now let’s try to log in several times with incorrect credentials. The jail status is now as follows:</p><pre>Status for the jail: sshd<br>|- Filter<br>|  |- Currently failed:        0<br>|  |- Total failed:        5<br>|  `- File list:        /var/log/auth.log<br>`- Actions<br>|- Currently banned:        1<br>|- Total banned:        1<br>`- Banned IP list:        192.168.33.1</pre><p><em>192.168.33.1</em> IP address is banned from accessing SSH server. <em>fail2ban</em> does this by adding an entry in <em>f2b-sshd</em> iptables chain:</p><pre>Chain f2b-sshd (1 references)<br>pkts bytes target     prot opt in     out     source               destination<br>12   696 REJECT     all  --  *      *       192.168.33.1         0.0.0.0/0            reject-with icmp-port-unreachable<br>1279 97855 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0</pre><h3>Configuring fail2ban</h3><p>The default configuration should be sufficient in most cases. However, it’s good to understand what the defaults are and how you can adjust them to your needs.</p><p>With the standard configuration <em>fail2ban</em> will protect SSH server and will block the malicious party for 10 minutes after 5 failed login attempts within 10 minutes timeframe. The default config file can be found at <em>/etc/fail2ban/jail.conf</em>. The file is well documented and mostly self-explanatory. Keep in mind that you should not make any changes to that file as it might be overwritten during <em>fail2ban</em> upgrade.</p><p>In case you need to adjust the configuration, create <em>/etc/fail2ban/jail.local</em> config file with the desired changes. It is advised not to add default values to that file, but only the values you want to customize.</p><p>For example, if you want to change the default ban duration (<em>bantime</em>) and the number of failed attempts (<em>maxretry</em>) you should add the following config to <em>/etc/fail2ban/jail.local</em>:</p><pre>[sshd]<br>#Set ban time to 5 minutes<br>bantime = 300<br>#Decrease the number of failed login attempts before banning to 3<br>maxretry=3</pre><p>After changing the configuration remember to restart the service:</p><pre>$ sudo systemctl restart fail2ban</pre><p>For more config options see comments in <em>/etc/fail2ban/jail.conf</em> or read the manual (<em>man jail.conf</em>).</p><h4>Using fail2ban with ufw</h4><p><em>ufw</em> (Uncomplicated Firewall) is another tool for managing firewall that has recently became a standard across different Linux distributions. With the default configuration <em>fail2ban</em> uses <em>iptables</em> to block traffic; however, it is also possible to configure <em>fail2ban</em> to use <em>ufw</em> to manage rules.</p><p>It requires adding <em>banaction=ufw</em> entry in <em>/etc/fail2ban/jail.local</em> config file.</p><p>It can be set either globally (for all jails) in the <em>DEFAULT</em> section:</p><pre>[DEFAULT]<br>banaction=ufw</pre><p>Or for a specific jail:</p><pre>[sshd]<br>banaction=ufw</pre><h4>Configuration with Ansible</h4><p>The simplest way to configure <em>fail2ban</em> with <em>Ansible</em> is to upload jail configuration file (<em>jail.local</em>) using the <em>template</em> task:</p><pre>- name: upload fail2ban configuration<br>  template:<br>    src: jail.local<br>    dest: /etc/fail2ban/jail.local</pre><pre>- name: restart fail2ban<br>  service:<br>    name: fail2ban<br>   state: restarted</pre><p>Service restart is required for the changes to take effect.</p><h3>Conclusion</h3><p><em>Fail2ban</em> is a reasonable countermeasure against brute-force attacks targeting SSH (as well as other services that are out of the scope of this tutorial). It is easy to install, and in most cases, it doesn’t require additional configuration. We highly recommend to use it on all Internet-facing servers.</p><p><em>(Background vector created by freepik — </em><a href="http://www.freepik.com/"><em>www.freepik.com</em></a><em>)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7da15a2313b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swmansion/limiting-failed-ssh-login-attempts-with-fail2ban-7da15a2313b">Limiting failed ssh login attempts with fail2ban</a> was originally published in <a href="https://medium.com/swmansion">Software Mansion</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wprowadzenie do Expo i React Native]]></title>
            <link>https://medium.com/swmansion/wprowadzenie-do-expo-i-react-native-fe1551aba0a6?source=rss-ddec3c875acc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe1551aba0a6</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[expo]]></category>
            <dc:creator><![CDATA[Bartłomiej Patrzyk]]></dc:creator>
            <pubDate>Thu, 07 Mar 2019 08:40:28 GMT</pubDate>
            <atom:updated>2019-03-07T08:40:28.943Z</atom:updated>
            <content:encoded><![CDATA[<p>Rozpoczęcie przygody z nowymi językami programowania czy narzędziami zawsze jest trudne. Dlatego też chcemy ułatwić Ci postawienie pierwszych kroków w tworzeniu aplikacji mobilnych w Expo i React Native. W tym artykule zaprezentujemy narzędzia udostępniane przez Expo i pokażemy Ci jak uruchomić Twoją pierwszą aplikację.</p><p>React Native (<a href="https://facebook.github.io/react-native/">https://facebook.github.io/react-native/</a>) jest framework’iem pozwalającym na tworzenie natywnych aplikacji na platformy Android i iOS w języku JavaScript, z wykorzystaniem framework’a React (<a href="https://reactjs.org/">https://reactjs.org</a>). Dzięki niemu nie trzeba tworzyć dwóch osobnych aplikacji — jednej na platformę Android (w językach Java lub Kotlin), a drugiej na platformę iOS (w językach Objective-C lub Swift).</p><p>Expo (<a href="https://expo.io/">https://expo.io/</a>) jest zestawem narzędzi, który ułatwia pracę z React Native i sprawia, że tworzenie aplikacji natywnych jest jeszcze prostsze. Najważniejszym komponentem Expo jest Expo SDK — zestaw bibliotek pozwalających na wykorzystanie wielu zaawansowanych funkcji telefonu, takich jak aparat fotograficzny, GPS, akcelerometr, jak również pozwalających na rozszerzenie aplikacji o funkcjonalności związane z logowaniem przez portale społecznościowe, czy też z wysyłaniem i odbieraniem powiadomień PUSH.</p><p>Ponadto, Expo zawiera także narzędzia pozwalające na tworzenie i uruchamianie aplikacji. Expo Snack jest środowiskiem programistycznym działającym w przeglądarce internetowej, w którym oprócz pisania kodu aplikacji można ją także uruchomić na wirtualnym urządzeniu. Jest to bardzo wygodne narzędzie do nauki i prototypowania. Expo Client z kolei jest aplikacją, która po zainstalowaniu na telefonie pozwala w prosty sposób uruchomić aplikację stworzoną przy użyciu Expo na swoim urządzeniu. Ekosystem narzędzi Expo dopełnia Expo CLI, czyli zestaw narzędzi linii poleceń umożliwiający pracę nad większymi aplikacjami i ich publikację w sklepach.</p><h3>Pierwsze kroki z Expo Snack</h3><p>Expo Snack jest dostępny pod adresem <a href="https://snack.expo.io/">https://snack.expo.io/</a>. Zaraz po otwarciu, Snack będzie wyglądał w następujący sposób:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*csR8p1IHXIdgDl3X3QaGZw.png" /><figcaption>Główny ekran Expo Snack</figcaption></figure><p>W górnej części ekranu znajduje się pasek narzędzi umożliwiający uruchomienie aplikacji, eksport kodu oraz zapis. W jego lewej części wyświetli się losowo wygenerowana nazwa projektu (w tym przypadku jest to <em>surprised salsa</em>), którą oczywiście można zmienić. W lewej części okna znajduje się przeglądarka plików, na środku edytor kodu, a po prawej stronie okienko emulatora, na którym można uruchomić aplikację.</p><h4>Rejestracja konta Expo</h4><p>Ze Snack’a można korzystać nie posiadając konta Expo, jednak dla zarejestrowanych użytkowników dostępne są dodatkowe możliwości, dlatego zalecamy utworzenie darmowego konta. Aby to zrobić należy przejść pod adres <a href="https://expo.io/signup">https://expo.io/signup</a> i wypełnić swoje dane. Następnie przy użyciu utworzonego konta należy zalogować się w Snack’u poprzez kliknięcie w czarny avatar.</p><h4>Uruchamianie aplikacji na emulatorze</h4><p>Aby uruchomić aplikację na dostępnym w Expo Snack emulatorze, należy wybrać platformę — Android lub iOS — za pomocą przełącznika widocznego nad okienkiem emulatora. Aplikację można uruchomić naciskając przycisk <em>Tap to play</em>.</p><p>Może się zdarzyć, że wszystkie urządzenia udostępniane przez Expo będą zajęte i konieczne będzie odczekanie w kolejce.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*8sGjLuaIHdMwz_0gps5Ovw.png" /><figcaption>Ekran oczekiwania na uruchomienie aplikacji</figcaption></figure><p>Gdy emulator będzie dostępny, nasza aplikacja uruchomi się automatycznie.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*5QJN2hq19wnmMXwPoXr-GQ.png" /><figcaption>Podgląd aplikacji uruchomionej w emulatorze</figcaption></figure><p>Zmiany wprowadzane w kodzie aplikacji będą automatycznie odzwierciedlane w podglądzie na urządzeniu. Spróbujmy zamienić tekst</p><pre>Change code in the editor and watch it change on your phone! Save to get a shareable url.</pre><p>na</p><pre>Moja pierwsza aplikacja w Expo</pre><p>Zmiana natychmiast będzie widoczna w podglądzie:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*aUIqkYRHTwjRapSkyL7yTA.png" /><figcaption>Widok aplikacji po zmianach dokonanych w kodzie</figcaption></figure><h3>Expo Client</h3><p>Expo Client jest aplikacją dostępną w sklepach Play Store i AppStore, która po zainstalowaniu na telefonie umożliwia uruchamianie aplikacji tworzonych w Expo Snack. Linki do aplikacji w sklepach można znaleźć pod tym adresem: <a href="https://expo.io/tools#client">https://expo.io/tools#client</a></p><p>Po uruchomieniu aplikacji należy zalogować się utworzonym wcześniej kontem Expo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*JkgTWBzMsijxfR91Rr5Y-A.jpeg" /><figcaption>Ekran logowania Expo Client</figcaption></figure><p>Po zalogowaniu, na ekranie “Projects” widoczna będzie lista ostatnich projektów, które edytowane były w Expo Snack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*YPr3-FUt-w2FgiH-KKGTBg.jpeg" /><figcaption>Lista ostatnich projektów w Expo Client</figcaption></figure><p>Po kliknięciu w projekt zostanie wyświetlone menu umożliwiające odświeżenie aplikacji oraz powrót do głównego menu. Aby wrócić do ekranu wyboru projektów, na iPhonie potrząśnij urządzeniem i wybierz <em>Go to Expo Home.</em> Na Androidzie naciśnij przycisk powrotu, lub z menu wyboru ostatnio używanych aplikacji wybierz Expo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*9nF1KkASgQzajuEIRlD67g.jpeg" /><figcaption>Menu aplikacji w Expo Client</figcaption></figure><p>Po zamknięciu menu przyciskiem “Got it” wyświetlona zostanie aplikacja stworzona w Snack. Będzie się ona przeładowywać za każdym razem gdy zostaną wprowadzone zmiany w kodzie.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*5EoVvgOxVR9Qckp8EgWDrQ.jpeg" /></figure><p>Gdyby zaszła potrzeba pełnego odświeżenia projektu, na iPhonie potrząśnij urządzeniem i wybierz <em>Refresh</em>, a na Androidzie kliknij ikonę odświeżenia ⟲ na trwałym powiadomieniu z logiem Expo.</p><h3>Dalsze kroki</h3><p>Stwórz coś wspaniałego! Poeksperymentuj ze środowiskiem Expo Snack, dodaj nowe komponenty do swojej aplikacji, spróbuj dodać style, tak aby wyglądała jeszcze ładniej.</p><p>Jeśli potrzebujesz pomocy, zaglądnij do dokumentacji Expo (<a href="https://docs.expo.io/versions/latest/">https://docs.expo.io/versions/latest/</a>) oraz React Native (<a href="https://facebook.github.io/react-native/docs/getting-started.html">https://facebook.github.io/react-native/docs/getting-started.html</a>).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe1551aba0a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swmansion/wprowadzenie-do-expo-i-react-native-fe1551aba0a6">Wprowadzenie do Expo i React Native</a> was originally published in <a href="https://medium.com/swmansion">Software Mansion</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>