Setup a Digital Audio Workstation in Ubuntu – Part 2

Overview

Last time we mapped sound fonts to a MIDI sequence but you can also map a software digital synthesizer to a MIDI sequence and add effects to it as well.

Resources

The programs that we will be installing in Ubuntu are:

  • Jack Rack – Sound effects creation tool
  • ZynAddSubFX – Software synthesizer
  • Hydrogen – Drum Machine

You can install all of these applications from the Ubuntu terminal with the following command:
sudo apt-get install jack-rack zynaddsubfx hydrogen

To follow along with the tutorial you will need a midi file and some sound fonts that you can download from the following websites:

Download midi files here: http://free.mididb.com/ , http://www.free-midi.org/
Download sound fonts here: http://www.hammersound.net/ , http://www.soundfonts.it/?a=soundfonts
Ray has some midi files and sound fonts that you can download from his website: http://trueeclectic.com
Tutorial Videos

Setup a Digital Audio Workstation in Ubuntu

Overview

There are popular computer platforms and software packages for working with digital audio out there, Apple computers, Logic Studio and Garage Band in particular come to mind, but have you considered using Linux to import, create, mix and make music? If you haven’t, consider that music is being created today with open source, freely distributed software, on an open source platform. In the tutorials below I install a number of free digital audio applications in Ubuntu Linux. The tutorials were created under the guidance of my good friend Ray Oltion, who gave a great lecture and demonstration to my class on the basics of getting started working with digital audio in Linux.

If you are serious about using Linux as a digital audio, graphics or video workstation you may want to download a distribution of Linux that has a real-time kernel. Ubuntu Studio caters this type of user with lots of software applications pre-installed and a real-time kernel. Visit the website here: http://ubuntustudio.org/

Resources

The programs that we will be installing in Ubuntu are:

  • Jack and Jack Tools sound connection kit
  • Muse MIDI sequencer
  • Ardour music arranger
  • Audacity sound editor and the Lame mp3 encoder
  • VLC media player

You can install all of these applications from the Ubuntu terminal with the following command:
sudo apt-get install jackd jack-tools muse ardour audacity lame vlc

Note: When you are installing you will be prompted to choose realtime or not. You can experiment and select yes, but if you do not have a real time kernel you may have to turn this setting off in Jack later (see video).

To follow along with the tutorial you will need a midi file and some sound fonts that you can download from the following websites:

Download midi files here: http://free.mididb.com/ , http://www.free-midi.org/
Download sound fonts here: http://www.hammersound.net/ , http://www.soundfonts.it/?a=soundfonts
Ray has some midi files and sound fonts that you can download from his website: http://trueeclectic.com
Tutorial Videos

In this video, we install audio applications that we will be using

In this video, we get Jack running and open a midi file in Muse

In this part, we output sound to Ardour and save a sound file

Using Audacity we export the sound file as an mp3

gzip, bzip2, 7zip, and tar

Overview

File compression, management and backup are important skills to have no matter your level of expertise. Some of the older compression tools are compress, gzip, bzip2. 7zip is a newer tool that will compress folders as well as files and it has a higher compression ratio. Tar is an archive backup utility that will compress files also. Tar is useful and necessary if you want to compress a folder. Typically you would make a tar file first and then compress it with gzip or bzip2. A tar file that is compressed typically has a .tar.gz or .tgz file extension and are referred to as “tarballs”.

gzip – file compression utility, makes .gz compressed files
bzip2 – file compression utility, makes .bz2 compresses files
7zip – file and folder compression utility, makes .7z files
tar – archive as well as file and folder compression utility, makes .tar and .tar.gz and .tar.bz2 files

Exercise

This is a step-by-step tutorial that will walk you through some standard Linux commands and utilities. In this walk through we will cover gzip, bzip2, 7zip, tar, and make in order to manually install a program.

  1. This walk though is done completely from the terminal command line. You can do a Ctrl+Alt+F2 to switch to TTY2 terminal mode (non-graphical) or go back to graphical mode (Ctrl+Alt+F7) and open a terminal.
  2. Services are programs that work across networks and map to certain port numbers. To see a listing of locally known services mapped to their known port numbers type in this command which will output the file to the terminal piped to more to see one screen at a time (press spacebar):
    cat /etc/services | more
  3. We will use a copy of the services file to practice using compressing and decompressing utility programs. Copy your services file to your home directory and make a notation of how many kilobytes the services file is. In the terminal type in the following commands:
    cp /etc/services ~
    ls -l
  4. To compress the file use gzip in verbose mode. Afterward, do a “ls -l” and you should see a file called services.gz and its size should be 60% of the original services file size.
    gzip -v services
    ls -l
  5. Now decompress the services.gz file by using gunzip (Note: if you try to decompress a file to a file name that already exists you will be prompted for permission to overwrite the file).
    gunzip -v services.gz
  6. You can also try a different compression utility like bzip2. Type in this command followed by a ls -l to check the file size. What file extension does a file compressed with bzip2 have? Which utility had a greater compression ration gzip or bzip2?
    bzip2 -v services
    ls -l
  7. Now decompress the file using bunzip2 (Note: if you try to decompress a file to a file name that already exists you will be prompted for permission to overwrite the file).
    bunzip2 -v services.bz2
  8. In addition to compressing files we can grab screen output and save and compress it to a file all in one command. For instance, if we wanted to see a list of all the processes (programs and daemons) currently running on our system. We could type in the following ps command piped (|) to more to see one screen at a time:
    ps -ef | more
    If you want to put that screen output into a file all in one command type in the following command which runs a “ps” piped to a “gzip” and output to a file using the standard output character > operator
    ps -ef | gzip -v > processes.gz
  9. Now decompress and view the file one screen at a time (Note: if you try to decompress a file to a file name that already exists you will be prompted for permission to overwrite the file):
    gunzip -v processes.gz
    cat processes | more
  10. Currently, the 7zip utility is supposed to have a great compression ratio. Lets give it a try. Type in the following command to install 7zip:
    sudo apt-get install p7zip-full
  11. Now you will run 7zip on the processes file. First run a ls -l to verify that there is in fact a file called processes and it is not still compressed in the .gz format. If you have the file present in the directory your can run 7zip on it by using the following command:
    7z a processes.7z processes
    Command breakdown:
    7z a (“a” adds to to an archive),
    processes.7z (the ouput file compressed),
    processes (the file or directory to compress)
  12. Do an “ls -l” command and you will see that the processes.7z file is signicantly smaller than the previous gzip and bzip2 versions.
  13. To extract in 7zip use the “x” function instead of the “a”. Use the following example (Note: if you try to decompress a file to a file name that already exists you will be prompted for permission to overwrite the file):
    7z x processes.7z
    or
    7z x processes.7z /home/your-username/name-of-the-decompressed-file
  14. To make a tar file out of the processes file you could type in the following command with the new file output name listed before the file to be used:
    tar -cvf processes.tar processes
    tar -xvf processes.tar (will extract the archive)
    The creation of the .tar file above is useful in that it is a backup of the original file, but it is not compressed. To do the same process and include gzip compression use the following command and the result will be a .tar.gz file:
    tar -zcvf processes.tar.gz processes
    tar -zxvf processes.tar.gz (will extract and and decompress the archive)
    The creation of the .tar.gz file is more useful in that it was also compressed. It is even more useful to use the tar utility to compress and entire folder:
    tar -cvf myHomeDir.tar *  (will archive every file in the current directory to an archive called “myHomeDir.tar”)
    tar -zcvf myHomeDir.tar.gz *  (will archive and compress every file in the current directory to an archive called “myHomeDir.tar”)
    Since I am in my home directory I can also tar a folder like my “Downloads” folder:
    tar -zcvf Downloads.tar.gz Downloads
    Now you should have a compressed archive called Downloads.tar.gz in your Home directory. To extract and decompress it to a folder called test use the following commands:
    mkdir test
    cd test
    tar -zxvf ../Downloads.tar.gz
  15. Congratulations! you have now used gzip, bzip2, 7zip and tar.

Install and Configure Samba in Ubuntu

Overview

Samba is a file and print server that you can install on a Linux distribution like Ubuntu. It is useful for sharing files, folders, and printers with Windows users over a local network. In this lab, the goal is to install Samba in Linux, set up a shared folder and text file, and from a different computer running Windows workgroup, connect to the Samba share and access the shared folder and file. The lab is complete when you have open the shared file, added some text like “hello” and saved the file.

Installation and Configuration

To install Samba in Ubuntu, I followed the instructions on this website: https://help.ubuntu.com/10.04/serverguide/C/samba-fileserver.html

Open a terminal and put in the following commands (in the examples, “sudo” is used for root privileges):

  1. Update your repositories:
        sudo apt-get update
  2. Install with apt:
        sudo apt-get install samba
  3. Open the samba configuration file smb.conf. In this example I use the gedit text editor and I background the process with “&” so I can continue to use my terminal without having to close the text file first:
        sudo gedit /etc/samba/smb.conf &
  4. In the Global Settings section of the configuration file, change or verify the following lines:
    workgroup = WORKGROUP
    and in the Authentication section, change or verify the following lines:
    security = user
    I chose “WORKGROUP” because it is the default workgroup name in Windows.
  5. At the bottom on the configuration file add the following lines then save the file:
      [share]
    comment = Ubuntu File Server Share
    path = /srv/samba/share
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755
    The path is the path to the shared folder, browsable allows the share to be visible to Windows explorer users, guest ok allows a user to access the share without supplying a password, create mask sets the permissions for everything created within the share.
  6. Now you need to create the directory folder to use as a share and change the owner and group:
        sudo mkdir -p /srv/samba/share
    sudo chown nobody.nogroup /srv/samba/share
  7. You can also create a sample text file in your shared folder to practice sharing to windows:
        sudo touch /srv/samba/share/test.txt
  8. Now restart samba:
        sudo restart smbd
        sudo restart nmbd (If you have nmbd failure, I found a temporary hack, see the bottom of this page)
  9. Now restart smbd and nmbd and it should work (after restarting if nmbd still does not work try restarting Ubuntu):
        sudo restart smbd
    sudo restart nmbd

  10. Now that you have Samba up and running go to another computer on your network that is running Windows and look for the share. Try the following steps and methods for locating your network share on Windows:
    1. open a folder (File Explorer) and type the IP address of the Samba server computer in the address bar (e.g.: \\192.168.1.100) and hit enter. If you are asked for a username and password, skip ahead to number 5.
    2. or, go to the Network and Sharing Center
    3. on the left hand side of the window click on “View computers and devices”
    4. if you are prompted by a drop down box, turn on “Network Discovery and File Sharing” for all public networks
    5. I had to put in my username and password like this:
      <username>@<computer-name>
      In my case it was:
      dan@dan-VirtualBox
      If you are unsure, open a terminal in you Linux machine and the prompt will be your user name + @ + your computer name.
    6. once authenticated you should have access to the file shares and shared printers that you created and configured in Samba.
    In this image, you can see the “Network and Sharing Center” window, the “View Computers and devices”
    window, as well as my Samba share “DAN-VIRTUALBOX”, and a window with a shared text file


Video Tutorial

 


***Troubleshooting note:

  1. If you notice that nmbd is failing… This bug seems to be a recent occurrence in Ubuntu 10. Here is a temporary hack that I found on a separate website blog. Open the nmbd.conf file in gedit:
        sudo gedit /etc/init/nmbd.conf &
    Comment out the following lines in the nmbd.conf file by adding a “#” at the beginning of the line like this:
        #          NMBD_DISABLED=`testparm -s –paramenter-name=’disable netbios’  2>/dev/null`
    #          [   “x$NMBD_DISABLED” = xYes  ]  &&  {  stop; exit 0;  }

 

 

Create a Virtual Router Firewall with Endian UTM

Virtual Router/Firewall with Endian UTM – Overview

The Endian UTM firewall/router is a custom security distribution of Linux created by Endian.com. Endian releases a free, community edition of their Endian UTM (unified threat management system) which can be implemented on a home network or small office environment. The community edition of Endian is also a great way to learn about network security.

Go to their website at Endian.com and download the .iso image file of the community edition distribution. You can now install the Endian UTM community edition on home computer hardware. I recommend using a computer with two Ethernet network interfaces, or you could install it in a virtual machine which gives you a dedicated security device to practice with virtually.

Unified threat management systems or advanced Firewalls have many security tools to play with. It is important to know how to configure port forwarding, static routing, NAT, VPN, Web proxy filtering, DHCP and more. In this lab, you will use Virtualbox and Endian Firewall to create a virtual network firewall and router device that you can use to run network simulation tests.

Install Endian Firewall in Virtualbox – Video Tutorial

In this video I use Virtualbox to install Endian Firewall (EFW) in a virtual machine

EFW initial installation configuration

Configure internal and bridged network interfaces for the virtual firewall

Configure DHCP services on the virtual router for virtual clients to connect to

Install & Configure Squid in Ubuntu

Squid in Ubuntu Overview

A proxy server is a very useful tool for a network. It is commonly used in computer networks to protect the network from attack, to filter nefarious web content and pages requested by local users, and to speed up the delivery of web pages and web content by caching (storing) commonly requested web pages, documents, and media. Proxy servers are typically implemented on private, local area networks, to filter, protect and cache content requested by users on that network, this is called “proxy” or “transparent proxy.” Proxy servers can also be implemented on the remote side “in-front-of” destination webservers in order to protect those servers by filtering requests, speeding up web page delivery, and caching frequently requested files, this is called “reverse proxy.”

Types of Proxy Servers

Proxy Server The web browser on the client is configured to point to the proxy server’s IP address. The client can bypass the proxy server by removing or altering the proxy address configuration. An administrator could prevent this by creating a GPO in Active Directory that blocks access to the web browser settings. A proxy server can also function as a caching server.
Transparent Proxy Server The router sends all traffic on defined ports, to the transparent proxy server, this way clients cannot bypass the proxy server. A transparent proxy server can also function as a caching server.
Reverse Proxy Server (Cache) The reverse proxy server or cache server is placed in-front-of or prior-to the web server in order to speed up delivery of frequently requested pages and to protect the web server by creating a layer of separation and redundancy.

Squid is one of the most popular and most used proxy servers in the world. It is free to download, easy to install and it can be implemented on any distribution of Linux. Here are the steps to install and configure Squid on an Ubuntu distribution of Linux.

Steps to install and configure Squid

Open a terminal, and type in the following commands to install Squid
 sudo apt-get update
sudo apt-get install squid squid-common

Ways to start and stop Squid
 sudo service squid start (stop|restart|status)
sudo /usr/sbin/squid (launch program directly)
sudo pkill -9 squid

Navigate to the Squid folder to find the squid.conf configuration file
 cd /etc/squid
ls (you should see the squid.conf file)

Create a backup of the squid.conf file
 sudo cp squid.conf squid.conf.bak

For testing purposes open Firefox and set it to send web requests to the Squid Proxy Server (You will need to know your ip address)
 ifconfig (write down your inet address e.g. 192.168.1.100)
Open Firefox
Edit > Preferences, Advanced > Network Tab > Connection-Settings:
Manual Proxy Configuration:
HTTP Proxy: your IP address or loopback address 127.0.0.1,    Port: 3128
     Click Ok and Close
Now if you try and go to a website like google you should see an ERROR – Access Denied message from Squid (see bottom line). This means that Squid is working by actively denying the traffic.

Now we need to configure Squid to allow web traffic through the proxy server. Open squid.conf in your favorite text editor like gedit, nano, or vi
 sudo nano squid.conf
or
 sudo gedit squid.conf & (If gedit does not open from the terminal you can open it as root user)
sudo su
gedit squid.conf &

To switch out of root user
 su your-username (if you are root user the prompt is a “#” switch back to your user account privilege)

If you chose to open with squid.conf with gedit, then turn on line numbering (Edit > Preferences > View >Display Line Numbers)

Change the name of your Squid Proxy Server, around line 3399, change:
 #    TAG: visible_hostname
to
 visible_hostname YourNameProxyServer  

You can configure access rules for your Squid proxy server (lines 331 to 831 are for Access Control). Notice that on lines 606 to 630 the local networks and usable ports (services) are defined. Active configuration lines, are the lines that are not commented out, i.e. they do not start with  a # sign.

To re-enable web access uncomment line 676
 #http_access allow localnet
to
 http_access allow localnet

To verify the Web is now working, save your changes to the squid.conf file and restart your Squid server.
 service squid restart (or “sudo service squid restart” if you are no longer root)

Now resfresh your Firefox web browser and your homepage should be visible.

Now we can practice writing a custom ACL (access list) in the squid.conf file to block specific domains and websites. We can write our custom ACL at the end of the acl lines around line 631. From an empty line write the following lines to test domain blocking:
 acl blocked_websites dstdomain .msn.com .yahoo.com
http_access deny blocked_websites

Now restart your Squid server, and test to see if Squid denies access to your blocked domains/websites in Firefox.

Video Tutorials

In this series of videos, I go through the same process outlined above, to install and configure a Squid proxy server in Ubuntu .

In part 1, I install Squid in Ubuntu, start and stop it, backup the configuration file,
and configure Firefox to use Squid as a proxy server

In part 2, I discuss editing the configuration file

In part 3, I write a custom ACL in the squid.conf file

Copy One Drive to Another Using the dd Command in Ubuntu

Overview

The dd command is a useful tool for copying one entire hard drive to another. This can be helpful if you want to move your entire computer system to a new hard drive. The trick is making sure you know which drive you are copying from and which drive you are copying to. There is no recovering your data if you accidentally copy an empty drive to your system drive. It will overwrite all your information.

Step by Step Process

Here are some commands and tools that you will want to use:

  • df -h  (this will show you your drives and the disk free space)
  • sudo apt-get install smartmontools  (install smartctl)
  • sudo apt-get install gparted  (install GParted)
  • sudo smartctl –all /dev/sda
  • sudo dd if=/dev/sdb of=/dev/sdc (important: sdb and sdc are examples you will need to know what your specific drives are

Video Tutorial

Here is a tutorial demonstrating the process: