Installing a SheevaPlug

I needed a small file server at home, focused on  storage backups. Searching in my circuit warehouse i found my old sheevaplug and decided use it.

sheeva plug
sheeva plug

I choose install a Debian on it.

Step 1: Identify sheevaplug serial console

Plug sheeva plug microusb port to your desktop computer and execute dmesg in your computer.

Output will be like this

[ 3016.391801] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 3016.391820] ftdi_sio 2-4.3:1.1: device disconnected
[ 3019.518529] usb 2-4.3: new full-speed USB device number 4 using ehci-pci
[ 3019.611536] usb 2-4.3: New USB device found, idVendor=9e88, idProduct=9e8f
[ 3019.611542] usb 2-4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3019.611545] usb 2-4.3: Product: SheevaPlug JTAGKey FT2232D B
[ 3019.611548] usb 2-4.3: Manufacturer: FTDI
[ 3019.611551] usb 2-4.3: SerialNumber: FTT39IJR
[ 3019.615454] usb 2-4.3: Ignoring serial port reserved for JTAG
[ 3019.618652] ftdi_sio 2-4.3:1.1: FTDI USB Serial Device converter detected
[ 3019.618696] usb 2-4.3: Detected FT2232C
[ 3019.619289] usb 2-4.3: FTDI USB Serial Device converter now attached to ttyUSB0

That means that our serial console is attached to device /dev/ttyUSB0

Step 2: Connect to sheeva serial console

 cu -s 115200 -l /dev/ttyUSB0

with this command you can access to sheeva console

Connected.

Marvell>>

Step 3: Verify U-Boot version

Marvell>> version

U-Boot 2011.12 (Mar 11 2012 – 18:59:46)
Marvell-Sheevaplug – eSATA – SD/MMC
gcc (Debian 4.6.3-1) 4.6.3
GNU ld (GNU Binutils for Debian) 2.22

I found in blaicher.com a newer uboot versión and newer versions are always better i decided to update it (you con download here -> u-boot_sheeva_plug_2013_10_rc1)

You need to know your MAC Address before update

Marvell>> printenv ethaddr
ethaddr=YOUR-MAC-ADDRESS
Marvell>>

I uncompress zip file and put into a flash memory, attached flash to sheeva and execute there commands

usb start
fatload usb 0:1 0x0800000 u-boot.kwb
nand erase 0x0 0x60000
nand write 0x0800000 0x0 0x60000
reset
setenv ethaddr YOUR-MAC-ADDRESS
saveenv
reset

Now you have a newer u-boot version

 

Step 4: Install Debian

I copied uImage and uInitrd into a flash memory (uImage and uInitrd debian sheeva) and execute

usb start
fatload usb 0:1 0x00800000 /uImage
fatload usb 0:1 0x01100000 /uInitrd

and started installer

setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most
bootm 0x00800000 0x01100000

Follow on screen instructions and when finished installer will reboot sheeva.

Stop u-boot loading and execute

setenv bootargs_console console=ttyS0,115200
setenv bootcmd_usb ‘usb start; ext2load usb 0:1 0x00800000 /uImage; ext2load usb 0:1 0x01100000 /uInitrd’
setenv bootcmd ‘setenv bootargs $(bootargs_console); run bootcmd_usb; bootm 0x00800000 0x01100000’
saveenv

and start your linux

run bootcmd

 

references:

http://www.blaicher.com/2012/07/installing-debian-on-a-sheevaplug-into-flash/

http://cyrius.com/debian/kirkwood/sheevaplug/

sudo and /etc/sudoers.d directory

sudo logo

I needed to add a new user into sudoers file into several debian machines, i didn’t want open a terminal in each machine and add the line manually, the other option was append a new line into the file like echo “new line”>> /etc/sudoers .But I don’t like edit sudoers file without using visudo, I don’t feel safe.

Reading the debian documentation I found a magical directive for append external files #includedir /etc/sudoers.d, that’s mean if I add a new file  with 0440 permisions and the permissions are important will be appended into our sudo config.

Removing the hash character is a inherited custom ok don’t remove the hash character  is not a comment indicador withouth the hash character, includedir /etc/sudoers.d is a bad line and visudo show an error.

Laboratory III

¿ Qué comandos serían necesarios ejecutar para que un sistema Linux pudiese sustituir el encaminador R2 mostrado en el diagrama ? Asume todos aquellos datos que necesites para realizar el ejercicio (nombre de interfaces, gateway, etc)

Network Diagram
Click for larger view

Previous Steps

Enable IP Forwarding

Temporal:

echo 1 > /proc/sys/net/ipv4/ip_forward

Permanent:

vim /etc/sysctl.conf

changue the value of  net.ipv4.ip_forward = 1

sysctl -p /etc/sysctl.conf # enable  changues

Configuring network intefaces

Temporal:

ifconfig eth0 down

ifconfig eth0 10.10.0.2 netmask 255.255.255.0 up
ifconfig eth1 down

ifconfig eth1 200.3.107.1 netmask 255.255.255.0 up

Persistent:

on debian: edit /etc/network/interfaces like this

auto lo

iface lo inet loopback

iface eth0 inet static
address 10.10.0.2
netmask 255.255.255.0

iface eth1 inet static
address 200.3.107.1
netmask 255.255.255.0

red hat and derivates: edit /etc/sysconfig/network-scripts/ifcfg-<interface name>

Device eth0 file /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=”eth0″
IPADDR=10.10.0.2
METMASK=255.255.255.0
NETWORK=10.10.0.0
BROADCAST=10.0.0.255
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

Device eth1 file /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=”eth1″

IPADDR=200.3.107.1
METMASK=255.255.255.0
NETWORK=200.3.107.0
BROADCAST=200.3.107.255
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

Option 1: Using Static Routing

temporal:

#from network 2 to network 3 assumed not necessary

#from network 3 to network 2 assumed not necessary

#from network 3 to network 1

ip route add 192.168.0.0/24 via 10.0.0.1 dev eth0

persistent:

on Debian

edit /etc/network/interfaces

write this at after the interfaces setup

up route add 192.168.0.0/24 via 10.0.0.1 dev eth0

on Fedora

edit /etc/sysconfig/network-scripts/route-<device>

GATEWAY0=10.0.0.1
NETMASK0= 255.255.255.0
ADDRESS0=192.168.0.0

if you want to add more routes increment the numbers next to GATEWAY, for example: GATEWAY1=10.0.0.2 NETMASK1= 255.255.255.0 ADDRESS1=192.168.30.0

Pros

  • No extra processing and added resources as in the case of dynamic routing protocols
  • No extra bandwidth requirement caused by the transmission of excessive packets for the routing table update process
  • Extra security by manually admitting or rejecting routing to certain networks

Cons

  • Network Administrators need to know the complete network topology very well in order to configure routes correctly
  • Topology changes need manual adjustment to all routers something which is very time consuming

Option 2: Using NAT

Basically NAT works like static routing but changes the output ip maintaining a internal

temporal:

# delete old configuration, if any
#Flush all the rules in filter and nat tables
iptables –flush
iptables –table nat –flush

# delete all chains that are not in default filter and nat table, if any
iptables –delete-chain
iptables –table nat –delete-chain

# Set up IP FORWARDing and Masquerading (NAT)
iptables –table nat –append POSTROUTING –out-interface eth0 -j MASQUERADE
iptables –append FORWARD –in-interface eth1 -j ACCEPT

permanent:

store the rules into the ip tables into a rules set

Pros

same that static plus

It also benefits in a security sense as attackants can’t target a computer directly, they have to first get past the router.

Cons

  • Network Address Translation does not allow a true end-to-end connectivity that is required by some real time applications. A number of real-time applications require the creation of a logical tunnel to exchange the data packets quickly in real-time. It requires a fast and seamless connectivity devoid of any intermediaries such as a proxy server that tends to complicate and slow down the communications process.
  • NAT creates complications in the functioning of Tunneling protocols. Any communication that is routed through a Proxy server tends to be comparatively slow and prone to disruptions. Certain critical applications offer no room for such inadequacies. Examples include telemedicine and teleconferencing. Such applications find the process of network address translation as a bottleneck in the communication network creating avoidable distortions in the end-to-end connectivity.
  • NAT acts as a redundant channel in the online communication over the Internet. The twin reasons for the widespread popularity and subsequent adoption of the network address translation process were a shortage of IPv4 address space and the security concerns. Both these issues have been fully addressed in the IPv6 protocol. As the IPv6 slowly replaces the IPv4 protocol, the network address translation process will become redundant and useless while consuming the scarce network resources for providing services that will be no longer required over the IPv6 networks.

Option 3: Using RIP

Rip is a distance routing protocol, is more flexible that using static routers and necessary if the number of subnets grows. Do you want to fight against hundred of rules? or assume the risk of downtime’s created by a router malfunction?

install zebra

permanent:

edit the /etc/zebra/ripd.conf file

redistribute connected

version 2

ip rip authentication string “max 16 characters”

router rip
network 10.10.0.0/24
network 200.3.107.200/24

pros

  • Easy to configure and use
  • V2 supports VLSM and CIDR

cons

  • Converges slowly on large networks
  • Doesn’t recognize bandwidth of links
  • Doesn’t support multiple paths for the same route
  • Routing updates can require significant bandwidth because the entire routing table is sent
  • Prone to routing loops

Option 4: Using OSPF (Open Shortest Path First)

OSPF is a routing protocol that uses the Dijkstra algorithm for get the quickest way. into a set of subnets where the routers are connected at different speeds could work better than R.I.P.

install zebra

add the necessary VTY in  /etc/services

zebrasrv        2600/tcp             # zebra service
zebra           2601/tcp              # zebra vty
ospfd           2604/tcp              # OSPFd vty
ospf6d          2606/tcp              # OSPF6d vty

edit zebra.conf file

hostname R2
password zebra
enable password z3bRa
log file /var/log/zebra/zebra.log
!
interface eth0
description Network 2
ip address 10.10.0.2/24
!
interface eth1
description Network 3
ip address 200.3.107.1/24

start zebra service

/usr/sbin/zebra –dk
/usr/sbin/ospfd –d

Telnet to port 2604 on the local machine to begin the OSPF configuration and type enable in order to get privileged mode

the next step will be announce the networks that we want  to publicity  in out networks

R2:~# telnet 0 2604
Trying 0.0.0.0…
Connected to 0.
Escape character is ‘^]’.

Hello, this is zebra (version 0.84b)
Copyright 1996-2000 Kunihiro Ishiguro

User Access Verification

ospfd> enable
Password:
ospfd# configure terminal
ospfd(config)# router ospf
ospfd(config-router)# network 10.10.0.0/24 area 0
ospfd(config-router)# passive-interface eth0

ospfd(config-router)# network 200.3.107.0/24 area 0
ospfd(config-router)# passive-interface eth1
ospfd(config-router)# end
ospfd# write file
Configuration saved to /etc/zebra/ospfd.conf

pros

  • Scalability – OSPF is specifically designed to operate with larger networks.
  • Full subnetting support – OSPF can fully support subnetting
  • Hello packets – OSPF uses small hello packets to verify link operation with out transferring large tables
  • TOS routing – OSPF can route packets by different criterion based on their type of service field
  • Tagged routes – Routes can be tagged with arbitrary values, easing interoperation.

cons

  • very intensive processor
  • maintaining multiple copies of routing information, increasing the amount of memory needed
  • OSPF can be logically segmented by using areasnot as easy to learn as some other protocols
  • if an entire network is running OSPF, and one link within it is “bouncing” every few seconds, then OSPF updates would dominate the network by informing every other router every time the link changed state.

sources:

http://www.techrepublic.com/article/use-zebra-to-set-up-a-linux-bgpospf-router/1047843

http://www.trainsignaltraining.com/ip-addressing-routing-default-static-routing

http://ipv6.com/articles/nat/NAT-Pros-and-Cons.htm

www.techrepublic.com/i/tr/one_offs/t063_preview.pdf

http://gotechsf.wordpress.com/2009/09/05/the-pros-and-cons-of-ospf-and-eigrp/

http://ipsit.bu.edu/sc546/sc441Spring2003/ospf/proscons.html

Keysigning Fosdem quick howto

step 1: Install gnugp

debian: apt-get install gnupg

fedora: yum install gnupg

step2: create your key

gpg --gen-key

you’ll have to answer several questions:

kind and key size that do you want: defaults appears to be good enough.

how long the key will be valid : your decision mine never expires.

your name and surname (Use your real name Do you trust in a person called Bart Simpson or Zero Trust?)

your email address

comment: optional

A passphrase: Don’t forget, if you lost your passphrase your encripted data will useless .

Trick: Open a flash video or run a virtual machine for create entropy .

gpg generated key

step 3: Generate a revoke key

changue mykey for your key fingerprint last characters

gpg –output revoke.asc –gen-revoke mykeyfingerprint

step 4: Export public and private keys

exporting private key

gpg –output private.gpg –export-secret-key mykeyfingerprint

exporting public key

gpg –output public.gpg –export mykeyfingerprint

step 5: Backup tour keys

Store your keys into a Floppy disk, usb memory, CD, or wherever, you can print your keys for security.

step 6: Send your public key to fosdem server

the instructions appear in the fosdem site http://fosdem.org and check the public key uploaded

step 7: Print the keys list

a few days before the fosdem start will appear a document to print. (https://ksp.fosdem.org/files/ksp-fosdem2011.txt)

trick try to print the document in the minor number of pages.

step 8: Keysinging Event

Stay at time.

Wear warm clothing.

if you come later  try to find your position asking the key numbers to the participants try to Maintain the order easy for you easy for everyone

keysinging positions

fosdem 2011 keysigning

step 9; Import keys

After the Fosdem you’ll receive several emails signing your public key,  you must import the public keys.

Download the key hashes from https://ksp.fosdem.org/files/ksp-fosdem2011-keyring.asc.bz2

how?

wget –no-check-certificate https://ksp.fosdem.org/files/ksp-fosdem2011-keyring.asc.bz2

bunzip  ksp-fosdem2011-keyring.asc.bz2

gpg –import ksp-fosdem2011-keyring.asc

now your have all the public keys in your ring

step 10: parse fosdem keys

pass your paper maks to a new copy of  the txt keys file

I create this perl script in order to get the key hashes to sing

fosdemparse.pl

unzip and execute

./fosdemparse.pl <path to your file>

this script show the key hashes to

step 11: configure your sSMTP

CAFF sends the sing keys using your system mail transfer agent (MTA), nowadays using your ISP ip address is a warranty  of appears in the receiver  spam box

install sSMTP

on debian: apt-get install ssmtp

on fedora:

yum install ssmtp

(select ssmtp)

alternatives –config mta

configure sSMTP : https://wiki.archlinux.org/index.php/SSMTP

step 12: configure CAFF

install caff

on debian: apt-get install signing-party

on fedora: yum install pgp-tools

now we’ll configure caff

first we’ll execute caff

caff

this creates a config file named .caffrc in your home folder.

edit .caffrc file

gedit $HOME/.caffrc

complete the config file reading the instructions.

final step: send the keys

simply execute caff and paste your fosdemparse.pl output.

enjoy writing your password several times.