Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, April 6, 2021

libvirt-dnsmasqd running as part of libvirt

Standard

Open DNS server on external IP

Background

When you run libvirt / KVM on Ubuntu it seems the framework starts up a second local DNS server beside systemd-resolved. Since only one server can occupy localhost port 53 (systemd-resolved) libvirt-dnsmasq uses HOSTNAME / Port 53. So that will be whatever IP the DHCP server assigns to your PC. 

This IP is accessible from all other sources on the network as a matter of fact and running an open DNS server on it is probably not a good idea.

Solution

Check the virtual net status:

# virsh net-list
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     yes           yes

Check to see if libvirt-dnsmasq is running

# lsof -i TCP:53

Remove the default virtual network for your virtual hosts.

# virsh net-destroy default

Prevent it from autostarting at all

# virsh net-autostart --network default --disable

If you need it again start it with

# virsh net-start default

Result

libvirt-dnsmasq is no longer listening on port 53 / DNS on whatever IP your interface(s) have been given on your network.

# lsof -i TCP:53
COMMAND   PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 635 systemd-resolve   13u  IPv4  25136      0t0  TCP localhost:domain (LISTEN)

# virsh net-list
 Name   State   Autostart   Persistent
----------------------------------------





Wednesday, January 17, 2018

Citrix on linux

Standard

How to get the black address bar

1. Use Firefox. It works way better with the ICACLient than chromium. I have not tested chrome, buit I suspect it is the same.

1. Setup of local ICAClient

- Navigate to the root of the ICA installation. For me /opt/Citrix/ICACLient.
- Find the file All_Regions.ini 
- Under [Client Engine\GUI]
- Add ConnectionBar=* 

Restart your ICAClient and log on again. It should now be visible in the top of the screen.

Wednesday, May 13, 2009

LUKS encrypted MiniSD using Ubuntu

Standard
Introduction

I have long been playing with the idea of building an encrypted minisd disk. My lappie has a card reader device, and it seems to be very convenient to use a small MiniSD card to hold keypairs and other sensitive material. But only if properly secured through proper encryption.

I wanted to setup the entire sd card for encryption on a device level. No use of encrypted container files or such.

I feared this to be very difficould, little did I know how easy this really is on the latest Ubuntu release Jaunty Jackelope.

It can be very easily setup using dm-crypt.

Preparing the system

In order to setup device level encryption a few initial steps is needed. What the system does is to inject a level of enctyption between the partion and the file system on top of it.

So firstly you need to add the needed software to the ubuntu system using the software repository:
sudo apt-get install cryptsetup
This will add the needed executables and system libraries to your system. However this will not quite cut it. Remember I mentioned the idea of injecting a layer of security between the partition and the file system?

As a consequence the system needs to load extra functionality on the kernel level to enable this functionality. Add the following three lines to the file /etc/modules:

sudo vi /etc/modules

Add:

aes

dm_mod

dm_crypt


When this is done you will need to reboot your pc or manally load the kernel objects in the above order:

sudo modprobe aes

Repeat this for each module.

Your basic system software should now be ready to fly.

Nuking the device

In order to be sure that no residual stuff is on the sd I decided to nuke it completely as the very first step

Note: THIS WILL FOREVER DESTROY WHAT IS ON THE TARGET DEVICE! You have been warned.

sudo dd if=/dev/urandom of=/dev/mmcblk0

The card reader loads the raw device as /dev/mmcblk(n) the /dev/urandom device is a pseudo device that will generate random data. So I completely fill the card with random data.

To be even more sure stuff is deleted use /dev/random. This will take a bit longer.

Now create a new partition on the device:

sudo parted /dev/mmcblk0 mkpart primary 0 63

This will create a new primary partition from mb 0 to 63. Making a total of 64 megabytes which is the capacity of the small sd.

If the above gives you problems try the graphical GUI though gparted.

This concludes the setup needed to the partition on the sd.

Setup of dm-crypt

We now need to setup the encryption on the device. I chose to create a luks device. This will create a device with "Linux unified key setup". It is a linux standard for encryption, header and data, and should *knock on wood* make it possible to use the same sd on other distros.

Create the encryption:

sudo cryptsetup luksFormat --hash=sha512 --cipher=aes-cbc-essiv:sha256 --key-size=256 /dev/mmcblk0p1

The above will provide a reasonable level of security and can be relaxed and enforced according to your taste. Please see the manual pages.

The process will make you confirm the process by typing in "YES" in capital lettering. After this the system will prompt you for a new passcode.

When this is done take out the sd card, wait a few seconds and reinsert it. The system (gnome) will now prompt you for a passcode. Once the passcode entered above has been keyed in the system will mount a new instance in /dev/mapper/.

For instance my device is called:

/dev/mapper/luks_crypto_e72069ca-04f2-4fd1-824b-aac25c41455b

This then concludes the setup of the encryption. Easy wasn't it?

Setting up a filesystem on your new crypt device
In order to use the new device it must have a file system. You can choose any one you like, but I felt adventurous and created a brand new ext4 device. The latest of the linux file system standard:

sudo mkfs -t ext4 /dev/mapper/luks_crypto_e72069ca-04f2-4fd1-824b-aac25c41455b

Sync the filesystem to the disk:

sync

Eject and re-insert your sd a final time, and you will now see Gnome popping up a file manager listing the contents of your new drive.

Now all you need is to create a folder where your non-root user has read and write access.

The drive mounts in /media/disk