David Igou

David Igou


Blog Archive Contact Dale
  • Motion + Raspberry Pi + Kubernetes
  • Kubernetes ingress whitelisting behind a loadbalancer
  • Switching to Ubuntu 64 bit for my Pis
  • Prometheus in Your Home
  • Simple Go Webhook Receiver
  • Kubernetes Local Storage
  • Secure Networking between local hosts and an AWS VPC
  • Nginx metrics via exporter sidecar
  • k3s tweaks
  • Securing a Kubernetes ingress with htpasswd
  • Running a static website on Kubernetes
  • Buildin this site again .. again
  • Openshift on AWS caveats
  • Prometheus
  • Building this site (again)
  • Kubernetes-2
  • Kubernetes
  • Plotting banned hosts
  • Fail2ban
  • Building this site [Legacy]
  • Plotting banned hosts

    I’ve had some extra time this week. I made a quick and dirty way to automatically plot nodes I ban from this site. This has been done before and the code is public, I’ll probably check out those examples next week to compare. I added an extra action to Fail2ban to append each IP to a text file. I have an hourly cronjob generating a new plot and throwing it into html/images/. Part of it calls on this Rscript:

      library("rgeolocate")
      library("stringr")
      library("rworldmap")
    
      ipVector <- strsplit(readLines("banned.txt"), '\n')
      list <- ip_api(ipVector, delay = TRUE)
      newmap <- getMap(resolution = "li")
    
      png(file = 'plot.png', width=992, height=553, res=45)
    
      plot(newmap)
      points(list$longitude, list$latitude, col = "red", pch=10)
      dev.off()
    

    There is room to improve the quality and presentation of these - display settings are normally taken care of by RStudio, via a script it’s all manual. There are other libraries available for plotting world maps out there, but they require a lot more time investment to get working how I want. The generated image:

    <img src=/images/plot.png>

    This nano instance had some issues compiling the dependencies for the libraries I used due to RAM limitations. I worked around this by creating another volume, attached/formatted/mounted as a swap partition, and it worked. AWS is kinda cool.