misctechmusings notebook for projects, problems and solutions

Medibuntu Repositories

Medibuntu (Multimedia, Entertainment & Distractions In Ubuntu) is a repository of >packages that cannot be included into the Ubuntu distribution for legal reasons >copyright, license, patent, etc).

Some of these packages include the libdvdcss package from VideoLAN and the external >binary codecs package (commonly known as w32codecs) used by MPlayer and xine.

The following one line command will add Medibuntu repositories to the sources.list, install the Medibuntu GPG key and resynchronize the package index:

$ sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update

Additional resources: http://www.medibuntu.org

http://help.ubuntu.com/community/Medibuntu

Archlinux Powerpill Setup

Arch Linux Powerpill Setup

Powerpill is a wrapper for Archlinux package management tool, pacman. This is a short tutorial on setting up powerpill for concurrent downloads without using the reflector

Powerpill is a wrapper script written by Xyne for pacman that speeds up package retrieval by using aria2c for concurrent/segmented downloads. It determines the target packages of requested synchronization operation and then uses the mirrorlist to create a comprehensive metalink. This metalink is then piped to the download manager aria2 for package retrieval. Significant reductions in download times are often possible due to the combined effects of simultaneous and segmented downloads.

Example: One wants to update and issues a pacman -Syu which returns a list of 20 packages that are available for update totally 200 megs. If the user downloads them via pacman, they will come down one-at-a-time. If the user downloads them via powerpill, they will come down simultaneously in many cases several times faster (depending on one’s connection speed, the availability of packages on servers, and speed from server/load, etc.)

A test of pacman vs. powerpill on one system revealed a 4x speed up in the above scenario where the pacman downloads averages 300 kB/sec and the powerpill downloads averaged 1.2 MB/sec.

Install powerpill

$ pacman -S powerpill

To take advantage of powerpill you will need to update your mirror list. I am in the US so I will uncomment all of the local servers in /etc/pacman.d/mirrorlist. The result should looks like this.

# United States
Server = http://archlinux.unixheads.org/$repo/os/i686
Server = ftp://mirror.cs.vt.edu/pub/ArchLinux/$repo/os/i686
Server = http://mirror.cs.vt.edu/pub/ArchLinux/$repo/os/i686
Server = ftp://mirrors.easynews.com/linux/archlinux/$repo/os/i686
Server = http://mirrors.easynews.com/linux/archlinux/$repo/os/i686
Server = ftp://ftp.archlinux.org/$repo/os/i686
Server = http://mirrors.gigenet.com/archlinux/$repo/os/i686
Server = ftp://ftp.gtlib.gatech.edu/pub/linux/distributions/archlinux/$repo/os/i686
Server = http://www.gtlib.gatech.edu/pub/linux/distributions/archlinux/$repo/os/i686
Server = ftp://mirrors.hosef.org/archlinux/$repo/os/i686
Server = http://mirrors.hosef.org/archlinux/$repo/os/i686
Server = ftp://ibiblio.org/pub/linux/distributions/archlinux/$repo/os/i686
Server = http://distro.ibiblio.org/pub/linux/distributions/archlinux/$repo/os/i686
Server = ftp://locke.suu.edu/linux/dist/archlinux/$repo/os/i686
Server = ftp://mirror.rit.edu/archlinux/$repo/os/i686
Server = http://mirror.rit.edu/archlinux/$repo/os/i686
Server = http://schlunix.org/archlinux/$repo/os/i686
Server = http://mirror.sourceshare.org/archlinux/$repo/os/i686
Server = http://archlinux.umflint.edu/$repo/os/i686
Server = http://mirror.umoss.org/archlinux/$repo/os/i686

Make a copy of the updated mirrorlist and run the rankmirrors script. Rankmirrors will sort your mirrorlist according to connection and opening speed.

# mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.org
# rankmirrors -n 0 /etc/pacman.d/mirrorlist.org > /etc/pacman.d/mirrorlist

Now that the mirrorlist is setup we will configure powerpill. Set the maximum number of connections in /etc/powerpill.conf> to equal the uncommented servers in the mirrorlist.

# cat /etc/pacman.d/mirrorlist | grep -v ^# | grep -v ^$ | wc -l
23

Comment out the reflector line of powerpill.conf and update max-concurrent-downloads=23 (number of uncommented mirrors.)

It is recommended to refresh the pacman database after changing the mirrors

$ pacman -Syy

Time to give powerpill a run

$ powerpill -Syu

More details can be found on Arch Linux excellent Wiki

Network Bonding

Details on setting up network bonding. This is going to be used as a Snort sensor on a passive network tap.

Install ifenslave

$ sudo apt-get install ifenslave

Create the file /etc/modprobe.d/bonding.conf with the following:

alias bond0 bonding
options bonding mode=0 miimon=100

A note about promiscuous mode regarding the bonding mode:

Promiscuous mode

When running network monitoring tools, e.g., tcpdump, it is common to enable promiscuous mode on the device, so that all traffic is seen (instead of seeing only traffic destined for the local host). The bonding driver handles promiscuous mode changes to the bonding master device (e.g., bond0), and propagates the setting to the slave devices.

For the balance-rr, balance-xor, broadcast, and 802.3ad modes, the promiscuous mode setting is propagated to all slaves.

For the active-backup, balance-tlb and balance-alb modes, the promiscuous mode setting is propagated only to the active slave.

Time to load the module:

$ sudo modprobe bonding

Add the new interface into your /etc/network/interfaces file:

auto bond0
iface bond0 inet manual
slaves eth2 eth3
up ifconfig $IFACE 0.0.0.0 up
up ip link set $IFACE promisc on
down ip link set $IFACE promisc off
down ifconfig $IFACE down

Restart networking to bring up the new interface:

$ sudo /etc/init.d/networking restart

Connect to your passive ethernet tap and verify with tcpdump

$ sudo tcpdump -i bond0

Windows 7 GodMode

Found on cnet.com A simple shortcut to multiple Windows 7 configuration options.

Create a new folder and rename it to the following:

GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

godmode

dns-o-matic on m0n0wall

Looking for a method of using OpenDNS with a dynamic IP address. I am currently using the DynDNS service however is no method of linking this service to OpenDNS. OpenDNS has an additional service called DNS-O-Matic.

DNS-O-Matic is a dynamic DNS service. The service supports dozens of other dynamic DNS services. All of which can be linked to your account. A list of the supported services can be found below.

https://www.dnsomatic.com/wiki/supportedservices

For instance you can use DNS-O-Matic to update your DynDNS and OpenDNS accounts.

Thanks goes out to the editor of the thread below. DNS-O-Matic service can be used on m0n0wall without an “official” option for the service.

m0nowall DNS-O-Matic Topic

dnsomatic

Linux Hardware Detection Tool Dmidecode

While searching for a quick method of checking a systems memory type, I stumbled upon the dmidecode tool. Dmidecode was able to pull all of the memory information from my motherboard. Including open memory slots and values of the occupied ones.

Usage

Usage: dmidecode [OPTIONS]

Options are:

-d, --dev-mem FILE     Read memory from device FILE (default: /dev/mem)
-h, --help             Display this help text and exit
-q, --quiet            Less verbose output
-s, --string KEYWORD   Only display the value of the given DMI string
-t, --type TYPE        Only display the entries of given type
-u, --dump             Do not decode the entries  
     --dump-bin FILE    Dump the DMI data to a binary file
     --from-dump FILE   Read the DMI data from a binary file
-V, --version          Display the version and exit

dmidecode run without any options will dump everything it can determine from the Desktop Management Interface (dmi). The output can be limited to a specific dmi type.

DMI Types

DMI TYPES

       The SMBIOS specification defines the following DMI types:
       Type   Information
       ----------------------------------------
          0   BIOS
          1   System
          2   Base Board
          3   Chassis
          4   Processor
          5   Memory Controller
          6   Memory Module
          7   Cache
          8   Port Connector
          9   System Slots
         10   On Board Devices
         11   OEM Strings
         12   System Configuration Options
         13   BIOS Language
         14   Group Associations
         15   System Event Log
         16   Physical Memory Array
         17   Memory Device
         18   32-bit Memory Error
         19   Memory Array Mapped Address
         20   Memory Device Mapped Address
         21   Built-in Pointing Device
         22   Portable Battery
         23   System Reset
         24   Hardware Security
         25   System Power Controls
         26   Voltage Probe
         27   Cooling Device
         28   Temperature Probe
         29   Electrical Current Probe
         30   Out-of-band Remote Access
         31   Boot Integrity Services
         32   System Boot
         33   64-bit Memory Error
         34   Management Device
         35   Management Device Component
         36   Management Device Threshold Data
         37   Memory Channel
         38   IPMI Device
         39   Power Supply
         40   Additional Information
         41   Onboard Device

Identify Memory Device

Using the -t option, I have queried the dmi for type “17” “Memory Device”.

$ sudo dmidecode -t 17
# dmidecode 2.10
SMBIOS 2.3 present.

Handle 0x0028, DMI type 17, 23 bytes
Memory Device
Array Handle: 0x0026
Error Information Handle: 0x0025
Total Width: 16 bits
Data Width: 16 bits
Size: 128 MB
Form Factor: RIMM
Set: 3
Locator: J7J1
Bank Locator: RIMM1
Type: Other
Type Detail: RAMBus
Speed: 400 MHz

Handle 0x002A, DMI type 17, 23 bytes
Memory Device
Array Handle: 0x0026
Error Information Handle: 0x0025
Total Width: 16 bits
Data Width: 16 bits
Size: 128 MB
Form Factor: RIMM
Set: 3
Locator: J7J2
Bank Locator: RIMM2
Type: Other
Type Detail: RAMBus
Speed: 400 MHz

Handle 0x002C, DMI type 17, 23 bytes
Memory Device
Array Handle: 0x0026
Error Information Handle: 0x0025
Total Width: 16 bits
Data Width: 16 bits
Size: 128 MB
Form Factor: RIMM
Set: 3
Locator: J8J1
Bank Locator: RIMM3
Type: Other
Type Detail: RAMBus
Speed: 400 MHz
Handle 0x002E, DMI type 17, 23 bytes
Memory Device
Array Handle: 0x0026
Error Information Handle: 0x0025
Total Width: 16 bits
Data Width: 16 bits
Size: 128 MB
Form Factor: RIMM
Set: 3
Locator: J8J2
Bank Locator: RIMM4
Type: Other
Type Detail: RAMBus
Speed: 400 MHz