OpenSource Software

Linux distribution development

autospec suite

Autospec was created for the QiLinux distribution and is now used by the openmamba developers.

Autospec is a fully configurable suite of bash scripts for automatically generating specfiles from source tarballs and downloading/upgrading/compiling/testing/uploading the rpm (RedHat Package Manager) packages provided by an rpm-based Linux distribution.

Tags : Utilities/Development

License : GPL v2+

Operating System : Linux

Implementation : Bash scripts

Developed by : Davide Madrisan (see the file AUTHORS for contributors)

Last stable version : 1.16.4

Architecture

    • Frontent (/usr/bin)

    • autospec

    • Plugins (/usr/bin)

      • pck-extract - Extract a given file or list of files from a srpm archive

    • pck-update - Update a rpm package to a specified version and release

    • spec-create - Create a specfile for the specified source tarball

      • config-getvar - Print the value of a given configuration variable

    • Libraries (/usr/share/autospec/lib)

      • libapse.lib - Autospec Package Search Engine library

      • libcfg.lib - Load the configuration files

      • libmsgmng.lib - Manage debug/warning/error messages

      • librepository.lib - Interact with the distribution repositories

      • libspec.lib - Specfiles parser

    • Tests (/usr/share/autospec/tests)

      • test01_pkgquality

      • test02_pkgsecurity

    • Templates (/usr/share/autospec/templates)

      • gnome

      • kde3, kde4

      • library

      • perl

      • python

      • standard

      • standard-daemon

    • Configuration files

    • /etc/autospec.conf

    • /etc/autospec.d/*.conf

    • $HOME/.autospec

    • $HOME/.autospec.d/*.conf

  • Color Scheme files

    • /etc/autospec.d/color-theme.*

    • Translation files (/usr/share/locale/it/LC_MESSAGES/)

      • po files

Roadmap

  • Add support for OCaml libraries and development packages - (done)

  • Extensions for openmamba webbuild - (done)

    • Rewrite the translation framework and make the merge of new strings automatic - (done)

    • Support GIT repositories in spec-create and pck-update - (done)

    • Fully modularization: frontend + libraries + plugins + localization - (done)

    • Library code review to speed up execution - (done)

  • spec-create: use distro-specific templates when generating specfiles - (done)

  • tests: add more tests and improve the usability - (done)

    • Better documentation (in progress...)

Latest GIT commits

Known bugs

None known.

Have you found a bug?

Please post a description and possibly a way to reproduce the bug.

You can found my mail address in the file AUTHORS.

If you're feeling especially nice, you should make a log of the autospec output when running in '--debug' mode or even make a patch to fix the flaw. Sending patches as attachments is preferred, but not required.

Get it, Try it, Love it...

Install autospec in openmamba by entering the following command in the terminal prompt:

smart install autospec

Download the source code here or look at the openmamba autospec.source page.

Browse GIT repository at http://gitlab.openmamba.org/openmamba/autospec/tree/master

Get involved

Have you found a bug?

Please post a description and a way to reproduce the bug.

If you're feeling especially nice, you should make a log of the autospec output when running in '--debug' mode or even make a patch to fix the flaw. Sending patches (you can found my mail address in the file AUTHORS) as attachments is preferred, but not required.

Monitoring - Nagios Plugins

Important note

The following Nagios plugins and several new ones, developed for the Linux architecture only, are now part of my nagios-plugins-linux project.

Check the development status at GitHub or look at this page for more informations.

You can also check my directory page at Nagios Exchange.

check_uptime

Purpose : This nagios plugins check the time the host is running

Tags : Utilities/Monitoring

License : GPL v3+

Operating System : Linux, FreeBSD, AIX, Solaris, OpenIndiana, OpenBSD, and possibly other Unixes

Implementation : C

Last stable version : 7

Supported platforms :

  • Linux openmamba 2.75 (with kernel 3.6, gcc 4.7.2, and glibc 2.16.0)

  • FreeBSD 8.2-RELEASE-p10

  • AIX 6.1 with gcc 4.2.0

  • Solaris 11.1 (SunOS solaris 5.11 11.1) with gcc 4.5.2

  • OpenBSD 5.2 with gcc 4.2.1

Usage

check_uptime [--warning [@]start:end] [--critical [@]start:end]

check_uptime --help

check_uptime --version

Where

1. start <= end

2. start and ":" is not required if start=0

3. if range is of format "start:" assume end is infinity

4. to specify negative infinity, use "~"

5. alert is raised if metric is outside start and end range (inclusive)

6. if range starts with "@", then alert if inside this range (inclusive)

Examples

# raise a critical alert if the uptime is less then 15 minutes

shell$ /usr/lib/nagios/plugins/check_uptime --critical 15:

Uptime: 190 days 3 hours 41 min

Source code

You can also download the source tarball here

Get the source code from GitHub:

https://github.com/madrisan/nagios-plugins-uptime

This plugin is also available in the Nagios Exchange repository

addons like NSClient++, so you can check metrics on remote Windows machines as well.

check_memory

Purpose : This nagios plugins check the memory and spaw usage

Tags : Utilities/Monitoring

License : GPL v3+

Operating System : Linux, OpenBSD

Implementation : C

Last stable version : 3

Supported platforms :

  • Should work on all Linux distributions (kernel tested: 2.6.18, 2.6.32, and 3.10)

  • OpenBSD 5.0

Usage

check_memory [-C] [-b,-k,-m,-g] [-w PERC] [-c PERC]

check_swap [-b,-k,-m,-g] [-w PERC] [-c PERC]

check_memory --help

check_swap --help

Where

* -M, --memory: show the memory usage * -S, --swap: show the swap usage * -C, --caches: count buffers and cached memory as free memory * -b,-k,-m,-g: show output in bytes, KB (the default), MB, or GB * -w, --warning PERCENT: warning threshold * -c, --critical PERCENT: critical threshold

Examples

shell$ /usr/lib/nagios/plugins/check_memory -C -m -w 80% -c90%

OK: 79.22% (810964 kB) used | mem_total=999MB, mem_used=791MB, mem_free=207MB, mem_shared=0MB, mem_buffers=1MB, mem_cached=190MB, mem_pageins=33803MB, mem_pageouts=18608MB

shell$ /usr/lib/nagios/plugins/check_swap -w 40% -c60%

WARNING: 42.70% (895104 kB) used | swap_total=2096444kB, swap_used=895104kB, swap_free=1201340kB, swap_cached=117024kB, swap_pageins=1593302kB, swap_pageouts=1281649kB

Source code

You can also download the source tarball here

Get the source code from GitHub:

https://github.com/madrisan/nagios-plugins-memory

https://github.com/madrisan/nagios-plugins-linux

check_filesystems

Purpose : This collection of nagios plugins check for filesystems issues

Tags : Utilities/Monitoring

License : GPL v3+

Implementation : C

Last stable version : 2

Supported platforms :

  • Linux openmamba 2.75 (with kernel 3.6, gcc 4.7.2, and glibc 2.16.0)

  • SunOS openindiana 5.11 with gcc 4.3.3

  • OpenBSD 5.2 with gcc 4.2.1

  • AIX 6.1 with gcc 4.2.0

check_readonyfs

check for readonly filesystems.

Usage

check_readonlyfs [OPTION]... [FILESYSTEM]...

check_readonlyfs --help

check_readonlyfs --version

Options

-l, --local limit listing to local file systems

-L, --list display the list of checked file systems

-T, --type=TYPE limit listing to file systems of type TYPE

-X, --exclude-type=TYPE limit listing to file systems not of type TYPE

-h, --help display this help and exit

-v, --version output version information and exit

Examples

shell$ /usr/lib/nagios/plugins/check_readonlyfs -l -T ext4

shell$ /usr/lib/nagios/plugins/check_readonlyfs /home /var/log

check_ifmount

check if the given filesystems are mounted.

Usage

check_ifmount [FILESYSTEM]...

check_ifmount --help

check_ifmount --version

Options

-h, --help display this help and exit

-v, --version output version information and exit

Examples

shell$ /usr/lib/nagios/plugins/check_ifmount /mnt/remotefs

shell$ /usr/lib/nagios/plugins/check_ifmount /whatever /you/need

Source code

You can also download the source tarball here

Get the source code from GitHub:

https://github.com/madrisan/nagios-plugins-filesystems

https://github.com/madrisan/nagios-plugins-linux

check_multipath

Purpose : This nagios plugins check for faulty paths managed by the multipath daemon

Tags : Utilities/Monitoring

License : GPL v3+

Operating System : Linux

Implementation : C

Last stable version : 1

Usage

check_multipath [--debug]

check_multipath --help

check_multipath --version

Examples

shell$ /usr/lib/nagios/plugins/check_multipath

MULTIPATH CRITICAL: found 2 faulty path(s)

Source code

You can also download the source tarball here

Get the source code from GitHub: https://github.com/madrisan/nagios-plugins-linux-multipath

check_passwd

check_passwd: check password expiration

Tags : Utilities/Monitoring

License : GPL v2+

Operating System : Linux

Implementation : Bash script

Usage

check_passwd [--limit <number_of_days>] [--user <username>]

Examples

shell$ ./check_passwd --limit 7

WARNING - user1(5day) user2(4day)

shell$ ./check_passwd --limit 7 --user user1

WARNING - user1(5day)

shell$ ./check_passwd --limit 3

OK

This plugin requires the following lines in /etc/sudoers in order to work properly:

Defaults:nrpe !requiretty

nrpe ALL=(ALL) NOPASSWD: /usr/bin/chage

Source code

Download this shell script here

Security

wtmpclean

wtmpclean is a tool for Unix operating systems (currently tested on Linux and AIX), written in standard C ANSI, which enables users with sufficient privileges dump wtmp databases and patch or delete wtmp records that log a user or that were created at a given date and time. It is available under the GPLv3. This project is registered at freecode.com.

Tags : Utilities/Security

License : GPL v3+

Operating System : Linux

Implementation : C

Developed by : Davide Madrisan

Last stable version : 0.8.1

Usage examples

# remove all the entries of the user "root" (preserving ownership and timestamp of the wtmp file)

wtmpclean --file /var/log/wtmp.1 root

# just remove a single entry for user "root" (on 6 september 2008 at 2.30 pm)...

wtmpclean --time 200809061430 root

# ...or replace the user "jekyll" with the user "hide"

wtmpclean --time "2008.09.06 14:30:00" jekyll hide

# same but using regular expressions

wtmpclean --time "2013\.12\.?? 23:.*" jekyll hide

# show listing of user "root" in the current wtmp file in raw format

wtmpclean --raw root

Download the source code here.

GitHub source code: https://github.com/madrisan/wtmpclean

Roadmap

    • Better output when run with the --list option (mostly done!)

    • Better output when run with the --raw option (done)

  • Support OpenSolaris, FreeBSD and possibily other Unix operating systems - NEW

Note: Italian readers may read the article "Coprire le tracce" in Linux Magazine - April 2010 (page 45), which discuss a possible usage of such a tool.

cisco7crack

cisco7crack is a cracking tool for decoding (and encoding) the Cisco "enable 7" passwords.

Cisco "enable 7" passwords can be up to twenty-five mixed-case characters. In the "encrypted" representation, the first two bytes of the long string are a random decimal offset between 0 and 15 into a magic block of characters, and the remaining bytes are ascii-hex representations of the password bytes xored against the character-block bytes from the given offset on down, modulus the character-block length. The character block is "dsfd;kfoA,.iyewrkldJKDHSUB".

This program can decrypt and crypt passwords coded with such a pesky algorithm.

Download the source code here

GitHub source code: https://github.com/madrisan/cisco7crack

cisco5crack

A cracking tool for decoding (and encoding) the Cisco "enable 5" passwords.

This tool is an off-line password cracker for the MD5 passwords used in all the Cisco devices running IOS

("type 5" passwords) and in the PIX firewalls ("encrypted password'). The feasibility of an off-line password guessing is something that every network administrator should consider before leaving router or PIX

configuration files on TFTP servers or sending them via unencrypted emails.

Here some examples of passwords handled by this tool:

    • enable secret 5 $1$GsYL$MEEYuiuto.ex9Km/hC1sl/

    • enable secret level 10 5 $1$F1kl$jKXsHDkl9Qlu28b/8t1MU0

    • passwd WT.PMwgB2ek6zyV3 encrypted

    • enable password 2KFQnbNIdI.2KYOU encrypted

Its primary purpose is to detect weak passwords using:

    • unbound brute-force attacks (for *very short* passwords only)

    • brute-force attacks bound by

      1. fixed length / range of lengths for plaintexts to be used

      2. user defined alphabet (eventually combined with (1))

      3. regular expressions

      4. a given vocabulary (text file with line separated words)

While cracking, you can press the enter key for status, or Ctrl+C to abort the session, saving point information to a file (`restore_cc' by default) and restore the session later on. C5C doesn't use any external crypt library. Instead it has its own highly optimized crypt module.

C5C is known to compile and run on Intel x86, Sparc Sun Solaris, IA-64 (Itanium 2).

Download the latest source code here.

GitHub source code: https://github.com/madrisan/cisco5crack

Some patches

nagios-plugins

Nagios is a program that will monitor hosts and services on your network, and to email or page you when a problem arises or is resolved. Nagios runs on a Unix server as a background or daemon process, intermittently running checks on various services that you specify. The actual service checks are performed by separate "plugin" programs which return the status of the checks to Nagios.

  • This patch against nagios-plugins 1.4.15 let check_nagios to raise a critical error when more than one session leader nagios processes are detected.

Download the patch here

Note: If you do not want to redefine PS_COMMAND in check_nagios.c you must configure nagios-plugins with the following options in order the patch to work:

--with-ps-command="`which ps` -eo 'stat uid pid ppid vsz rss pcpu etime comm args'" \

--with-ps-format='%s %d %d %d %d %d %f %s %s %n' \

--with-ps-cols=10 \

--enable-extra-opts \

--with-ps-varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,\

--with-ps-format='%s %d %d %d %d %d %f %s %s %n' \

--with-ps-cols=10 \

--enable-extra-opts \

--with-ps-varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,\

&procpcpu,procetime,procprog,&pos'

  • Two small patches have been accepted upstream:

  • see the GitHub pull requests #22 and #28 (nagios-plugins ver 2.0.1) and #37.

OCS Inventory Agent Standalone

OCS Inventory is a powerful inventory and package deployment system for Windows and Unix like systems.

This patch fixes the runtime error "Failed to load Ocsinventory::Agent, Can't locate loadable object for module Digest::MD5 in @INC ..." when the script tools/standalone.sh is executed.

distromatic

Distromatic is a tool written in C created by Silvan Calarco for the QiLinux distribution and is now used by the openmamba developers. Distromatic gets from the rpm headers of a set of configurable repositories the informations needed to perform all the tasks necessary for maintaining a Linux distribution. It can be used to manage the package dependencies, to generate the ISO images and snapshots of a Linux distribution and to dynamically generate the HTML pages containing some useful technical informations (see here for a complete example). It can also generate RSS news.

Download the source code here

Last code contributions

    • building process autotoolized

    • porting to rpmlib version 4.1.x

    • code cleanup, several segmentation fault fixes after glibc upgrade, better POSIX compliance

    • download the favicons from every package site (in progress...)

      • distromatic-0.8.98-favicon-build.patch

      • distromatic-0.8.98-favicon.patch

Coloring-book

Coloring-book is a simple coloring book program written in Python w/ Pygame.

Here are some patches that can be applied to coloring-book version 0.13 to add the italian localization and increase mouse speedup for better program usability:

    • patch1: take care of the LANG environment variable

    • patch2: use 'books/default' only when 'books/$LANG' is not installed

    • patch3: italian localization (translation provided by "KaeZar")

    • patch4: increase the default mouse speedup

LILO-config

The lilo-config plugin for kcontrol is a module for configuring the lilo boot loader. It's part of KDE3, as a component of the KDE3 admin module. This patch fixes the kde bugs 57677 and 57679.

Bash Scripts

getif is a simple network tool that allow you to collect some basic informations from SNMP devices.

Samples:

getif --routing 192.168.2.254

getif --int 1 192.168.2.254

linwall is a firewall for single-homed host, featuring restrictive input rule sets and restrictive ICMP rule set. Includes TCP flag validation and SYN rate limiting.

netcmpt computes mask, wildcard mask, network and broadcast addresses.

Samples:

netcmpt 192.168.229.161 255.255.248.0

netcmpt 192.168.229.161/21

skeleton is a full-featured script for configuring cisco routers working as MPLS CPE, starting by a minimalistic set of input rules.