RSSAmplifier

Blog

Matheus Bratfisch

matbra.comRSS feed ↗24 posts

Latest posts

Creating terraform to setup cloudflared zero trust and share navidrome to my phone

Hello, In the previous post I did the setup of Navidrome + Cloudflared to listen my home musics, I decided to take one step further and add the setup of cloudflare (zero trust tunnel) for my home server using terraform. I decided to do it using Gemini and see how it would go, how complex it would be, how many mistakes. I’m not deeply familiar with terraform thus I think it made my life slightly…

Spotify like server using navidrome and expose via cloudflared

Hello, Recently after visiting some friends they shared they were doing their home server and that they were using plex and navidrome. I thought it was quite cool, to be able to have my own “Spotify like” server at home. I do have some playlists on m3u and I felt it would be nice to be able to listen to them at home or externally. Considering all the buzz around AI, I decided to play with AI and…

Hackthebox - Write up of Servmon machine

This time, let’s try to get root on Servmon machine from Hackthebox. Standard starting procedure: NMAP. $ nmap -T4 10.10.10.184 Starting Nmap 7.80 ( https://nmap.org ) at 2020-04-29 20:10 EDT Nmap scan report for 10.10.10.184 ( 10.10.10.184 ) Host is up ( 0.22s latency ) . Not shown: 992 closed ports PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 80/tcp open http 135/tcp open msrpc 139/tcp…

Hackthebox - Write up of Nest machine

Hello, As you guys already know I have been studying pentest. Recently I signed up on hackthebox.eu and started doing some easy machines. This writeup will show the steps I have done to get user and root flag. I always start with nmap. $ nmap -T4 -Pn -p- -v 10.10.10.178 Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-01 21:41 EDT Initiating Parallel DNS resolution of 1 host. at 21:41 Completed…

Installing AvaloniaILSpy on Kali Linux

Hello, I have been studying pentest and eventually I had to decompile some VB NET (.NET) and decided to give a try on AvaloniaILSpy. If you ever need to install it on Kali linux 20 you can install its dependencies with: sudo apt-get update sudo apt-get upgrade wget https://packages.microsoft.com/config/ubuntu/19.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i…

Building OpenSSH 8.2 and using FIDO2 U2F on ssh authentication

OpenSSH 8.2 was just released with support for FIDO2 U2F keys. This is a nice extra layer for security! As this is not yet on official repository for Fedora, we will need to build openssh 8.2 if we want to test. OpenSSH 8.2 needs libfido2 and libfido2 needs libcbor systemd-devel. There is no package for FIDO2 on Fedora 31 yet, therefore we also need to build it. Let’s start installing some…

Use a remote serial port to flash an esp

Recently I got back to playing with some ESP8266 as I decided to make my home smarter. Taking a look on my boards I noticed I didn’t have any 3.3V board to flash it. Taking a closer look I found I had a raspberry pi around, so I could simply use it. After doing the setup and being able to flash using the raspberry pi it felt too hard to be programming on it and using vnc or something like this.…

Testing RCE on Alpine Linux via APK

I have been studying a little bit of security and one of the things I’m doing from time to time is reading CVE and trying to test and understand what is happening. Yesterday Max Justicz published Remote Code Execution in Alpine Linux . He found an issues on apk which is the package manager for Alpine Linux which is super popular on docker images. Max did a great job explaining the steps and the…

Find images on chrome cache files (or any other file!)

Good night, Recently I have deleted a few images from my image which the old link was broken on the last few days. I decided to try to find them on the Google Chrome Cache. The url chrome://cache was recently removed, but you can find your chrome cache files at: /home/matheus/.cache/google-chrome/Default/Cache/ . If you open it as binary, you will see it is not a file directly. There is more…

Printer connected to Raspberry PI accessable from network.

Hey guys, For a long time my father has beem complaining that using the printer wasn’t practical enough, so to solve this I decided to add a Raspberry pi Zero W connected to my printer (HP Deskjet F2050) and share the printer using CUPS. Initially you need to connect to your RPi and install CUPS. sudo apt-get install cups If you want to have a webinterface to configure it from your local network,…

Update default git commit author and reset for commit.

If you would like to set your global git author, use: git config --global user.name "Your name" git config --global user.email "email@example.net" After having it set globally, you can to set your git author per project using: git config user.name "Your name" git config user.email "email@example.net" And a bonus, If you need to reset the git commit author: git commit --amend --reset-author If you…

Docker-compose with PHP-FPM, sendmail, nginx, mariadb serving jekyll and wordpress

As I explained recently, I had a blog running Wordpress and decided to move to Jekyll but there was a catch, I didn’t want to loose any link I had to my wordpress blog, to achieve this, I setup an nginx which will try to find a static file from jekyll and if it is not found it will fallback to Wordpress . I was running my server on ec2 instance with RDS and it was becoming a little bit expensive,…

Install ZNC IRC Bouncer on AWS Linux

If you want to install ZNC IRC Bouncer you will need CMake, but AWS Linux CMake is too old. (Update your cmake to 3.x)[http://www.matbra.com/2017/12/07/install-cmake-on-aws-linux.html] Now you will need git to clone the ZNC source code and openssl-devel to have ssl support # yum install git openssl-devel Clone ZNC source code $ git clone https://github.com/znc/znc.git Enter on the source code…

Install Cmake 3 on AWS Linux

If you are trying to build something using CMake and is getting the error: “CMake 3.1 or higher is required. You are running version 2.8.12.2” You can manually install this CMake version, to do this, I removed the previous CMake. # yum remove cmake Tested if it was really removed $ cmake -bash: /usr/bin/cmake: No such file or directory Install G++ # yum install gcc-c++ Download latest version…

Loopback model migration using postgresql database

I have been playing with Loopback , initially I was just declaring models and use in memory, but now I got to a point where I need to have a persistent database. I couldn’t find how to keep my database synced with my models easily. I’m not sure if I’m not that familiar with Loopback yet, or if their documentation is not clear enough. To create a script to sync your models with your database you…

Django Storages with Boto3 and additional Metadata only for Media

I have a personal project which I’m using python with Django and django-storages to upload my static and media files to Amazon S3, because my media files have UUID and they’re not editable on my system I wanted to have a long expiration time on it, so I could save some bandwidth but I didn’t want this on the static files which are updated more regularly when I’m updating the system. Most of…

Nginx redirect on failure

As a few of you probably noticed, recently I have decided to update my really old wordpress blog from PHP4~5 to a most recent one . Leaving a shared host and going to heroku, which later became Amazon EC2. I had to decide if I would keep Wordpress, or change to a different technology as Jekyll? Or what? I have thought a lot about this and in the end I decided to use Jekyll to be honest, why?…

Build Jekyll as production after push

If you want to build your Jekyll blog on your own server after a git push you can use git hooks. To do it, you can extend the Deploy after git push and add this tree lines (after rm -rf ), to install dependencies and to build it as production environment. cd $LIVE_PATH bundle install JEKYLL_ENV = production jekyll build Matheus

Force www on Jekyll website using Javascript

I wanted to force using my jekyll website to have the “www” prefix and because my Jekyll doesn’t have a back-end I couldn’t do it on the server, so I needed to use Javascript or Meta tags. A few people says Google Search engine handles meta refresh as 301/302 so it would be better to go with this approach from a SEO perspective. If you want to force www prefix on your website using javascript, you…

Set env var to PHP-FPM

After installing nginx and php , I wanted to use environment vars inside PHP 7 so I don’t need to save configuration to my repo. Usually when using environment vars the ideal is to set it without having it saved in a file but on this case it was easier to. If you want to add environment variables to your PHP-FPM you can edit /etc/php-fpm.d/www.conf (I’m doing it on Amazon Linux and PHP 7.0) There…

Deploy after push to your own git

I have explained how to push your code to your own git server and after this you may want to execute some especific functions, in my specific case I wanted my code to be builded and to release a new version, so I used post-receive hook from my repo. Oh, it also handle multiple versions keeping the last 3 versions of the release. To do this it uses your DEPLOY_PATH and create a new folder sources…

Pushing to your own remote git

I’m creating a new server as you can notice and I would like to push directly to my git (hosted on my own server), so I could release a new version with a simple git push myserver branch . If you want to achieve this as well you can connect to your remote ssh and execute $ mkdir test.git $ cd git $ git --bare init You will need to know the full path of your git folder to add to as a remote on your…

Install Nginx, PHP on Amazon Linux

I’m migrating my blog and a few other stuff I have running to Amazon infrastructure. I needed an Amazon EC2 instance with PHP support and able to connect to a MySQL. Steps: yum update yum install nginx yum install php70 php70-fpm php70-mysqlnd Edit /etc/nginx/conf.d/virtual.conf server { listen 3000 ; location / { root /var/www/ ; index index.php index.html index.htm ; } location ~ \.php$ { root…

Migrate old Wordpress to Heroku, Amazon RDS and S3.

After a few good years with my blog out of date, I decided to start to write again and to migrate it to Heroku since his server was with a really old stack. I decided to use Heroku, Amazon RDS as Database service and S3 as file storage (for uploaded files) Steps: Disable all Wordpress’ extensions Do a full backup (Wordpress, Database, Uploads, etc) Really, do a backup! Create a git repository Add…