Wednesday, July 29, 2015

Using veracrypt on Ubuntu 14.04 LTS

Since we have become aware of the security concerns surrounding the Truecrypt project, veracrypt has taken its place as one of the most trusted encrypting solutions. Here is a brief guide on how to get it intalled and running under Ubuntu Linux.

Installation

Go to the official VeraCrypt website at https://veracrypt.codeplex.com/ and click on the "Downloads" tab.

There you will find the appropriate Linux download option

VeraCrypt Linux Setup 1.0f-2 (version will change in the future)

Once downloaded unpack it and you should see 4 different files to chose from. If you are running a 32-bit install you will want to use the x86 option while the x64 file will be the one to use if you are on a 64-bit ubuntu installation. If you are new to Veracrypt I would  recommend installing the GUI option (I believe this option even installs the commandline option as well)

$ /home/your_user_name/Desktop/veracrypt-1.0f-2-setup-gui-x86

This can be done by dragging and dropping the file from nautilus directly into a terminal screen which will cause it to show the path to the installation file with quotes around it. Simply remove the quotes and run the file.

The install should be fairly quick and you will be prompted for your admin password. Once that's done you should be able to find Veracrypt on your system.

Encrypting your files

In order to actually encrypt your files, Click "Create Volume" and follow the wizard.

I recommend creating an encrypted file container using "standard veracrypt volume". In terms of Encryption algorithm I usually go with "Twofish" and the hash algorithm "Whirlpool". Chose what size your volume will have and then format it.

Once you have a volume created, find your file location (Select File...) and mount the drive in the selected slot from the list shown. This should prompt you for your password. Once that's done you should see the mounted drive for your use.





Thursday, July 23, 2015

Terraria under Ubuntu 14.04 - crash upon map loading

I just installed the beta version of Terraria for linux which just came out. I'm very happy the developers decided to make a linux port for this game. Of course the port is full of bugs and we're supposed to be reporting these bugs. Except I can't post my issue at the terraria forums right now (I'm not exactly sure why). So instead I'll post it here in case it can help someone in any way.

I just ran steam off of the command line, where you can open steam by going to

~/.steam/bin32/steam

and running

$ steam

from there you should be prompted to enter your credentials. From this point on just open another console window and go to

~/.steam/steam/SteamApps/common/Terraria

and run

$ ./Terraria

At this point I can basically start my game, I created my world and all looked OK. Once I tried to play it, the screen loaded for a second and then the game crashed. The following message was shown in the console:


Stacktrace:
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) object.wrapper_native_0x7fad18ede710 (Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,int,int,int,Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,intptr) <0xffffffff>
  at (wrapper delegate-invoke) <Module>.invoke_void__this___OpenGLDevice/GLenum_int_int_int_OpenGLDevice/GLenum_intptr (Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,int,int,int,Microsoft.Xna.Framework.Graphics.OpenGLDevice/GLenum,intptr) <0xffffffff>
  at Microsoft.Xna.Framework.Graphics.OpenGLDevice.DrawUserIndexedPrimitives (Microsoft.Xna.Framework.Graphics.PrimitiveType,intptr,int,int,intptr,int,Microsoft.Xna.Framework.Graphics.IndexElementSize,int) <0x00115>
  at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DoSpriteDraw (Microsoft.Xna.Framework.Graphics.PrimitiveType,int,int,System.Runtime.InteropServices.GCHandle,int) <0x00095>
  at Microsoft.Xna.Framework.Graphics.FastBatch.DrawBatch () <0x0022f>
  at Microsoft.Xna.Framework.Graphics.SpriteBatch.End () <0x00057>
  at Terraria.Main.DrawToMap () <0x00f57>
  at Terraria.Main.Draw (Microsoft.Xna.Framework.GameTime) <0x02767>
  at Microsoft.Xna.Framework.Game.Tick () <0x0056c>
  at Microsoft.Xna.Framework.SDL2_GamePlatform.RunLoop () <0x007bf>
  at Microsoft.Xna.Framework.Game.Run () <0x0010a>
  at Terraria.Program.LaunchGame (string[]) <0x00087>
  at Terraria.LinuxLaunch.Main (string[]) <0x00037>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
/home/zoah/.local/share/Steam/SteamApps/common/Terraria/lib64/libmonosgen-2.0.so.0(+0xcd18a) [0x7fad1f7eb18a]
/home/zoah/.local/share/Steam/SteamApps/common/Terraria/lib64/libmonosgen-2.0.so.0(+0x12ad1b) [0x7fad1f848d1b]
/home/zoah/.local/share/Steam/SteamApps/common/Terraria/lib64/libmonosgen-2.0.so.0(+0x38f46) [0x7fad1f756f46]
/lib/x86_64-linux-gnu/libc.so.6(+0x36d40) [0x7fad1f38fd40]
/usr/lib/fglrx/dri/fglrx_dri.so(+0x50d8c6) [0x7fad033c08c6]
/usr/lib/fglrx/dri/fglrx_dri.so(+0x5b344a) [0x7fad0346644a]
/usr/lib/fglrx/dri/fglrx_dri.so(+0x4b323a) [0x7fad0336623a]
/usr/lib/fglrx/dri/fglrx_dri.so(+0x5f57c8) [0x7fad034a87c8]
[0x40a43f0f]
Debug info from gdb:
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
./Terraria: line 20:  5073 Aborted                 (core dumped) ./${BASENAME}.bin.${ext} $@

Tuesday, March 3, 2015

Mutt - email from the command line

Since I started using linux on my work machine I have been looking for good CLi alternatives to things I need on a daily basis. I was given a work laptop and I run my Xubuntu install off of a VM on my Windows 7 machine. What that translates to is that I'm constantly running low on RAM and CPU, therefore anything I can do from the CLi makes my computer happier. For this reason I decided to try to add my email to something I can check off of the command line. It would save me a solid 200-250 Mb of memory that I don't need to be spending on an email client that mostly just pops up incoming msgs all day. So after looking around, it seems like Mutt is the popular choice for people checking their email on the CLi.

To be perfectly honest, I really only need my client to check my mail on occasion, and if I need to respond to an email, I don't even mind opening Thunderbird then, but I just don't like keeping it open all day. But here is what you do to get Mutt running on your debian based distro:

$ sudo apt-get install mutt

this will install mutt on your distro... from there I got a Postfix Configuration screen. There you should find some details about the different types of configurations available (Internet site, Internet with SMTP, etc). For my purposes I just skipped this part and left with no changes to configuration, I will deal with that post install.

To access the configuration file for mutt use your favorite text editor (such as vim, nano, etc) and open ~/.muttrc so for me I will run

$ sudo nano ~/.muttrc

there you can add the following information for your particular email

set imap_user = “usernam@gmail.com”
set imap_pass = “passwrd”

set smtp_url = “smtp://usernam@smtp.gmail.com:587/”
set smtp_pass = “passwrd”
set from = “usernam@gmail.com”
set realname = “My name”

set folder = “imaps://imap.gmail.com:993”
set spoolfile = “+INBOX”
set postponed=”+[Gmail]/Drafts”

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set move = no

I probably don't need to tsay it, but change it to the information relevant to your email account of course. Leave the password fields blank if you prefer, and that will cause mutt to prompt you for it which may be a bit of a safer option.

From here you will need to run the program by typing

$ mutt

From your inbox use your

up/down arrow keys - move through your inbox
PgUp/PgDwn - move quickly through your inbox
Enter - opens the msg

Once you open a msg use

space - scroll down the msg
'-' (minus) - scroll up the msg (unfortunately you don't use up/down for this)
i - returns to inbox (seems like q works as well, which seems more natural to me)

For more information on how to use Mutt, this post was very useful to me:

http://www.linuxuser.co.uk/tutorials/get-started-with-mutt/1

Tuesday, November 25, 2014

Command line RSS reader - newsbeuter

Since I started to play around with RSS feeds I've been looking for various ways to access these types of feeds. As I have been putting an effort in trying to use the CLi more often, I decided to try a command line RSS reader on my Ubuntu 14.04 install. Newsbeuter seemed to be a popular choice for people so I decided to try.

On Ubuntu the install can be done via the repository

$ sudo apt-get install newsbeuter

Once installed I imported the data from my feedly account by downloading the OPML file under the section "organize" (for some reason)

After placing the file in the newsbeuter folder, I ran the command

$ newsbeuter -i /home/username/.newsbeuter/feedly.opml

...to load my URLs from Feedly. Now run the program

$ newsbeuter



Thursday, October 2, 2014

BTSync - an alternative to cloud storage

For a while now, I have been concerned about my reliance on cloud services such as dropbox, evernote, google drive and Spider Oak. I have an active account with all of these services and more and more I worry about the fact that I have given so much of my data to these companies. I don't necessarily believe that these corporations are necessarily doing anything particularly evil with my data and I also don't upload anything terribly sensitive to the cloud. But in any case, that's not to say that quite a bit of the data I do put on the cloud I would still prefer to keep out of the public domain. For this reason I have started to look an alternative service, BitTorrent Sync.

For those unfamiliar with this system, it is basically a service developped by the folks that invented torrenting where you use a similar bit torrent protocol to sync data between different machines. The beauty of this system lies on the fact that all this data is stored locally in all machines involved and all data transfer is done in an encrypted manner. Meaning that you are not giving your data to anyone else, it stays withing all the machines sharing this data, and that's it. Not only that, but much like bit torrents, it can download this data in a really efficient way using direct connections to all machines involved. Lastly, one of the major advantages of this service over dropbox and others is the fact that there is no storage limits beyond how much you can store on your hard drive. Now, that's not to say that there isn't a downside of using this service. The downside is the fact that at least two machines need to be online for the data to successfully sync, so people like me that turn off their computers when they are not being used can't keep files updated all the time. For this reason I have devised a solution, which is to use my ubuntu server as a torrent sync server. BT Sync by its nature has no server, all clients just share the data, however if I add my home server to the loop, it will be updated at all times when it is online, serving as my personal "cloud" storage in a way. In this post I will go through the process of getting my server setup.

To start, download the appropriate tar file from the official website, http://www.bittorrent.com/sync/download

 note that you need to download the file that correspond to your system, whether it is 32 or 64 bits. To find out what your machine is, type:

$ uname -a

if you see a i386 in the response you are using a 32 bit install, while anything showing x86_64 is likely a 64 bit install.

Once I downloaded the appripriate file, unpak it into a folder where you will keep your executable and configuration files. Note that this folder needs to separate from the folder you intend to share since apparently failing to do that will cause a lot of synching issues.

To unpack the tar ball type:

$ tar -xvzf bittorrent_sync_i386.tar.gz

of course, substitute the name of the tar ball if you are using a 64 bit system. Once that's done run the executable with

$ ./btsync

This should prompt  a message indicating even the process id for the BitTorrent Sync application in case you need to restart it. Setting up your shares on linux is done via a web GUI via the default port 8888. One issue I came across the first time I set up my BTSync was that since I'm using a headless server and connecting to it via SSH, I needed to use the web GUI and for some reason could not connect to it right away. Instead, I needed to configure my BTSync to listen to the 8888 port from all ips (0.0.0.0) instead of just 127.0.0.1. To accomplish this you need to type

$ ./btsync --webui.listen 0.0.0.0:8888

Now to use the web GUI, use your favorite browser from a machine that does have a graphical interface and type the your server's ip followed by the port number you selected, in our case port 8888. So if my internal ip is 192.168.0.70 (use ifconfig if you need to find this out), then use

http://192.168.0.70:8888

From there, click on the "add folder" icon and select the folder you would like to sync. Just remember to backup this folder before going further. It's unlikely you will screw up, but just for good measure, you should always back up your data before an action like this.

Once you have added the folders you want synced to your list, click on the "3 dots" icon at the end of the line where the folder is displayed and go to "preferences". There you should see a button to "View Key". Here you will have the opportunity to copy a key for sharing this folder as a "read only" folder, or as a read and write folder.

Install following the instructions once again on another machine you want to sync with your server and this time, instead of clicking on the add folder button use the cog button instead, where you should see the option to "Enter a key..." That's where you will enter the hashed number you saw previously. Find the folder you want to sync and voila.

That's it, it should work and will work over several different installs. One last detail, you may need to set up a cron job or some other way of initializing the btsync executable every time you turn your server online.

edit- One detail I forgot to mention, you will need your clocks to be synchronized for BTsync to work. In case you need instructions on how to do that on your linux machine, use the following link http://www.howtogeek.com/tips/how-to-sync-your-linux-server-time-with-network-time-servers-ntp/


Sunday, September 28, 2014

Download streamed flash videos from the command line

I have just been looking for ways to download streamed videos into my hard drive so I can watch them later when I'm away from my wifi. With the power of linux I really wanted to find a way to do this in a simple way and ideally from the command line. So that's how I came across this tool called "get-flash-videos" which is a pretty descriptive name for the app.

I've tested it already and it works quite well, but I should note that you shouldn't use this to download anything you are not supposed to download. Just avoid doing anything illegal with this information of course.

Anyway, let's get started on how to install and use this tool.

There is quite a bit of information you can find on how to obtain and how to use this app on the following link --> https://code.google.com/p/get-flash-videos/ ... https://code.google.com/p/get-flash-videos/wiki/Installation

For my own use, I followed the Debian based distro guide which requires you to install

$ sudo apt-get install libwww-mechanize-perl libxml-simple-perl

then use wget to download the .deb file

$ wget http://get-flash-videos.googlecode.com/files/get-flash-videos_1.24-1_all.deb

Lastly, install it via

$ sudo dpkg -i get-flash-videos_1.24-1_all.deb

That's it, as easy as pie...

Now to use this little tool, use the following command to watch a video:

$ get_flash_videos -p http://website.url/video

or alternatively if you want to download the video directly to your hard drive use

$ get_flash_videos "http://website.url/video?f=1&v=1234" 

Enjoy... and if you want something specific for youtube, I've heard that youtube-dl is quite good but I haven't tried it myself yet.

Thursday, September 25, 2014

Shellshock - your bash may be making you vulnerable

Turns out that if you are a Linux or a Mac user you may be vulnerable to remote attacks via your bash shell. To check whether your machine is vulnerable you can use the following command:

$ env x='() { :;}; echo vulnerable' bash -c 'echo hello'

if your terminal returns the message "vulnerable hello" than you are vulnerable and you need to remediate that.

You are safe if the message "bash: warning: x: ignoring function definition attempt bash: error importing function definition for 'x' hello"

To fix your system you can update your bash via the command line by typing:

$ sudo apt-get update && sudo apt-get install --only-upgrade bash

this command will work on any debian based distro, if you are using another distro, I would redirect you to this link for the appropriate command to update your respective bash.