May 21, 2013

0 notes

Looking for bad guys. The Perl counterpart

Ehy! I’ve thrown out on github a search&scan perl engine based on regular expression collections. The aim is to implement a passive security scanner against some attacks (webshells, htaccess hacks, etc.) fast enough to go through hundreds of thousands files and my goal is to have such a scanner configurable just pushing into it new regexes while I discover theme on the web, inside webshells code, on our hosting servers (bad stuff guys!).

Really early code, but we are testing massively. Someone could be interested at the little project and should go to https://github.com/pioneerskies/lfbg.pl.

When it will be more stable I’ll migrate the code to weLaika’s github repository.

Cya

Mar 14, 2013

0 notes

Renaming power-up with rename

Just a few posts ago I was talking about a little trick using mv almost useful in scripting.

But you have to keep in mind that rename exists. I’ll talk with examples, just while I’m using it:

pioneerskies@pis-laptop:~/dev/scripts/bunctionsh/helpers (git:master) 
$  ls
chweb  colorize_feedback  git-prompt  lampp  randpass

pioneerskies@pis-laptop:~/dev/scripts/bunctionsh/helpers (git:master) 
$  rename 's/^(.*)$/$1_off/' *
pioneerskies@pis-laptop:~/dev/scripts/bunctionsh/helpers (git: master △ ) 
$  ls
chweb_off  colorize_feedback_off  git-prompt_off  lampp_off  randpass_off

So:

  • 1st arg: a perl regex! FTW! Not only with s(ubstitution) command, but also with p, y, d, like sed; this will do the transformation on selected files
  • 2nd arg: is the selector, like in bash. So .jpg, *, [0-9] are all accepted

So hawt

Mar 5, 2013

0 notes

(MT)(GS)(BK): our definitive (MT) Grid-Service backup solution

We use (MT)(GS) and we find it great for a certain range of our needs. But I love backups, so I’ve searched for a good backup solution for (GS); probably the only serious one is http://gsbackup.org, which I find so damn cool, but does not answer to my needs.

Backup for my devs @welaika and for our clients must have:

  • external location
  • cron friendly…
  • …and so non-interactive
  • a bit secure
  • use as little as possible of the production server’s resources
  • …well…restorable. I mean RESTORABLE!

Ok now sorry if I’m going OT, but I mean RESTORABLE! A compressed tarball with a fucking myriad of files for an amount of 10GB, is not restorable! Ok? Come back to us now.

Remember that I’m a sysadmin, not a dev. So what have I done to do a backup as I like? Well I’ve just managed to compile rdiff-backup on (MT)’s Grid-Service. Voilà!

All our centralized backup system is based on rdiff-backup, so after I installed it on GS, I’ve added them to our backup system and it works like a charm. Woha!

Some complexities

Due to the jungle of symlinks and to the fact that rdiff-backup doesn’t follow them I have tricked a bit to get the right configuration.

Firstly the path

I’ve got the right path doing

$ ssh user@gs-server pwd

that is the one that will work, because is the one absolute path that rdiff-backup will find connecting to the server via SSH.

The include path

If you want to use a globbing file list or --exclude --include options, remember that you’ll have to use the full path to write them

/nfs/cxx/hxx/mnt/122087/domains
/nfs/cxx/hxx/mnt/122087/mydir

How?

I’ve written a stupid script that works. You can clone or just read it from here: https://gist.github.com/pioneerskies/5085751. Basic instruction there…but is just the case of a

bash (BK).sh

Conclusions

Have fun guys. Tell me if in trouble. And if you are interested in the script that we use to manage all the backups wrapping rdiff-backup, let me know; at the moment it works, but the code is awful and expecting a deep refactor, so I’m not going to shout it at the world just now. ;)

Mar 4, 2013

0 notes

recompile with -fPIC lib/mylib.o: could not read symbols: Bad value

I’m a sysadmin but I’m not a compiling expert at all. I faced up the error as reported in the title of this article and I felt confused; when the magic of compiling source code does not work it’s like the nyancat starts floating in your head. I know that feel bros.

So I’m just here to share a good as the hell howto from the great gentoo community. Go and read it!

Mar 4, 2013

0 notes

Even if [ ! -z “$PS1” ]

Remember: there are a lot of possibilities that in your .bashrc there’s a line at the top similar to this one

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

so if you want to export a goddamn ENV VAR even if in a non-interactive shell, put it first of that line.

Navigate
« To the past Page 1 of 4
About
Want to ask something? Let's try
Subscribe via RSS.