Debian on Barracuda NG F10 Firewall

Hi

While I was tearing down the firewall the CF-Slot jumped right into my eyes. Every Linux guy might think the same. 🙂

So i debootstraped a CF-card made it bootable and right after the first try, bam, working.
The Hardware got freed from the propritary Linux OS and crappy tools and … Yes the backdoors, bugs and security holes, because you won’t get any free downloadable firmware updates. This is really annoying on Barracuda firewalls. It’s a shitty firewall. Every crappy TP-Link does the same things in production.

Have fun!

Monitor the RAID Status Avago LSI Logic SAS3008 Fusion-MPT SAS-3 with Linux

Hi

Need to monitor the RAID Status of your Avago LSI Logic / Symbios Logic SAS3008 PCI-Express Fusion-MPT SAS-3 under Linux with perl?

Yes Avago has a crappy website. When you search the website for SAS3008 you only find some pdf. But not the utility to query your raid controller. Crappy website or intentionally. Who knows 🙂

Below is a script which send’s a simple mail if something goes bad to your RAID. Just put it in your crontab. Might someone want’s to adopt it. Might use with Nagios/Icinga. Actually I’ve not the case to do this. Might later…

#!/usr/bin/perl

use warnings;
use MIME::Lite;

$emailFrom = 'root@server.domain.tld';
$emailTo = 'hostmaster@yourdomain.tpl';
$smartHost = 'smarthost.mail.local';
$hostName = 'server.domain.tld';
$pathSas3ircu = '/root/bin/SAS3IRCU_P12/sas3ircu_linux_x64_rel/sas3ircu';

if (check_status() == 1) {
  $body = join("", get_info("0","STATUS"));
  send_email($emailTo,$body);
}

sub check_status {
  $error = 0;

  foreach $line (get_info("0","DISPLAY")) {
    if ($line =~ /Status of volume/) {
      if ($line !~/Okay/) {
        $error = 1;
      }
    }
    if ($line =~ /State/) {
      if ($line !~ /Optimal/ ) {
        $error = 1;
      }
    }
  }
  return $error;
}

sub get_info {
  $arg1 = shift;
  $arg2 = shift;

  $cmd = "$pathSas3ircu $arg1 $arg2";
  @output = `$cmd`;
  return @output;
}

sub send_email {
  $arg1 = shift;
  $arg2 = shift;
  
  $subject = "Warning RAID inconsitent $hostName";

  $msg = MIME::Lite->new(
    From     => $emailFrom,
    To       => $arg1,
    Subject  => $subject,
    Data     => $arg2
  );

  $msg->send('smtp',$smartHost,Debug=>0);
}

Here a download link of the tool:
http://docs.avagotech.com/docs/SAS3IRCU_P12.zip

Here a link of an different controller where you find the download link:
http://www.avagotech.com/products/server-storage/host-bus-adapters/sas-9305-16e#downloads

Have Fun!

Geiger Counter Visualisation

Hi there!

I build a visualisation (php javascript html5 chart.js mysql perl) for my Arduino Geiger Counter. Here some screenshots.

I’m no professional programmer. But it does what it should. Might someone find this useful.
Here the downloadlink.

https://www.paranoids.at/downloads/geiger-f5b7681.tar.gz

Just import the .sql files, connect the arduino via usb, change data formatting if needed and start logGeiger.pl.

Happy plotting 🙂

Ubuntu 16.04 EFI Boot Software Raid

Hi

I tried to setup the “EFI System” partition at install time with software RAID1 array. I tried to avoid installing the bootloader to every disk. (I had an RAID1 with spare)

The ubuntu installer allows to set as partition type “EFI System” on the software RAID array. So I thought it would work.

After successful installation the BIOS of the Supermicro mainboard has not found any EFI-Boot partition.

So I destroyed the software RAID of the “EFI System” and installed the bootloader in chroot from a Debian-Live system. I had not to change the partition flag. It was already setup right to “EFI System”

mdadm -S /dev/mdX
mdadm --zero-superblock /dev/sda1
mdadm --zero-superblock /dev/sdb1
mdadm --zero-superblock /dev/sdc1


mkfs.vfat /dev/sda1
mkfs.vfat /dev/sdb1
mkfs.vfat /dev/sdc1

mount /dev/md[RootFileSystemWithBoot] /mnt
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc

chroot /mnt

Now we remove the RAID array from config file

vim /etc/mdadm.conf

Edit your fstab

blkid /dev/sda1
vim /etc/fstab

And last but not least install grub

mount /dev/sda1 /boot/efi
grub-install /dev/sda1
umount /boot/efi

mount /dev/sdb1 /boot/efi
grub-install /dev/sdb1
umount /boot/efi

mount /dev/sdc1 /boot/efi
grub-install /dev/sdc1

update-grub

Hint: You have to use a install media or live system which is EFI Boot capable and force BIOS to boot from EFI. (You could use my USB Stick). Otherwise EFI support in Linux is disabled.

Have fun!

Arduino Geiger Counter

Hi there,

Need a self build geiger counter? Without complex circurit. Here it is 🙂

Here my Arduino sketch:

#include "DogLcd.h"
#include "Bounce2.h"
#include "RunningAverage.h"

#define calFactor 1.0/5.8

/*
LCD SI pin to digital coupin 7
LCD CLK pin to digital pin 8
LCD RS pin to digital pin 5
LCD CSB pin to digital pin 6
LCD RESET pin is not used +5V
LCD Backlight pin is not used
*/

DogLcd lcd(7, 8, 5, 6);

const byte buttonPin = 3;
const byte displedPin = 9;
const byte buzzerPin = 10;

byte buttonState = 0;
byte lastButtonState = 0;
byte buttonCount = 0;
byte buzzerOff = 0;

volatile unsigned int count = 0;
byte runCount = 0;
unsigned int countPerRun[30];
unsigned int countPerMinute = 0;
unsigned int averageCountPerMinute = 0;
float radiationValue = 0.0;

unsigned long timePrevious = 0;

RunningAverage RunningAverageCountPerMinute(10);

Bounce debouncer = Bounce();

void setup() {
 Serial.begin(9600);
 Serial.println("CPM;AV;uSv/h");
 
 pinMode(buttonPin, INPUT_PULLUP);
 pinMode(displedPin, OUTPUT);
 pinMode(buzzerPin, OUTPUT);

 debouncer.attach(buttonPin);
 debouncer.interval(5);
 
 lcd.begin(DOG_LCD_M162);
 
 attachInterrupt(0, countPulse, RISING);
}

void loop() {
 debouncer.update();
 buttonState = debouncer.read();

 if (buttonState != lastButtonState) {
 if (buttonState == LOW) {
 if(buttonCount < 4) {
 buttonCount++;
 }
 else {
 buttonCount = 1;
 }
 }
 }
 
 lastButtonState = buttonState;
 
 switch (buttonCount) {
 case 4:
 buzzerOff = 0;
 break;
 case 3:
 buzzerOff = 1;
 break;
 case 2:
 digitalWrite(displedPin, LOW);
 break;
 case 1:
 digitalWrite(displedPin, HIGH);
 break;
 }
 
 if (millis()-timePrevious > 2000){
 timePrevious = millis();

 byte i;
 for (i=0; i<30; i++) {
 if (i == runCount) {
 countPerRun[i] = count;
 }
 countPerMinute+=countPerRun[i];
 }

 RunningAverageCountPerMinute.addValue(count);
 averageCountPerMinute = RunningAverageCountPerMinute.getFastAverage();
 
 radiationValue = (float)countPerMinute * (float)calFactor;
 
 lcd.clear(); 
 
 lcd.setCursor(0, 0);
 lcd.print("CPM=");
 lcd.print(countPerMinute);
 
 lcd.setCursor(9,0);
 lcd.print("AV=");
 lcd.print(averageCountPerMinute);
 
 lcd.setCursor(0, 1);
 lcd.print("uSv/h=");
 lcd.print(radiationValue);

 Serial.print(countPerMinute);
 Serial.print(";");
 Serial.print(averageCountPerMinute);
 Serial.print(";");
 Serial.println(radiationValue);
 
 runCount++;
 if(runCount > 29) {
 runCount = 0;
 }
 
 count = 0;
 countPerMinute = 0;
 }
 
}

void countPulse(){
 detachInterrupt(0);
 count++;
 if (buzzerOff == 0) {
 tone(buzzerPin, 2000, 15);
 }
 while(digitalRead(2)==1){
 }
 attachInterrupt(0,countPulse,RISING);
}

The diode I’m using as beta, gamma and x-ray sensor is Teviso RD2014. It is also sensitive to GSM radiation. Nice to find bugging devices. 🙂

Here are some good links I worked with:
http://www.opengeiger.de/index_en.html
http://www.teviso.com/en/products/radiation-sensor-rd2014.htm

Have fun!