Docker Image for Azure CLI and Azure Powershell

If you are a MAC or Linux user like I am and you like to manage your azure environment with azure-cli or azure-powershell you can use the following docker Image: cvugrinec/ubuntu-azure-powershellandcli:latest

Just type the following:

docker run –it  cvugrinec/ubuntu-azure-powershellandcli /bin/sh

Please note that for azure-powershell only ARM mode is supported. Azure cli supports ASM and ARM mode.

weblogic performance issue with urandom on Linux

I remember I had this issue a while age….but to my shock I did not blog it…Because my great inspirator Mr Vernetto Blogs everything with javamonamour…I will be a better boy now and start documenting…

Anyway

Because weblogic uses some libraries of the OS for encryption and decryption it is adviced to use the /dev/urandom library in stead of the defaul /dev/random lib…this can have a major impact on performance. there are several ways to enforce this…but my favorits is to do it on OS level by making a symbolic link.

as root: cd /dev rm -f random ln -s /dev/urandom random

here is another link: http://weblogic-wonders.com/weblogic/2010/11/10/issues-relating-to-urandomrandom-on-weblogic-server-in-linux-environment/

Swappiness happiness

Swappiness is a kernel setting that determines when a server/desktop should swap.

To tune, simply echo a value from 0 to 100 onto /proc/sys/vm/swappiness.

If you want to keep this setting when you reboot do: echo “vm/swappiness=0” >> /etc/sysctl.conf check this with sysctl -a | grep swapp

The higher a number set here, the more the system will swap. Determine what is best for your own situation. In general for servers I put a low swappiness setting, for desktops I leave the default of 60.

Remove hidden characters from text file

000 0 0x00 NUL 001 1 0x01 SOH, Control-A 002 2 0x02 STX, Control-B 003 3 0x03 ETX, Control-C 004 4 0x04 EOT, Control-D 005 5 0x05 ENQ, Control-E 006 6 0x06 ACK, Control-F 007 7 0x07 BEL, Control-G 010 8 0x08 BS, backspace, Control-H 011 9 0x09 HT, tab, Control-I 012 10 0x0a LF, line feed, newline, Control-J 013 11 0x0b VT, Control-K 014 12 0x0c FF, form feed, NP, Control-L 015 13 0x0d CR, carriage return, Control-M 016 14 0x0e SO, Control-N 017 15 0x0f SI, Control-O 020 16 0x10 DLE, Control-P 021 17 0x11 DC1, XON, Control-Q 022 18 0x12 DC2, Control-R 023 19 0x13 DC3, XOFF, Control-S 024 20 0x14 DC4, Control-T 025 21 0x15 NAK, Control-U 026 22 0x16 SYN, Control-V 027 23 0x17 ETB, Control-W 030 24 0x18 CAN, Control-X 031 25 0x19 EM, Control-Y 032 26 0x1a SUB, Control-Z There are a lot of characters that are not visible…even if you do a cat -v on a filename or in vi do :set list . Characters like the ones above are not always visible, then try the following:

^C is represented by �\003�, and ^M is represented by �\015�.

tr -d “\015” newfile, replaces the enter line

Script for handling gpg encrypted files

############################################
#
# File:    geheim.sh
# Descr:   A small script to read/write files using
#               your own private GPG key
# Date:    24 March 2010
# Author:  Chris Vugrinec
# ############################################
# Define your variables here
tmpFileName=”output.txt”
privateKeyAdress=”chris@datalinks.nl”
clear
if [ “$1” == “” ]
then
   echo “”
   echo “Please give file as param: ”
   echo “”
   echo “”
   exit 127
else
   chris=`echo $1 | cut -d . -f 3`
   if [ “$chris” == “gpg” ]
      then
         echo “Decrypting file $1” gpg –decrypt $1 >$tmpFileName
         vi $tmpFileName gpg -e -r $privateKeyAdress –output $1 $tmpFileName
         rm -f $tmpFileName
      else
         echo “Encrypting file $1”
         gpg -e -r $privateKeyAdress $1
         echo “cleaning up original file $1”
         rm -f $1
   fi
fi 

Using gpg to encrypt en decrypt files

Case:

Sometimes you want to share delicate information between some people. This is how you create a public/ private keys on 2 different linux machines:

  • On the 1st machine you generate the keys, with: gpg –gen-key (you will get a dialogue on what to do…for this purpose I stick with the default values: 2048 bits, DSA and Elgamal
  • Export the key, you want this file on the 2nd machine….export it with: gpg –export-secret-keys > someName.key
  • Copy the someName.key file on the 2nd machine and import it with the following command: gpg –allow-secret-key-import –import someName.key ….it is now added to your keyring
  • On the 1st machine, encrypt a file gpg style 🙂 with the following command: gpg -r theMailAdressWhichIsUsedInThePrivateKey -e someFile.txt  (r = recipient…this is the email keyname, e stands for encrypt) this command will create an ecrypted gpg file for you
  • Copy the file to the 2nd machine (the machine where you copied your key) and decrypt it with the following command: gpg -d someFile.txt.gpg

Unix permissions with the sticky bit

Ok, what is this sticky bit stuff all about….

next to the standard bits in Unix which determine what the group/ user / other rights are and what kind of file it is (- = other, d = directory, l = link) there are also special bits…

-T is the sticky Bit, this tells you that only root and the owner can delete the files, you can set it with chmod +t filenaam -S is the GID Bit, basically you can set this to a directory and every file that is written within that directory will have the same GID

Finding files with sticky T bit: find somedir -type f -perm -1000 -exec ls -ld {} \; Finding files with sticky D bit: find somedir -type d -perm -1000 -exec ls -ld {} \;

Finding directories who do NOT have the sticky GID set find somedir -type d ! -perm /g+s Finding directories who do have the sticky GID set find somedir -type d -perm /g+s

One of the sources i got my info from is: http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilesp.html