Categories
Linux shell

Alsa CLI Volume control

I couldn’t find the silly volume control in the system settings one day so i figured there had to be something I could use to control volume settings like mic boost without needing a gui or remembering names and numbers for the CLI. well there is and it’s so easy a caveman could do it (hah remember those ads….)…. so without further ado here’s a fun and great way to control your volume via Alsa CLI Volume control.

type the following then use your arrows to move right/left and make the volume higher or lower by using up/down keys:

alsamixer -c 0

the 0 at the end is the number of your device. if a system only has one device you will use 0. if you have two devices you can use 0 or 1. it tells you the name of the device currently being edited so you don’t give yourself a heart attack by changing the wrong volume. picture of the control is attached.

 
[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”] [/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Categories
General Linux

Ubuntu 16.04 release changes & info

Ubuntu 16.04, code-named “Xenial Xerus“, is here and its amazing! many new changes, many new additions and some removals of old outdated software/functionality. Unity has been polished and streamlined along with the much maligned ads have been removed! so lets get into the details.

Snap Packages

Ubuntu 16.04 LTS introduces a new application format, the ‘snap’, which can be installed alongside traditional deb packages. These two packaging formats live comfortably next to one another and enable Ubuntu to maintain its existing processes for development and updates. In short you can now install third party apps or who desktop environments without having to worry about polluting your OS! Everything stays confined away from the rest of the system in a nice little self contained environment yet still allows access to the rest of the system. So you have

  • Apps can install with their own specific set of libraries and dependencies without issues with other existing apps or ones you may install in the future.
  • Safety & security are bolstered across the board.

Packages

As with any ubuntu upgrade there are many package upgrades and software changes.

  • Ubuntu now defaults to kernel 4.4+
  • python2 is out and python 3.5 is now the base. you can still install python 2 but python 3 is the new norm. Vim by default now uses python 3.
  • Golang is now using th 1.6 toolchain.
  • With the recent discoveries in vulnerable crypto settings in openssh, the new base OpenSSH 7.2p2 disables many to bolster security.
  • the GNU toolchain is now updated to latest version of many tools.

ZFS

“Controversy ahoy Cap’n!” ZFS is now included with ubuntu and how happy are we all to see it so. ZFS is a pretty cool piece of tech that is a mix of a volume manager and a filesystem. So think of LVM and EXT4 having a nerdy baby! lots of distros have supported ZFs before but not usually out of the box, almost all required installed software/libraries or using fuse, which comes with its own overhead. Find out more about Ubuntu 16.04 support for ZFS here.

Unity

Many of us are waiting for Unity 8 which brings with it a slew of changes such as Convergance which allows unity to handle both desktop and mobile environments and interfaces. However that day is not yet here. We are getting a polished, cleaned up unity 7.4 which comes with many changes.

  • The online search ads based on your search results are gone! dead! goodbye!
  • the launcher can be moved to the bottom of the screen.
  • Ubuntu software center is gone! replaced by Gnome software center
  • Empathy IM is gone.
  • Improved launcher integration with file manager and devices
  • Support for formatting removable devices from quicklist
  • Improved support for gtk applications using headerbars
  • Improvements to the switcher and spread backends
  • App spread shortcut is now Super+Ctrl+W
  • Unity control center option to always show menus
  • Improvements to GNOME key grabbing
  • New dash overlay scrollbars
  • Better Dash theming support
  • Improved Support for HiDPI environments
  • Show icons launching state in launcher when apps launched elsewhere

All in all Ubuntu 16.04 Xenial Xerus is a must have version of Ubuntu. Check below to download it.

Click here to download directly as ISO via HTTP from Canonical : [button link=”http://releases.ubuntu.com/16.04/” color=”orange” newwindow=”yes”] Click to download Xenial Xerus[/button]

Categories
Linux shell

Linux distribution info & kernel info

Do you have multiple vms and real machines you use for random testing, and small tasks? need to know what machine you are on? what kernel you are using? what the current Linux distribution info is? what OS version did you last install on here? and more such questions? well! we have some of the answers for you. well maybe not answers, but more like small tools so you can get the answers!

Distribution info

lsb_release -a
on my ubuntu system it gives the following result :

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Xenial Xerus (development branch)
Release: 16.04
Codename: xenial

On a debian system it gives the following result :

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.4 (jessie)
Release: 8.4
Codename: jessie

If lsb_release -a doesn’t cut it for you then you can try
cat /etc/issue

as a result we see the following examples :

# cat /etc/issue
Debian GNU/Linux 8 \n \l

$ cat /etc/issue
Ubuntu Xenial Xerus (development branch) \n \l

In some cases where you suspect you are on centos or redhat, maybe because you noticed the package versions are old enough to be used by columbus while sailing the open seas, then you can use either

cat /etc/centos-release

or

cat /etc/redhat-release

which will give you result such as :

CentOS release 6.2 (Final)

Kernel Info

now as far as finding the kernel info goes you can get all the info you need via uname.

$ uname -a
Linux testhost 4.4.0-9-generic #24-Ubuntu SMP Mon Feb 29 19:33:19 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ uname -r
4.4.0-9-generic

as you can see uname -r gives you just the kernel version and uname -a gives you multiple pieces of info, like date the kernel was compiled, the arch (i.e. x86_64).

Categories
General Linux nginx shell

Letsencrypt ssl cert for mumble

I needed to set up a mumble server for a friends minecraft community. The Mumble software uses a client–server architecture which allows users to talk to each other via the same server. It has a very simple administrative interface and features high sound quality and low latency where possible. All communication is encrypted to make sure user privacy using either a self signed cert or a cert purchased via a vendor. The great thing about Mumble is that it’s free and open-source software, is cross-platform, and is released under the terms of the new BSD license. Since letsencrypt is awesome and provides completely free certs to the end users, I figured it would be perfect to use in this attempt.  So I started on the road to acquire a letsencrypt ssl cert for mumble.

First we need to acquire the letsencrypt client. for this you need git.

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
./letsencrypt-auto certonly --standalone --standalone-supported-challenges tls-sni-01

A text / curses bases dialogue will start. it will ask you to input your domain(s) you want a cert for. If you want multiple domains or multiple subdomains at the same time just separate them via a space or a comma, follow the prompts and it will install your cert in /etc/letsencrypt/live/<domain>/cert.pem. So far so good! now you need to install murmur/mumble-server on your machine. I would like to tell you how to do it but due to the nature of software it might change, the best way to do it is via checking the official mumble wiki for info on how to do it for your OS. To do it in Ubuntu I used the following commands

sudo add-apt-repository ppa:mumble/release
sudo apt-get update
sudo apt-get install mumble-server
sudo dpkg-reconfigure mumble-server

Now lets setup the mumble server to use the certs we acquired earlier.  Edit /etc/mumble-server.ini , I prefer using nano but it’s because I am a pleb, you may be a super 1337 operator and use vi or vim or directly edit the 1’s and 0’s on the drive platters. Find the following keys and edit them or add if they don’t exist or are commented out.

sslCert=/etc/letsencrypt/live/<domain>/cert.pem
sslKey=/etc/letsencrypt/live/<domain>/privkey.pem
sslCA=/etc/letsencrypt/live/<domain>/fullchain.pem

the sslCA may not exist, thats fine, this allows all mumble clients to accept the cert from LE. One last issue you need to resolve before you can start mumble-server is the ssl cert is root only access at the moment. the way I resolved this is to change the group on the files and folders. you may have a better solution, please do share it in the comments.

chgrp -R ssl-cert /etc/letsencrypt
chmod -R g=rX /etc/letsencrypt

now start mumble-server with a service mumble-server restart or whatever your OS accepts, and Voila! you are now up and running using a valid letsencrypt ssl cert for mumble 🙂 if you have any questions, or comments, or better way of doing this please let me know.

 

Categories
Linux

Linux HP Smart Array Raid Controller

A client has a machine in a DC that has a raid controller and 4 hdd’s set to raid 10, that’s all I was told. I wanted to keep an eye on the hdds, so I needed to install a utility that can monitor and interact with the raid controller.  In my case I have the hp smart array raid controller as you will see in just a bit, you may have a different controller from this one by a different manufacturer, or it may require a different version of the software tool from HP, please check on the HP site linked below before continuing on. There is a chance of serious data loss if you don’t follow common sense practices and MAKE BACKUPS. I needed to do a few things, find out which controller is it, find latest of control utility for it, install said utility and then check on the drives. that isnt always easy, sadly.

First we check who makes this system.
dmidecode | grep -A3 ‘^System Information’
Sample result:

System Information
Manufacturer: HP
Product Name: ProLiant DL160 G6
Version:

Second we check lspci to see what controller we have installed.
lspci -k|grep -i -A2 raid
Sample Result :

04:00.0 RAID bus controller: Hewlett-Packard Company Smart Array G6 controllers (rev 01)
Subsystem: Hewlett-Packard Company Smart Array P410
Kernel driver in use: hpsa

Now we know we have a HP machine, DL160 G6 to be exact in this case, and the exact rev of the card itself. We need to install the HP provided software for it.  The official HP software page for the information below is here.  However as its laid out, best of luck getting up and running quickly if you follow that page.

Get and install HP Keys. (Keys are in the following order: software release pre 2014, during 2014, and post 2014)

curl http://downloads.linux.hpe.com/SDR/hpPublicKey1024.pub | apt-key add -
curl http://downloads.linux.hpe.com/SDR/hpPublicKey2048.pub | apt-key add -
curl http://downloads.linux.hpe.com/SDR/hpPublicKey2048_key1.pub | apt-key add -

Add the HP repo (be sure to change the jessie to whatever your release is):

echo -e "deb http://downloads.linux.hpe.com/SDR/repo/mcp/ jessie/current non-free" > /etc/apt/sources.list.d/hpe.list

Then update sources and install package :

apt-get update && apt-get install hpssacli

Now you have the tools needed for the job! so run the utility

hpssacli

sample result:

HP Smart Storage Administrator CLI 2.10.14.0
Detecting Controllers…Done.
Type “help” for a list of supported commands.
Type “exit” to close the console.

=>

There are a few commands you can use on this CLI:

Show all config :

=> ctrl all show config

Smart Array P410 in Slot 4 (sn: PACCRID12290K57)
Internal Drive Cage at Port 1I, Box 1, OK
array A (SATA, Unused Space: 0 MB)
logicaldrive 1 (1.8 TB, RAID 1+0, OK)

physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SATA, 1 TB, OK)
physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SATA, 1 TB, OK)
physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SATA, 1 TB, OK)
physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SATA, 1 TB, OK)

SEP (Vendor ID PMCSIERA, Model SRC 8x6G) 250 (WWID: 5001438021BEED2F)

Show Status:

=> ctrl all show status

Smart Array P410 in Slot 4
Controller Status: OK
Cache Status: OK

View drive status (change slot # to thew one from show status command above):

=> ctrl slot=4 pd all show status

physicaldrive 1I:1:1 (port 1I:box 1:bay 1, 1 TB): OK
physicaldrive 1I:1:2 (port 1I:box 1:bay 2, 1 TB): OK
physicaldrive 1I:1:3 (port 1I:box 1:bay 3, 1 TB): OK
physicaldrive 1I:1:4 (port 1I:box 1:bay 4, 1 TB): OK

If you get an error like the following you are using the wrong slot number, just run ctrl all show status and use the proper slot number:

ctrl slot=0 pd all show status

Error: The controller identified by “slot=0” was not detected.

View each individual drive and its info :

ctrl slot=4 pd 1I:1:4 show detail

Smart Array P410 in Slot 4

array A

physicaldrive 1I:1:4
Port: 1I
Box: 1
Bay: 4
Status: OK
Drive Type: Data Drive
Interface Type: SATA
Size: 1 TB
Native Block Size: 512
Rotational Speed: 7200
Firmware Revision: HPG2
Serial Number: Z1N3S3ZS
Model: ATA MB1000CBZQE
SATA NCQ Capable: True
SATA NCQ Enabled: True
Current Temperature (C): 28
Maximum Temperature (C): 51
PHY Count: 1
PHY Transfer Rate: 1.5Gbps

Show all logical drives:

ctrl slot=4 ld all show

Smart Array P410 in Slot 4

array A

logicaldrive 1 (1.8 TB, RAID 1+0, OK)

Hope this helps some of you out as it took me a little bit to get all the information together for my setup, so I’m storing it here for future usage 🙂

 

 

Categories
Linux Virtualization

Proxmox IP bridge for single public IP

 

I just setup a test copy of proxmox 4.1 and realized I only had one IP attached to the box. So I had to set up a bridge and forward ports to the internal IPs. So the basic idea is, we are going to set up a new virtual interface bridge in your networking file. This requires a working proxmox machine up and running. I am using a standard install, no changes made to the network prior to this.

Proxmox Desired Network Layout

External IP ————————- proxmox server as NAT ————————— Internal IP

1.2.3.4 ————————- 1.2.3.4 NAT 10.0.0.10 ————————-10.0.0.10

 

Current network Layout

when we check /etc/network/interfaces we see the following :

# The loopback network interface
auto lo
iface lo inet loopback

# for Routing
auto vmbr1
iface vmbr1 inet manual
        post-up /etc/pve/kvm-networking.sh
        bridge_ports dummy0
        bridge_stp off
        bridge_fd 0


# vmbr0: Bridging. Make sure to use only MAC adresses that were assigned to you.
auto vmbr0
iface vmbr0 inet static
        address 1.2.3.4
        netmask 255.255.255.0
        network 1.2.3.0
        broadcast 1.2.3.255
        gateway 1.2.3.254
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0

iface vmbr0 inet6 static
        address 1:2:3:4::5
        netmask 64
        post-up /sbin/ip -f inet6 route add 1:2:3:4:ff:ff:ff:ff dev vmbr0
        post-up /sbin/ip -f inet6 route add default via 1:2:3:4:ff:ff:ff:ff
        pre-down /sbin/ip -f inet6 route del default via 1:2:3:4:ff:ff:ff:ff
        pre-down /sbin/ip -f inet6 route del 1:2:3:4:ff:ff:ff:ff dev vmbr0

As you can see above we have a working interfaces file just with pseudo IPs instead of real ones. yours will of course have your own IP. Also, you may not have an inet6 section.

The actual Proxmox IP bridge part

I added a new bridge interface to it like so :

auto vmbr10
iface vmbr10 inet static
    address 10.0.0.254
    netmask 255.255.255.0
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 12022 -j DNAT --to 10.0.0.2:22
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 12022 -j DNAT --to 10.0.0.2:22
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 12080 -j DNAT --to 10.0.0.2:80
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 12080 -j DNAT --to 10.0.0.2:80

Ok so lets break it down, line by line :

automatically start vmbr10
interface vmbr10 is a network interface with static IP
the address for the proxmox main server on this interface is 10.0.0.254
netmast is 255.255.255.0
Dont bind any ports
disable the spanning tree protocol **
disable delayed forwarding or no delay on forwarding
Allow IP traffic forwarding once networking i up and running after a boot
Add IP masquerading on networking online ***
disable masquerading on networking offline
Enable routing all packets on port 12022 from public to port 22 on private subnet to machine 10.0.0.2 on networking up
Disable routing all packets on port 12022 from public to port 22 on private subnet to machine 10.0.0.2 on networking down
Enable routing all packets on port 12080 from public to port 80 on private subnet to machine 10.0.0.2 on networking up
Disable routing all packets on port 12080 from public to port 80 on private subnet to machine 10.0.0.2 on networking down

 

Now as you can see above you have a basic bridge and you are forwarding specific ports to internal ports on the VMs. you can forward more ports by copying the last two lines and changing the ports or to different VMs by changing the IPs. also vmbr10 is a random number and can be changed at will. after all is done simply reboot the machine and you are up and running. you can restart networking or ifup vmbr10 if you want but I prefer a clean boot to test the new networking. this should give you a working Proxmox IP bridge 🙂

 

let me know if I messed up anything or how you dealt with this situation.

 

** The Spanning Tree Protocol (STP) is an older network protocol that ensures a loop-free topology for any bridged Ethernet local area network. The basic function of STP is to prevent bridge loops and the broadcast radiation that results from them. more info here.

*** IP Masquerade is a networking function in Linux similar to the one-to-many (1:Many) NAT (Network Address Translation) servers found in many commercial firewalls and network routers. For example, if a Linux host is connected to the Internet via PPP, Ethernet, etc., the IP Masquerade feature allows other “internal” computers connected to this Linux box (via PPP, Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows for this functionality even though these internal machines don’t have an officially assigned IP address. more info here