X
29Jul

Ansible: User module and Password hashing

Ansible user module is used to create and manage the user access majorly in Unix servers. Below is an example of the ansible task in playbook shows usage of the ansible user module.

tasks:

- name: create new user

   user:

         name:           deployer

         password:  anspassword

         shell:            /bin/bash

 

But when we try to use this module in playbooks, writing plain password text inside file is unshackled, results in various security concerns. These passwords must be hashed to use with user module.

Password hashing:  It is method in which a variable length of plain password is taken as input and with cryptic mechanism creating fixed length of cryptic password.

Hashing is one-way road, revering the password into normal string is highly difficult, makes more secure. If we want to level up in security, we can use salt values which generate more secured hash passwords.

Methods of Password hashing: There are serval different ways we can hash the password but the below are the most common techniques used is MDA and SHA.

1)Password hashing using Python: Below command with random salt will prompt user to type  password and with using sha-512 algorithm gives cryptic password.

pyhton -c  ‘import crypt,getpass; print crypt.crypt(getpass.getpass( ))’

So, we can make use of hashed password in the playbook to use the user module in efficient way.

 

2)Openssl (With random salt value): Open ssl makes use of MD5 algorithm with random salt value generates the hashed password.

Command:

Openssl passwd  -1 -salt $(openssl rand -base64 6)  mypassword

 

Same as above, generated cryptic password can be used for user module in ansible for parallel execution of user id creation in n number of Unix servers.

Most of the Unix servers will follow the SHA 512 algorithm so it is advisable to follow the cryptic password which is generated with the Sha-512 algorithm. If you want to check what kind of algorithm the servers have, we can make use of below command.

 

Related

Git Command line Options

Git is a free and open source distributed version control system designed to handle everything from ...

Read More >

Brief Journey to Asp.Net MVC Framework

Introduction: ASP.NET MVC is a  framework for building web applications that uses the mode...

Read More >

Microsoft Office 2013 Features and Looks

Now Office 2013 launched recently, now its not available for users may be its available for User aft...

Read More >

Migration Process of SVN to Git

Subversion (SVN) is a central version control system (VCS) while Git is a distributed version contro...

Read More >

Correction and Cancelation of Posted Documents in NAV 2015

This feature is one with which we have simplification of user interface and faster work, but current...

Read More >

Building an Outlook 2010 Add In Using C#.NET With Visual Studio 2010

How to build an outlook 2010 Add In using C#.Net and Visual Studio 2010?In this post, I’l...

Read More >

Cross Browser issue, How to handle in Internet Explorer?

Cross Browser issue , How to handle in Internet Explorer?Now a days in online there are good number ...

Read More >

Implementing iOS Setting Bundle

 iOS Setting Bundle:-Actually sometimes we need to interact our app i.e giving some input value...

Read More >

Dynamics 365 Business Central: How to Record Events in Business Central

When you are developing an extension for Dynamics 365 Business Central and you need to interact with...

Read More >

Microsoft Azure Webinars Registration

Date : 28th Jan 2016 | Day  : Thursday | Time : 03:30 PM IST | Duration : 1 HourREGISTER yourse...

Read More >

Share

Try DevOpSmartBoard Ultimate complete Azure DevOps End-to end reporting tool

Sign Up

  • Recent
  • Popular
  • Tag
Tags
Monthly Archive
Subscribe
Name

Text/HTML
Text/HTML
Contact Us
  • *
  • *