Freitag, 14. Februar 2014

Restarting firefox

Ever wondered how to restart firefox? Not just closing it, and then starting it again, but have it restart with all the open tabs open again? I just found this and decided to write it down for my futur reference:

https://developer.mozilla.org/en-US/docs/Tools/GCLI

Shift + F2 opens the developer console, where you can type "restart".

Dienstag, 7. Januar 2014

Cool things with /dev/tcp

I just recently learned about /dev/tcp, which is a feature of bash. It lets you do network communication in bash. I wanted to ssh directly into a server which was not directly accessible, but just via a gateway server. ssh_config (or $HOME/.ssh/config) has a parameter ProxyCommand, which lets you do exactly this. My problem was that the gateway did not have nc (netcat) installed, and since it was a production server under change control, I could not just install it. I found SSH ProxyCommand without netcat, which solved my problem. It boils down to using

ProxyCommand ssh {gw} 'exec 3<>/dev/tcp/{host}/22; cat <&3 & cat >&3;kill $!'

as a proxy command ({gw} should be replaced with the gateway host, and {host} with the host you want to log in to). Needless to say that placing your ssh-key on the gateway and host makes life a lot easier.

Anyway, I did not know the feature and found the explanation a bit meager, so I googled further, and found
More on Using Bash's Built-in /dev/tcp File (TCP/IP) and
Network Programming with bash.
Both are a quick read and helped me understand /dev/tcp. So there is a lot more you can do with /dev/tcp then just ssh multi hopping. For example, you could also use it as a port scanner or reverse shell, if you happen to need one and can not just install the specilized programm: /dev/tcp as a weapon.




Donnerstag, 15. August 2013

nagios check script for rabbitmq cluster

As part of an openstack monitoring solution, I set up a few nagios checks for rabbitmq. Most of what I wanted is allready covered by nagios-plugins-rabbitmq by James Casey. Additionally I wanted to check the cluster status of my rabbitmq cluster, so I modified one of his scripts: If you find this usefull or or have suggestions, please let me know via comments.

Mittwoch, 14. August 2013

Restricted characters on NTFS bugging resync

When reviewing the log of my rsync backup script (which does backup to a cifs mounted NTFS network drive) I found strange error messages ("No such file or directory (2)", "Invalid argument (22)"). It turns out that there are restricted characters on NTFS formated drives, which I, growing up on linux, did not know.

So, if you happen to stumble on such errors, the only workaround it seems is to avoid theses characters in filenames: "/\*?<>|:
See here for more info on filesystem quirks.

Mittwoch, 3. Juli 2013

Getting back to old device names in Fedora 18 (and probably others)

Updating http://major.io/2011/09/25/getting-back-to-using-eth0-in-fedora-15/, I found that in order to change the boot settings for grub2, it might be desirable to use an existing menue entry and not an extra, custom entry.

To do so, open /etc/grub.d/10_linux (make a backup first) and locate the line with

linux ${rel_dirname}/${basename}

and add

biosdevname=0

at the end of the line. Make a backup of /boot/grub2/grub.cfg, then run  

grub2-mkconfig >/boot/grub2/grub.cfg. 

(Make a backup of that file too, bevor you overwrite it :))You can now check if your new grub.cfg has the parameter biosdevname=0 appended to the kernel line. Now if you reboot, you should have access to traditional device names.

This should help to get traditional device names. The mentioned post does this for fedora 15, and I can confirm that it also works on fedora 18.

Dienstag, 7. Mai 2013

How to create a LVM testbed

Every once in a while I want to review/relearn a certain lvm feature. In order to do no harm, I want to create a testbed for lvm. Since I have done this a few times bevor, I now put all the commands in a little script, so that I don't have to type them again. Please note that this script does not do much checking, so please understand what it does bevor you use it, and use at your own risk :)