OPA for HTTP Authorization

Open Policy Agent[1] is a promising, light weight and very generic policy engine to govern authorization is any type of domain. I found this comparion[2] very attractive in evaluating OPA for a project I am currently working on, where they demonstrate how OPA can cater same functionality defined in RBAC, RBAC with Seperation of Duty, ABAC and XACML.  
Here are the steps to a brief demonstration of OPA used for HTTP API authorization based on the sample [3], taking it another level up.
Running OPA Server First we need to download OPA from [4], based on the operating system we are running on.  For linux, curl -L -o opa https://github.com/open-policy-agent/opa/releases/download/v0.10.3/opa_linux_amd64 Make it executable, chmod 755 ./opa Once done, we can start OPA policy engine as a server.
./opa run --server Define Data and Rules Next we need to load data and authorization rules to the server, so it can make decisions. OPA defines these in files in the format of .rego. Below is a sample …

Few methods to install software in Ubuntu

The followings are few methods I got to know surfing several sites for hours and from friends when I had time.Hope this will help someone at the beginning stage in using Ubuntu, to save time in installing software.

(1) Installing from a .tar.gz file

This is a zipped file used in Ubuntu and have to right click and extract before installing.Usually include the source code written in C, C++ or Python. Then open the extracted folder to check whether a file called 'configure' is there.

If not this method won't work and have to try another. This configure file is to match the source code with current status features like 32/64 bit.
- Open terminal
- Go to the folder where source code is located. (Using cd directory_name)

- Get into super user mode(sudo su)
- Will prompt to type password for authentication and when done correctly can proceed in super user mode
- Then type ./configure (Can observe checking of the source code, and if some error occurred have to work on that)
- After configuration have to compile the code.
- This need a package called 'build-essential' mostly coming with the CD.
- If not installed can be installed with typing 'apt-get install build-essential' in super user mode, while having live CD inside or connection to the internet.
- 'apt-get install' is another type of method to install software
- Then can compile just typing 'make' in terminal.
- To install, type make install and enter.
- If want to check can try for help on that software (Eg. 'nasm -h' , if nasm is the installed software. If this shows some helps on software, the installation is successful)

(2) Installing simple software

- When there is no configure file then have to look for a file called 'MakeFile'.

- Here no need to compile. Going to the relevant folder in terminal, getting into super user mode and entering 'make install' is enough.

In almost all the software, they come with instructions to install in a file called 'INSTALL'. Can read it to have more helps.

(3) Installing from .deb files

- This installing process is similar to .exe installation in windows. When double click on .deb file, will guide through the set up process of the software, in the package installer.
- If an error occurred saying dependencies not satisfied, have to install those dependencies as well.

- Also you can issue, 
sudo dpkg -i <path to package.deb>

(4) Easiest way

- Application > Software Centre, then select the category and the software needed and click install as instructed.

When this is done, the .deb file of the software get stored in root/var/cache/apt/archives. Then we can copy those files to another computer and install software as described above.

(5) Synaptic package manager

- System > Administration > Synaptic package manager, then search for the software needed, mark it and press apply button above in the window.

(6) Special format software

i (.sh – shell scripts)
- Just go to the folder in terminal in super user mode and enter './file_Name.sh'
- After some information on terminal it will tell you the software will be started properly.
- Ubuntu uses sh for non-interactive scripts and you might use it to run a script that does not have executable permissions set. You can set the permission as executable by right clicking file property > file permission and making it is executable.
- In command line it can be done by entering 
         chmod 777 /path/file_name.sh.
 This ‘chmod’ means changing file mode bits and 777 implies all have executable access. That number has come in an interesting way and you can read more on that here in ubuntu community page.
ii (.bin files)
Just go to the folder that include .bin file and make it executable as mentioned above. Then enter  
       sudo ./file name.bin . It will create jar files and install the software.

(7)apt-get install

- This is another famous method to install software and this simply install a package into your computer from a repository. This should be run in super user(enter sudo su and give password if it is set) mode both followings are possible.
 apt-get install
For this you need too know the exact package name and that can be over come using the command apt-cache search . With apt-get removing and upgrading packages can be easily done. Refer this page for more details.
Repositories - Here it will be bit useful to have an idea about repositories used in ubuntu. Many of the programs to satisfy ubuntu user needs are stored in archives  referred as repositories. After system is made aware of the Internet-based locations for the repositories, you can easily enjoy many more software. The repository configuration is done through a file in /etc/apt/sources.list  and by modifying that file, system can be informed of new repositories.
A such popular repository is Medibuntu's repository to Ubuntu. This page clearly describe how to add that and the repository is basically for multimedia and entertainment in ubuntu.

(9) .rpm installation

This .rpm files can not be directly installed in ubuntu and should be coverted to a supporting file format using ubuntu. For that you need another package named 'alien'. For that you can use the following command.
                  sudo apt-get update
                  sudo apt-get install alien
Then go to the folder where the .rpm file is located using the command line and enter the following command.
                  sudo alien -k  
This will simply generate a .deb file in the folder and you can double click or enter the following command to execute the .deb file.
               sudo dpkg -i  

.rpm is a powerful package manager in Red Hat Linux and "alien" is a package  that converts between the rpm, dpkg, stampede slp, and slackware tgz file formats. '-k' in that command is to keep the version number without being affected by alien.
There is a disadvantage of these methods that some of these do not add the application in Menu. To overcome this, can manually add it as follows. It works for most of the above methods. 


  1. Nice article useful for beginners!

  2. Grateful to check out your website, I seem to be ahead to more excellent sites and I wish that you wrote more informative post for us. Well done work.


Post a Comment

Popular posts from this blog

Signing SOAP Messages - Generation of Enveloped XML Signatures

OPA for HTTP Authorization

How to Write a Custom User Store Manager - WSO2 Identity Server 4.5.0