Open Security Architecture – Note to Self

August 27th, 2010

osa_logo_180x66This very well done and useful site has been done, among others, by a great ex-coworker I respect very much.

As a note-to-self, I’m placing it in my collection of useful tech tips since their library and documentation is more than useful.

And yes, I’m committing to participate there as well, although I don’t know when I’ll be able to send my first contribution.

But committmen is a start, right? ;)


Email this post Email this post

Odd characters while copying from SMB mounted drive to local Linux folder

July 7th, 2010

Since this happened with filenames with euro sign or accented characters or dollar signs, the solution is to specify the mount options as follows:
smbmount -o iocharset=utf8 //servername/folder /mnt/localmountpoint


Email this post Email this post

Adding bunch of users in Linux in batch mode

July 5th, 2010

As usual, the main source for writing articles here is a need I had and a solution I found ;)

This time the need was to add a series of users in a Linux system without repeating the command useradd one zirillion of times.

First, we need to populate a text files with details about the users we’re going to create.

Let’s assume the file is called myuserlist.txt (permissions 600) with the following syntax:

user1:password1:1001:510:My First Account:/home/user1:/bin/bash
user2:password2:1002:510:My Second Account:/home/user2:/bin/bash
user3:password3:1003:510:My Third Account:/home/user3:/bin/bash
user4:password4:1004:510:My Fourth Account:/home/user4:/bin/bash

Once you’re done with the list, proceed to add the users with the command:

newusers myuserlist.txt

After command is issued, check the results in the following files:

/etc/passwd
/etc/shadow
/etc/groups


Email this post Email this post

Zeroshell displaying odd characters on serial terminal

June 29th, 2010

I’ve been recently fashioned by Zeroshell project, a very well documented project run by an italian guy who made a splendid job.

I tried to set it up on a VIA based appliance with Intel 1 Ghz processor and 1 Gb RAM, using 1 Gb Compact Flash and the image provided in download section of Zeroshell web site.

Everything went smooth, except that when I booted the appliance the BIOS information was displayed correctly, but as soon as Zeroshell boot started I saw crappy characters on screen.

After some investigation and some good hints from a friend, I found where the problem was and, as usual, here’s a tech note to avoid again this investigation in the future.

The issue was that appliance BIOS was set to redirect console to serial port with settings normally in use: 9600 bps, 8N1

…while Zeroshell defaults in its boot to more performing (but also less “default”) 38400.

Read the rest of this entry »


Email this post Email this post

Automatically mounting a remote directory in Ubuntu using autofs + sshfs

May 27th, 2010

Memo to self…


Email this post Email this post

Turn your MacBook in 64 bit

March 14th, 2010

Yes, yes, I know what you’re thinking… sure , boot with 6 and 4 pressed and your Mac will boot in 64 bit mode.

But I’m talking aout the other way around: haveing your modern MacBook booting in 64 bit mode, and possibly turn it into 32 bit only when you need it (sure, by keeping 3 and 2 pressed while booting).

Here’s howto:

  1. Check your Mac is capable of doing it by issuing in terminal the command:
    ioreg -l -p IODeviceTree | grep firmware-abi
  2. If output is something like “| |   “firmware-abi” = <”EFI64″>” this means Yes, you can!
  3. Open a Terminal and cd to /Library/Preferences/SystemConfiguration/
  4. edit com.apple.Boot.plist
  5. under Kernel Flags insert
    arch=x86_64
    between the <string> and </string> tags
  6. reboot
  7. Enjoy

Of course, a good pre-check if you could be fine is to boot keeping pressed 6 and 4… if it boots 64bit then you’re ok.


Email this post Email this post

How do I sign a Certificate Request?

January 18th, 2010

Quick not to myself since everytime I spend hours in searching it again.

The command line is:

openssl x509 –req –in <path>/<certificate_request>.csr  –signkey <path-to-CA-private-cert>/CA-private-cert.pem –out <path-to-certs-repository>/signed-cert-name.pem

Hopefully next time I do not have to search it again hours and hours ;)

Naturally this command required to have created the request before, and to have correctly setup the CA… but there is documentation on the ‘Net concerning these two operations.


Email this post Email this post

Want to know the IMAGE LABEL of my ISO file

January 18th, 2010

This is something not so easy to find on the internet, and once again Linux shows its immense power in the simplest way: CLI.

Question: I have a .ISO file representing the image of a DVD and I want to know the LABEL of that DVD.

Answer: Issue the command

dd if=/<path>/filename.iso bs=1 skip=32808 count=32

on whatever Linux terminal.

For example, here’s what is returned for a backup copy of DVD I legally own:

Input command:
dd if=Natale\ in\ Casa\ Muppets.iso bs=1 skip=32808 count=32

Output:
MUPPETS_CHRISTMAS_CAROL         32+0 records in
32+0 records out
32 bytes (32 B) copied, 0.00129793 s, 24.7 kB/s

Enjoy!


Email this post Email this post

uPnP Media Server with llink.

January 16th, 2010

Let’s start this new year by referencing an excellent system I happened to find on the Internet to perform uPnP server functionality on my Linux system.

The name of the thing is LLink and although I haven’t exploited at full yet, it looks VERY promising.

Some features:

  • Parses various video containers: vob, avi, ts, mkv, tp, mov, m2ts, evo.
  • Streams any file type the NMT player can handle: mp3, flac, jpeg, png etc.
  • Can play straight from rar files: no more need to unrar your media. (Comes with special unrar-3.7.8-seek.)
  • SSDP / UPnP discovery support (although minimal).
  • Skin support: make your own html templates or choose from pre-built.
  • Simple iMDb querying to look up media information for Jukebox skins.
  • Both HD and SD skins available.
  • Light, tiny and clean code for Unix, OsX and Windows.
  • Paginating: support to send listings in pages, with tags for Next/Prev.
  • PlayAll cgi tag, and PlayAllFrom.
  • External subtitles: subtitle files can be consolidated in one directory.
  • libdvdnav support (and libdvdcss): provides basic playback of DVD .iso and .img files and from DVD drives.
  • UDF 2.50 BD5-ISO support: provides basic playback of Bluray and HD-DVD.

Got interested? You can find more here.


Email this post Email this post

Scripting Galore – The beauty of randomic sort

December 31st, 2009

Although it could seem an oxymore, sort something in randomic order might be usefl sometimes.

Give a look to the script below, which I’m writing here for future reference.

#!/bin/bash
#
# This script creates a list of file or symbolic link to pictures in a directory
# The pictures are dynamically selected within a library of thousands
# This is to allow a wireless frame to display daily an ever changing list
# of pictures

# Define variable to be the target directory where we put the link/pictures
# This directory is regularly scanned by MediaTomb, the uPnP server talking to
# the digital frame

# Define variable to be the root directory where it will start to scan
scandir=/media/allphotos

# Clean previous contents of the directory used for streaming
cd /var/streampix
rm -rf *

# Define cycle to set the max number of photos to be displayed
# (like from 1 to 50 repeat)
for i in `seq 1 50`

# list the dir, pick a random file, add to the list
do
y="$(find $scandir -type f -iregex ‘.*\.\(bmp\|gif\|jpg\|png\)$’ | sort -R | head -1)"
cp "$y" /var/streampix/
done

Enjoy!


Email this post Email this post