Showing posts with label Linux O/S related. Show all posts
Showing posts with label Linux O/S related. Show all posts

Saturday, March 6, 2021

Kali-Linux on Chromebook / Crostini (LXC/LXD linux container)

Intro

let me first state that this is not the normal intended use of containers.
In the normal use case containers are supposed to be ephemeral.
However, in this specific use case I want to use it as a light-weight virtual machine, and therefore I do want to keep it's state at all times. 
---


Objective: 

  1. Running a Kali-Linux docker-container inside the Crostini LXC/LXD- Debian-container on a Chromebook. 
  2. Keeping an up-to-date Kali-Linux image with any updates, pen-test-data, and changes made inside the active kali-Linux container so it is easy to create new and/or transport containers with all the latest changes and data. (back-up image with the current state of the current container)

Assumptions:

The Linux-container is active on your Chromebook

 

Linux-Terminal @ Chromebook


Setup Docker:

  1. Update your Debian LXC/LXD container:

    sudo apt update && upgrade -y

  2. Install dependencies:

    sudo apt install -y \
    apt-transport-https ca-certificates \
    curl gnupg2 software-properties-common


  3. Import gpg-key:

    curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

    (note: don't forget the "-" at the end of the line!)

  4. Add the docker repo to the source list:

    sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/debian \
    $(lsb_release -cs) stable"

  5. Update the new resources:

    sudo apt update

  6. Install the docker engine (community edition):

    sudo apt install -y docker-ce docker-ce-cli containerd.io


Friday, October 25, 2019

OpenVPN on Chromebooks with ovpn-file


Although the network settings in chrome-O/S allow for VPN settings, it seems cumbersome to get a simple ovpn-file of a private VPN server to work on Chromebooks.

Somewhere on the net, I've found bits and bytes on this matter and found this way to work the best for my needs.

Let's say you have a VPN server set up somewhere on a VPS. In my case, it is running as a docker container on a droplet with Digital Ocean. On there I've created an ovpn-file named "laptop.ovpn". but it can be named any way you like of course.

How to connect to the VPN on a Chromebook?


  1. open a shell screen (CTRL + ALT + T) to open Crosh terminal,
    and then type shell (+enter) to access a shell
  2. at the prompt type: sudo stop shill  (+enter)
  3. then:  sudo start shill BLACKLISTED_DEVICES=tun0 (+enter)
  4. load ovpn file: sudo openvpn /path/to/ovpn-file/laptop.ovpn (+enter)

At this point, your network connection should be routed through your Private VPN server. 

Monday, May 23, 2016

UEFI - Windows Product Key retrieval in Lunux

Trying to install a fresh copy of windows 8.1 or newer? or Install a copy as a virtual machine in your linux? 

On newer (win 8.1 + ) versions you won't find a sticker with the product key to install a fresh copy of windows on your machine. So you either have to retrieve it beforehand from your firmware using windows tools, or gather it after installing Linux on the drive. 

You have paid for this license and the Product key is in your UEFI firmware. You can retrieve this and write it into a text-file by typing the following command in a terminal screen.



sudo hexdump -s 56 -e ' "MSDM key: " /29 "%s\n" ' /sys/firmware/acpi/tables/MSDM > /home/[username]/filename.txt



Note
Usually your copy of windows is pre-installed on your original hardware, in case of disk-failure or disk-swap, you might need to download a fresh copy (.iso-file) from Microsoft. (this will only work if you download the correct version = same as your original version. otherwise your product key will not work) 


URL redirect/rewrite using the .htaccess file on Linux Servers. (redirect non-www-address to the www-address)



By default your website can be accessed with both www.example.com and example.com. Allowing both can confuse search engines, in fact, Google penalizes this (duplicated content).
You should restrict the access to either www.example.com or example.com. Some search engines may have already indexed your website under both addresses.

If you run your web-site on a Linux server, you can force this restricted behavior simply by adding the following code to your ".htaccess" file in the public_html folder of your web-ste.




Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

Sunday, December 6, 2015

eID-Software in 5 steps on Ubuntu 12.04 Lts, 14.04 Lts, 15.04


Card Reader: ACR38 usb:
(But any generic card reader should work)


In Belgium, the eID (Electronic ID card) is widely used to sign-on into many governmental services. (ex. Fedict, Student@work, beConnected, eBirth, myBelgium, TaxonWeb, Horeca@work, MyPension, eBox ...)

Installing an eID card-reader in Linux is not as strait forward as it could be.

I've used the following procedure to install it on Ubuntu 12.04 LTS & 14.04 LTS and on Crouton version of 14.04 LTS of my Chromebook.


I will explain in 5 steps how to get your ACR38 eID card reader working in Linux.
(For Ubuntu 12.04, 14.04 & 15.04, but probably works on other Debian based distro's as well )

Friday, November 27, 2015

Re-size VirtualBox Disk-Images

The native disk-file format for VirtualBox is .vdi, but VirtualBox is fully operational with other file formats as well.  ( .vdmk .vhd .ovf .ova .vdi ...)

However, if you need to re-size your virtual disk image, you might need to convert your file. To my knowledge, currently the re-size function within VirtualBox image manager works best with .vdi images.

In my case I was using a vmWare image of Windows 7 on my Ubuntu 12.04 / 14.04 LTS host, so I cloned my disk first to .vdi before re-sizing.

Wednesday, November 25, 2015

Unknown username "whoopsie" in message bus configuration file (Crouton)

For some time I had this notification "Unknown username 'whoopsie' in message bus configuration file" coming up when I started my Ubuntu-server on my Chromebook via crouton. It seemed not to do anything wrong but hey, I hate to see error messages popping up on the screen and not knowing what it really means.

In my search I've learned that the user 'whoopsie'  is being used for the error reporting daemon in Ubuntu.

System Description:

Toshiba Chromebook 2:
Intel® Celeron® Processor N2840
Intel® HD Graphics
4GB DDR3 1600MHz 
16GB solid state flash memory (eMMC)
13.3" widescreen FHD TruBrite® LED Backlit Display (1920x1080)
Stereo speakers tuned by Skullcandy
Dual array microphone,HD webcam
Intel® Dual Band Wireless-AC 7260 Plus Bluetooth 4.0
Lithium Polymer (44Wh, 3-Cell) up to 9hrs
HDMI® output port
1-USB (2.0) port,1-USB (3.0) port
SD Card Reader + SanDisk Extreme Pro 64GB (95Mb/sec)


Friday, December 13, 2013

Changing Meta Info of video files with ffmpeg (command line)

If you want to add or change the meta information of your video/audio files, you probably can find a GUI driven software that does just that for you. But if you happen to work on your media server in command line, and want to change a file here and there via the command line.

You have some options as:

mencoder, ogmtools, mkvtoolsnix, ffmpeg.

Of all the above, ffmpeg seems to support the largest set of container formats.


Example: 

You have a video file: videofile.mkv
and want to add or change some meta data:

title = "My Title",
comments = "My Comments"


Here is how you do it @ the command line, given you have ffmpeg and the needed codexes installed properly.


ffmpeg -i videofile.mkv -vcodec copy -acodec copy -metadata title="My Title" -metadata comments="My Comments" NewFile.mkv



Other meta tags you can manipulate for audio & video files are:


album        -- name of the set this work belongs to
album_artist -- main creator of the set/album, if different from artist.
                e.g. "Various Artists" for compilation albums.
artist       -- main creator of the work
comment      -- any additional description of the file.
composer     -- who composed the work, if different from artist.
copyright    -- name of copyright holder.
creation_time-- date when the file was created, preferably in ISO 8601.
date         -- date when the work was created, preferably in ISO 8601.
disc         -- number of a subset, e.g. disc in a multi-disc collection.
encoder      -- name/settings of the software/hardware that produced the file.
encoded_by   -- person/group who created the file.
filename     -- original name of the file.
genre        -- <self-evident>.
language     -- main language in which the work is performed, preferably
                in ISO 639-2 format. Multiple languages can be specified by
                separating them with commas.
performer    -- artist who performed the work, if different from artist.
                E.g for "Also sprach Zarathustra", artist would be "Richard
                Strauss" and performer "London Philharmonic Orchestra".
publisher    -- name of the label/publisher.
service_name     -- name of the service in broadcasting (channel name).
service_provider -- name of the service provider in broadcasting.
title        -- name of the work.
track        -- number of this work in the set, can be in form current/total.
variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of
 
 
 

Sunday, October 13, 2013

Ubuntu 12.04: No sound when headphones are plugged in. (HP Dv7-6190ed)

On my HP Pavilion dv7-6190ed, after every Kernel update, the Audio switch to Headphones seems to stop working. I'm pretty sure the following fix (work-around) works on other laptops too.

  • Open the terminal and enter the following commands:
cd /usr/share/pulseaudio/alsa-mixer/paths/
sudo cp analog-output-headphones.conf analog-output-headphones.bak sudo nano analog-output-headphones.conf
  • Look for the section called [Element Speaker],
    change it so that it looks like this:
Element Speaker]
switch = on
volume = ignore 
  • Save the changes and then reboot.
  • Create a backup of the corrected analog-output-headphones.conf file, so you can simply copy the backup back after each new kernel update rather than repeating the whole procedure. 
cd /usr/share/pulseaudio/alsa-mixer/paths/
sudo cp analog-output-headphones.conf analog-output-headphones.fixed

If this does NOT do the trick, Try adding the following the following:

  • Open the terminal once again, and enter the following commands:
sudo nano /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf
  • Comment out the following line as shown:
[Jack_InputDevice]
#required-any = any
  • Save the file and then issue this command to restart pulseaudio:
pulseaudio -k

Conclusion.

So far I've had no issues with this fix, and I have plugged and UN-plugged my headphones – sound switches between the headphones and speaker just fine again. Cheers, and thanks to all the helpful tips on the net that made this write-up possible.


Thursday, April 18, 2013

Splitting PDF-File via Command-Line

To Split a PDF file, or lets say, cut-out some pages, and save them as a new PDF file in Linux, you don't need to install any extra software. Of course you can use a nice GUI driven program to do this, but it is actually not that hard to do in command line. (I like to keep my system clean with the least amount of clutter, so I prefer to use the tools available by default)

If you want to use the command line function for this manually, it is a bit of a pain, so I recommend to create an alias for this PDF splitting/extract function.
You do that by adding the following code in your ~/.bashrc file.


1. open a terminal screen. (Ctrl + T)

2. type:  gedit ~/.bashrc

Monday, September 10, 2012

Remap Keyboard: Assign not working keys to different keys


Laptop keyboards are not always the greatest quality, and after some time it might have a key or few keys not working. When they are vital keys, it really is a game stopper. In my case I had the "BackSpace" and "Enter/Return" keys not working.
"PgUp" and "PgDn" are handy but you can go without them. So I decided to give the "PgUp" key the BackSpace function, and the "PgDn" the Enter/Return function.
Here is How:



First find the Keycode:

In a terminal screen, type xev to find key codes. type "BackSpace", "Return/Enter", "PgUp", "PgDn", and then close the xev function.
You should see following:

Monday, July 30, 2012

Install Gimp 2.8 in Ubuntu 12.04 (Pricise Pangolin)

Gimp 2.8 comes with many updated features. Unfortunately, it hasn't made it in the repo's of Precise (Ubuntu 12.04 Lts) yet. But no worries, it is easy to install by using a third-party ppa. (Note always be careful when adding ppa's, only add trusted ones to prevent malware) This ppa is provided and maintained by "Otto-Kesselgulash"




1. adding the ppa to your sources:

open terminal screen (Ctrl + Alt + T) and type the following:

sudo add-apt-repository ppa:otto-kesselgulasch/gimp
sudo apt-get update

At this stage of the installation, you can either continue in command-line, or open the software center and install the latest version of gimp from there:

2.1. Command line:

sudo apt-get install gimp gimp-plugin-registry 


2.2. Software center:


(make sure to add the add-ons too)


3. Adding one more very powerful plug-in to the installation:
(optional)


sudo apt-get install gimp-resynthesizer


finished!

Sunday, July 1, 2012

CUPS Printing: Clear a locked print job from the print Queue

When you are using a CUPS print server on your network, you might find print jobs locked in the queue due to a variety of reasons. (paper jam, power off while printing, network interruptions.....and many others

  • The most obvious way to delete a print job is via the web interface at http://localhost:631, Unfortunately, this might not always work on print jobs that somehow got stuck.
 

Tuesday, June 19, 2012

Ubuntu 12.04 Lts, Suspend / Hybernation / Standby not working

Suspend/standby/hibernation & Resume has always worked on my HP dv7-6190ed, until recent.  After update to kernel 3.2.0-24 or 25 it caused issues where the system would resume to a black lit screen. Ctrl+Alt+F1 console works and you can restart that way but it's pretty much all you can do at this point. (Going back to gdm, with Ctrl+Alt+F7  doesn't work either) 
So using this fix seems to do the trick for now.
(NOTE:  Suspend/Standby/Hybernation & Resume worked flawless with 11.10 on the same laptop!!)


1. Open Terminal session, and create a script:
sudo gedit /etc/pm/sleep.d/20_custom-ehci_hcd

  2. Insert (paste this code):
#!/bin/sh
# File: "/etc/pm/sleep.d/20_custom-ehci_hcd".
TMPLIST=/tmp/ehci-dev-list

case "${1}" in
        hibernate|suspend)

        ;;
        resume|thaw)

     chvt 1
     chvt 7
        ;;
esac

3. Change permissions, (make executable):
sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd


Hope this does the trick for now.

Merging PDF files via Command line (Build in tools)

Merging several PDF-files into one PDF file; In Linux, you don't have to install any additional software to do this. Everything can be done on the command line with a few simple lines of code. If you however don't like to work on the command line, you might want to install additional software (example: PDF-mod)
To make your life easier, I recommend creating an alias for the PDF merge function. You do that by adding the following code to your .bashrc file in the home folder.

MySQL- DataBase Backup (command-line)

The quick and dirty way to backup (dump) all databases currently served on the server:

I assume the server is not running any GUI, right at the command line, type the following:

sudo mysqldump --all-databases > /home/username/dumpalldb.sql -u root -p

where:
username = home folder for the user currently logged in.
dumpalldb.sql = the sql file dump of all databases.


Sunday, June 17, 2012

VirtualBox: Access NAT-Virtual Server from Host

If you want to set-up a virtual development server on a laptop, so you can work anywhere, you need to select NAT for your network setting on your guest. Doing so, you can't connect from your host to the Virtual server (guest) without using Port forwarding.

Example: We want the following connections from our host to the guest;  ssh, http, https on the ports 22, 80, 443. I don't like to use the default ports for these services on my host, therefore, I forward from a different port: ex. HTTP, Host (2080)  to Guest (80)

Wednesday, June 13, 2012

Evolution & Ubuntu 12.04 - Google Addressbook issue

Evolution  is not the default  email client in Ubuntu 12.04 Lts,
but you can easily install it via the software centre.
If you Use a google address-book, you might have noticed that at first start the address-book often won't be populated, and throw and error.

Ubuntu 12.04: Disabling touchpad

It seems that most laptops with a hardware button to toggle touch-pad on/off work just fine. However, the soft-touch keys as it is on "HP-dv7-6190ed" seem not to work.

I found this script on the net.
(don't know where, so I repeat the post. thanks to the original coder)

1. You need to have python (pref. 2.7x) installed on your system.
Open "Ubuntu Software Center" and search for "python"
it will be listed as: "interactive high-level object-oriented language ( default version)"


Thursday, June 7, 2012

Ubuntu 12.04: Brightness buttons not working HP dv7-6190ed

In Ubuntu 12.04 the screen brightness up/down seems not to work for  HP dv7-6190ed and a few other models.

A general fix for most of the laptops with this problem: (does not work on all laptops)