Gradew

Author Archive

Linux hard reboot

by Gradew on Mar.22, 2010, under System

Here’s a rather brutal tip that can come in handy when you administer remote servers: should you discover a process that’s gone to a D+ state – Uninterruptible Sleep – because of a blocking I/O call, how would you go about instructing the server to reboot without having to wait for all processes to terminate, since we all know that’s never gonna happen ? Even a kill -9 won’t terminate the bugger, so here’s how to bash the server’s brains for good:

echo 1 > /proc/sys/kernel/sysrq

echo b > /proc/sysrq-trigger

Needless to say you have to think twice before applying this rude trick, since it’s pretty much like yanking out the power cable (without the stress on the electronic parts). You may lose data by doing this, so make sure you’ve shut down as many daemons as possible, especially those which access block devices or sockets and files.

4 Comments :, , , more...

Incremental backups using GNU tar

by Gradew on Dec.02, 2009, under System

Need incremental backups? tar is just what you need in most cases.

Full backup of /etc: tar –create –file=full.tar –listed-incremental=snapshot.dat /etc
Incremental backup: tar –create –file=incr-01.tar –listed-incremental=snapshot.dat /etc

Here’s how it works: the option “–listed-incremental” will kindly ask tar to create a snapshot file containing all the modifications made to the files since the last backup. If the snapshot file does not exist, tar creates it and performs a full backup. Otherwise, tar will perform an incremental backup and update the snapshot file.

1 Comment more...

OpenSSL file encryption 101

by Gradew on Jun.28, 2009, under Misc


Crypting/decrypting a file can be done easily with OpenSSL.

First, you need to generate an RSA key pair; the public key will be used for encryption and the private one will be used to decrypt.

- Generate the keypair (2048 will be the size used in this example):
openssl genrsa -out private.key 2048
openssl rsa -pubout -in private.key -out public.key

- Encrypt the file (test.txt):
openssl rsautl -encrypt -inkey public.key -pubin -in test.txt -out test.encrypted

- Decrypt the file:
openssl rsautl -decrypt -inkey private.key -in test.encrypted -out test.decrypted

Notes:

  • the size of the encrypted file will grow by a few bytes; an RSA buffer has a size of (S/8), where S is the bit size of the key. The size of an encrypted file will therefore be aligned on buffers of (S/8) bytes (e.g. 256 bytes for a 2048-bit key)
  • given the pseudorandom nature of encrypted contents, an encrypted file cannot be compressed. If you wish to compress the file, do it before you encrypt it.
Leave a Comment :, more...

Multicast with C and Perl on Linux

by Gradew on Apr.25, 2009, under Development, Networking

Here are sample C and Perl server and clients that send multicast messages and subscribe to MC groups. The interface IP used to send/received multicast data is configurable in the source itself; this is to show that we can use something else than eth0 by default.

Multicast: 225.0.0.2:1100
Client: 10.8.0.1
Server:  10.8.0.19

Note: The C server also send acknowledgement messages upon reception of a packet.

Download sources

Leave a Comment : more...

Quick’n'dirty LDAP integration

by Gradew on Apr.22, 2009, under System


LDAP integration is generally easily done. There is however a configuration step that is often left aside on forums or tutorials.Here’s what should be done:

  1. Add “ldap” to /etc/nsswitch.conf in the passwd, shadow and group sections
  2. Configure /etc/ldap.conf to match your LDAP configuration; it mainly consists of IP and root DN(dc=thingy,dc=com)
  3. (often-forgotten-step right here): you need to add the following line to /etc/pam.d/system-auth so that users may authenticate against the LDAP directory:

auth sufficient /lib/security/$ISA/pam_ldap.so use_first_pass

Leave a Comment :, more...

Aurele

by Gradew on Oct.27, 2008, under System

Le besoin crée l’outil…

Surveiller les syslogs de serveurs à partir de postes client Windows armés de PuTTY, c’est bien. Avoir un client Windows permettant d’aggréger tous ces syslogs en une seule fenêtre, c’est encore mieux.

Voici donc un outil de ma création, Aurele, sous licence GPLv3 (et en anglais pour l’instant, la version multilingue arrive).

aurele

Bien entendu, pour que cela fonctionne, n’oubliez pas de reconfigurer vos /etc/syslog.conf afin qu’ils envoient leurs requêtes UDP vers votre machine Windows.

Téléchargement: Aurele v1.0

Leave a Comment : more...

Les joies de l’ARP…

by Gradew on Sep.15, 2008, under System

… quand ça tourne mal, ça donne quelque chose comme ça:

arppoison

Pour être honnête, j’ai bien galéré avant de mettre le doigt sur un problème qui nous faisait tourner en bourrique au boulot; vous pingez une machine, c’est une autre qui vous répond… certains users voient le domaine et pas d’autres… En fait, c’est juste un routeur qui s’amuse à répondre aux requêtes ARP à la place des autres machines. A s’arracher les cheveux!!

Leave a Comment :, more...

Moteur 3D

by Gradew on Aug.24, 2008, under Development

N’ayant visiblement rien de mieux à faire de mon temps, j’ai déterré ce vieux projet pour l’adapter sous Linux… le réécrire en partant de zéro, même.

Voici un petit aperçu de ce que ça donne pour l’instant (cliquez sur l’image pour l’agrandir):

crystal3dengine

Le tout a été réalisé en deux jours avec du libre/gratuit:

  • compilateur g++ (GCC) 4.1.2 20061115
  • librairie OpenGL freeglut
  • librairie libjpeg pour le chargement des textures
  • librairies X11 étendues libxf86vm
  • DeleD (version LITE) pour l’édition 3D, la map et les textures d’exemple; leur format de fichier est un format texte ouvert

Mon but n’est pas non plus d’écrire le moteur 3D du siècle, y’a des équipes entières qui font ça largement mieux que moi tout seul. Mais c’est encourageant de voir qu’on peut arriver à des résultats exploitables en si peu de temps.

Leave a Comment :, more...

Bot IRC [DoS] répandu

by Gradew on Jul.05, 2008, under System

Depuis plusieurs mois, on peut observer sur énormément de réseaux IRC un phénomène assez amusant; des bots répondant aux doux noms de paula35, gigi31 ou encore clochette et mbulleg se connectent au réseau, semblent ne rien faire pendant 2/3 minutes, puis quittent le réseau.

Pris d’un désir d’en finir avec eux, j’ai dégainé mon fidèle PuTTY:

nohup tcpdump -vv -s 0 -w cmon-stupid-fecking-bots.pcap 'tcp[2:2]=6667' &

afin de voir de quoi il en retourne. En moins de 24h, premiers résultats, et concluants avec ça: ils font bien quelque chose, mais c’est au niveau de la couche TCP que ça se passe. La conversation suivant le protocole IRC se résume en effet à un NICK, USER puis un QUIT, mais c’est ce qui se passe avant le QUIT qui est intéressant. J’ai pu en effet observer une totalité de 1342 erreurs de protocole TCP: Bad checksum, SYN, FIN, RST, bad checksum (plus de 30 fois), et re-belote.

On va appeler ça une pitoyable tentative de DoS, car c’est pas avec sa petite bande passante qu’il fera paniquer un serveur. Mais ça mérite quand même un DROP sur les firewalls.

Admins IRC, sus à 212.198.248.33 [212-198-248-33.rev.numericable.fr] et 90.25.50.57 [ANantes-257-1-35-57.w90-25.abo.wanadoo.fr].

Edit: Comme me l’a suggéré Sendell de l’équipe d’EpiKnet, il peut être utile d’avoir recours à des services de blacklist, comme bopm, qui commencent à recenser ces IP devenant visiblement de plus en plus nombreuses, du moins suffisamment pour qu’on commence à s’en soucier.

Leave a Comment :, , , more...

Bienvenue dans un monde où Microsoft pense pour vous…

by Gradew on Oct.29, 2007, under System

Depuis peu, et afin de permettre d’éliminer tous ces Spams que l’ont recoit chaque jour, Microsoft a décidé de lancer un nouveau concept génialissime en adhérant au programme Sender Score.

Ayant décidé que le Sender ID ne suffirait plus (ce dernier empêchant déjà tous les hébergements mutualisés d’envoyer des mails vers MSN/Hotmail), Microsoft a donc recours à ce fameux Sender Score. Quel en est le principe? Très simple: Allez donc faire un tour sur http://www.senderscorecertified.com/ pour vous rendre compte qu’il vous faut donc désormais une certification “Sender Score” qui est bien sûr payante, afin d’être reconnu comme expéditeur légitime.

Pour ceux qui ne sont pas “Sender Score Certified”, il faut juste espérer que les mails d’inscriptions aux forums, etc.. passent au travers des mailles du filet.

Pour finir, deux extraits de la conversation que j’ai eue avec eux par e-mail:

“While using the SNDS tool, enrollment in the JMRP or having your IPs registered with Sender ID will not allow emails from your mail servers to bypass our filters, these are in place to help legitimate companies deliver their emails to Hotmail Customers.”

“The troubleshooting steps in this email are recommendations only. Microsoft makes no guarantees that following these steps will guarantee deliverability to MSN, Hotmail, or Live.com customers.”

En résumé: Microsoft ne GARANTIT PLUS l’acheminement correct des e-mails vers leurs serveurs :( .

1 Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!