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 shell

linux shell argument list too long rsync or cp

I needed to copy files generated by doxygen from one directory into another for a large opensource C++ project. Sadly there were too many files in the directory, so bash started complaining 🙁 cp and rsync died out with the error of argument list too long. initially I figured I could generate it all from scratch in new location but it was quicker and easier to use a for loop to rsync the files over 🙂

some info:

  • all files start with alphabetic characters.
  • there are no spaces in the names
  • all files are in single directory

I realized bash expansion would work here.

Using for loop

for x in {a..b}
do
    echo $x*
done

Notice I only stepped between A and B because I didn’t want to sit there for an hour while it listed all the files. this worked well, it listed all files and I was sure it would suite my purposes. now the real deal!

for x in {a..z}
do
echo $x
rsync -az /backups/doxygen/$x* /home/user/current/directory/
done

sometimes you might still get the error even for each letter, for example I still had too many files starting with D and Q. so I just changed where I globbed :

for x in {a..z}
do
echo $x
rsync -az /backups/doxygen/d$x* /home/user/current/directory/
done

this allows me to further iterate a thru z but after starting the files with the letter d. Now what happens if you happen to have files starting with numbers? simply switch the letters for numbers.

for x in {0..9}
do
echo $x
rsync -az /backups/doxygen/$x* /home/user/current/directory/
done

You can use any other command you need in place of rsync. like mv cp mkdir or any custom commands.

for x in {a..z}
do
echo $x
mv /backups/doxygen/$x* /home/user/current/directory/
done

Globbing

Now if you don’t want to use for loops you can glob them in a one liner like so :

ls /backups/doxygen/[x-z]*

and the actual command using cp and globbing

cp -r /backups/doxygen/[a-z]* /home/user/current/directory/

and again going a level deeper

cp -r /backups/doxygen/d[a-z]* /home/user/current/directory/

Voila! argument list too long is now vanquished! do any of you have a better way of dealing with this? let me know!

More info about globbing.

Categories
Android shell

Mount HTC one M8 system partition as read write

HTC one M8So why cant you write to system partition on HTC devices even after rooting? it’s because they are S-ON by default. which means that neither can you access certain areas of the system nor can you guarantee a permanent root. S-OFF means that the NAND part of the device is unlocked and can be written to. S-ON also has some other restrictions like image signatures etc. to make an end run around the S-ON problems, you can temporarily mount your system partition as read/write by running the following commands via ADB. or just the last two lines in terminal emulator on the device itself.

 

adb shell
su
mount -o rw,remount -t ext4 /dev/block/mmcblk0p45 /system

 

Categories
Linux shell tuts

Find out whats taking up all the hdd space

[et_pb_section admin_label=”Section” fullwidth=”on” specialty=”off”][et_pb_fullwidth_post_title admin_label=”Fullwidth Post Title” title=”on” meta=”on” author=”off” date=”on” categories=”on” comments=”off” featured_image=”on” featured_placement=”background” parallax_effect=”off” parallax_method=”on” text_orientation=”center” text_color=”dark” text_background=”on” text_bg_color=”rgba(255,255,255,0.9)” module_bg_color=”rgba(255,255,255,0)” title_all_caps=”off” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

[/et_pb_fullwidth_post_title][/et_pb_section][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”]

Running out of hdd space is pretty annoying. So if you are running out of space and need to find out whats taking up all that space type the following command to find out more :

du -h  |grep '[0-9]G'

 

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

[/et_pb_text][et_pb_divider admin_label=”Divider” color=”#ffffff” show_divider=”off” divider_style=”solid” divider_position=”top” hide_on_mobile=”on”]

[/et_pb_divider][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

[jetpack-related-posts]

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Categories
Linux shell

Start Xvfb on boot on Centos Linux

XVFB

Xvfb or X virtual framebuffer

X virtual framebuffer is a display server using the X11 protocol. In contrast to other display servers, it performs all graphical operations in memory without showing any screen output. which makes it ideal for some surprising uses. e.g.

Xvfb :1 &
xv -display :1 &
import -display :1 -window root image.png

(above snippet via Wikipedia)

I had to run xvfb automatically on boot on a centos system, here’s the init script I used to carry out the task. add the following as a script to /etc/init.d , chmod +x the script then chkconfig xvfb on

* Note: see the :11 in the middle of the script? change that to another number to change the display port.

   #!/bin/bash
   # chkconfig: 345 95 50
   # description: Starts xvfb on display 11
   # why 11? dunno I just work here. :( -FB
   # 9/30/13 r1 - initial addition -FB

   if [ -z "$1" ]; then
   echo "`basename $0` {start|stop}"
       exit
   fi

   case "$1" in
   start)
       /usr/bin/Xvfb :11 &
   ;;

   stop)
       killall Xvfb
   ;;
   esac

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

[/et_pb_text][et_pb_divider admin_label=”Divider” color=”#ffffff” show_divider=”off” divider_style=”solid” divider_position=”top” hide_on_mobile=”on”] [/et_pb_divider][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

[jetpack-related-posts]

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Categories
shell Windows

Windows clean up multiple partitions via CLI

I had to install a new copy of windows, sadly the USB drive at hand had about 11 small partitions on it due to some earlier work. When I tried formatting it, it formatted only one part of it and was annoying in general… when I checked disk management, I was only able to delete a few of the small partitions. Heres how I did it via CLI / cmd line.

DISKPART
LIST DISK

see which one is your disk, such as mine was the last on the list since I had just plugged it in, make sure to match up the size etc also i.e. this will erase your disk so be very very careful. then run the following command substituting 10 for whatever your disk # is:

select disk 10
clean

then exit and exit again. voilà.