FUN WITH LINUX

Tcpdump: capturing packets with specific tcpflags

3 March 2016

Let’s catpure for example only tcp-packets with syn or ack-flag set:

tcpdump "tcp[tcpflags] & (tcp-syn|tcp-ack) != 0"

Read more..
BTRFS: monitoring raid errors

16 February 2016

Btrfs has it’s builtin tool for displaying IO stats on devices:

root@tardis:# btrfs device stats /mnt/Raid/
[/dev/sdb].write_io_errs 0
[/dev/sdb].read_io_errs 0
[/dev/sdb].flush_io_errs 0
[/dev/sdb].corruption_errs 0
[/dev/sdb].generation_errs 0
[/dev/sdc].write_io_errs 0
[/dev/sdc].read_io_errs 0
[/dev/sdc].flush_io_errs 0
[/dev/sdc].corruption_errs 0
[/dev/sdc].generation_errs 0

A simple cronjob could warn us if anything is wrong:

MAILTO=sysadmin@tardis.tdl
@hourly /sbin/btrfs device stats /mnt/Raid | grep -vE ' 0$'

It’s wisely to scrub the filesystem from time to time. Wikipedia says the following about “Data scrubbing”:

Data scrubbing is an error correction technique that uses a background task to periodically inspect main memory or storage for errors, and then correct detected errors using redundant data in form of different checksums or copies of data. Data scrubbing reduces the likelihood that single correctable errors will accumulate, leading to reduced risks of uncorrectable errors.

If we don’t scrub, it could happen that BTRFS only reads from the good drive without detecting the faulty drive

@monthly /sbin/btrfs scrub start -Bq /mnt/Raid
Read more..
Guacamole: A clientless remote desktop gateway using HTML5

15 February 2016

>

Guacamole is a clientless remote desktop gateway using HTML5. It supports the following backends: VNC, RDP, SSH and Telnet. It really looks like a promising project to me

Read more..
Static arp-cache on dhcp-servers

13 February 2016

We can use static ARP entries on hosts or routers to reduce ARP-traffic or to prevent ARP-spoofing. For such entries we need pairs of MAC-addresses and IP-addresses. The same information we also need for static DHCP-entries on a DHCP-server. Why not combine?

Read more..
Oneliner: Permutation using ruby

11 February 2016

➜ ~ ruby -e 'puts %w[t o m].permutation.map &:join' 
tom
tmo
otm
omt
mto
mot
Read more..
Route to nowhere - Blocking attackers using Nullroutes

4 February 2016

If someone attacks a linux-system, most administrator would block the ip-address of the attacker using iptables-rules. But there is another method to block the address of an attacker: nullroutes. Nullroutes are routes to nowhere

Read more..
Monitoring memcached

4 February 2016

memcachetop is a nice perl-script for displaying live stats from memcached. The author kept portability in mind, so it has not much dependencies and might run on many systems.

Read more..
Using the mouse-wheel to scroll in GNU screen

4 February 2016

For scrolling with the mouse-wheel in GNU screen, the following line is needed in ~/.screenrc:

termcapinfo xterm*|rxvt*|kterm*|Eterm* ti@:te@
Read more..
reptyr - A tool for "re-ptying" programs

3 February 2016

It happens so often that when I start a copy-job remotely, I just realize that I forgot to start it in GNU screen. Sometimes I can just stop the job and start it again in screen, but very often stopping the job might be problematically. There is a nice tool called reptyr which can re-ptying your jobs.

Read more..
Lets Encrypt

30 January 2016

Letsenrypt

Lets Encryptwas lately quite often in the media. Letsencrypt is a very easy to use tool which provides certificates for free. Those certificates are valid on most common browsers. I never understood why certificates are expensive that’s why I tried out letsencrypt(and I like it!).

In this article, I will replace all cacert-certificates on a kolab-server. Therefore I will install the letsencrypt-certificate on: apache2, cyrus-imapd and postfix.

Read more..
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti