Showing posts with label home. Show all posts
Showing posts with label home. Show all posts

Friday 29 September 2017

Working with PuppetLabs Using Vagrant


While working as DevOps Engineer one of the tools by definition that we use more, often is Puppet. Guess most people will think that you are 100% expert, which is not always the case. So, I need to create this post and track record of my own experiments with Puppet and (PuppetLabs + Vagrant)

You might as what is Vagrant ?
==> "Vagrant is an open-source software product for building and maintaining portable virtual software development environments, e.g. for VirtualBox, Hyper-V, Docker, VMware, and AWS. ... Vagrant simplifies the necessary software configuration management in order to increase development productivity. " read more here: https://www.vagrantup.com/intro/index.html

The initial indentation was to gain better understanding puppet file structure. So, I decided to use Puppetlabs for this ...
















So, basically. I did create installed

  • Installed Vagrant
  • Used the Vagrant init command to pull the puppetlabs ubuntu VM
  • Which created a file "Vagrantfile"
  • created a dir puppetlabs


And then started the Setup, so here are the Logs ..

Tdls-Air:puppetlabs psalms91$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'puppetlabs/ubuntu-16.04-32-puppet' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: 1.0.0
==> default: Loading metadata for box 'puppetlabs/ubuntu-16.04-32-puppet'
    default: URL: https://vagrantcloud.com/puppetlabs/ubuntu-16.04-32-puppet
==> default: Adding box 'puppetlabs/ubuntu-16.04-32-puppet' (v1.0.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-16.04-32-puppet/versions/1.0.0/providers/virtualbox.box
==> default: Successfully added box 'puppetlabs/ubuntu-16.04-32-puppet' (v1.0.0) for 'virtualbox'!
==> default: Importing base box 'puppetlabs/ubuntu-16.04-32-puppet'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'puppetlabs/ubuntu-16.04-32-puppet' is up to date...
==> default: Setting the name of the VM: puppetlabs_default_1506687306250_65705
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 5.0.20
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => /Users/psalms91/Vagrant_VM/puppetlabs
Tdls-Air:puppetlabs psalms91$

Tdls-Air:puppetlabs psalms91$ vagrant ssh

Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-21-generic i686)

 * Documentation:  https://help.ubuntu.com/

vagrant@localhost:~$

After this I have my Puppet Labs VM running ... After this point was easy, I just needed to goo into the puppet installation dir and look into the dir structure.


done.. :-)

Thursday 14 February 2013

How to Recover an Encrypted Home Directory on Ubuntu


While the home-folder encryption in Ubuntu is far from a perfect solution (there is considerable data leakage from the swap file and the temp directory - for example once I've observed the flash videos from Chromium porn private browsing mode being present in the /tmp directory), it is a partial solution nevertheless and very easy to set up during installation. However what can you do if you need to recover the data because you dismantled your system?

Credit where credit is due: this guide is taken mostly from the Ubuntu wiki page. Also, this is not an easy "one-click" process. You should proceed carefully, especially if you don't have much experience with the command line.

Start Ubuntu (from a separate install, from the LiveCD, etc) and mount the source filesystem (this is usually as simple as going to the Places menu and selecting the partition). Start a terminal (Alt+F2 -> gnome-terminal) and navigate to the partitions home directory. Usually this will look like the following:

cd /media/9e6325c9-1140-44b7-9d8e-614599b27e05/home/

Now navigate to the users ecryptfs directory (things to note: it is ecryptfs not encryptfs and your username does not coincide with your full name - the one you click on when you log in)

cd .ecryptfs/username

The next step is to recovery your "mount password" which is different from the password you use to log in (when it asks you, type in the login password used for this account - for which you are trying to recover the data). Take note of the returned password (you can copy it by selecting it and pressing Shift+Ctrl+C if you are using the Gnome Terminal)

ecryptfs-unwrap-passphrase .ecryptfs/wrapped-passphrase

Now create a directory where you would like to mount the decrypted home directory:

sudo mkdir /media/decrypted

Execute the following and type in (or better - copy-paste) the mount password you've recovered earlier

sudo ecryptfs-add-passphrase --fnek

It will return something like the following. Take note of the second key (auth tok):

Inserted auth tok with sig [9986ad986f986af7] into the user session keyring 
Inserted auth tok with sig [76a9f69af69a86fa] into the user session keyring

Now you are ready to mount the directry:

sudo mount -t ecryptfs /media/9e6325c9-1140-44b7-9d8e-614599b27e05/home/.ecryptfs/username/.Private /media/decrypted
 Passphrase:  # mount passphrase
 Selection: aes
 Selection: 16
 Enable plaintext passthrough: n 
 Enable filename encryption: y # this is not the default!
 Filename Encryption Key (FNEK) Signature: # the second key (auth tok) noted

You will probably get a warning about this key not being seen before (you can type yes) and asking if it should be added to your key cache (you should type no, since you won't be using it again probably).

That's it, now (assuming everything went right) you can access your decrypted folder in /media/decrypted. The biggest gotcha is that home/username/.Private is in fact a symlink, which - if you have an other partition mounted - will point you to the wrong directory, so you should use the home/.ecryptfs/username directory directly... If this does work you try this from this ubuntu tutorial ...

Or you can also try this Live CD method of opening a encrypted home directory

How to Hide and Unhide Hard Disk Volumes Using CMD on Windows 10 and Windows 11

I'd be glad to create a step-by-step guide on hiding and unhiding hard disk volumes using CMD commands for Windows 10 and 11 , incorpor...