Giter Site home page Giter Site logo

miteshshah / ansible-bootstrap-ubuntu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrmierzejewski/ansible-bootstrap-ubuntu

0.0 2.0 0.0 14 KB

Ansible scripts for bootstrapping and securing an Ubuntu server (locale, fail2ban, firewall, lock down sudo, prevent root and password login, ...)

Nginx 100.00%

ansible-bootstrap-ubuntu's Introduction

Boostrapping and securing an Ubuntu server

This repository contains Ansible scripts for bootstrapping and securing an Ubuntu server. Scripts have been tested on Ubuntu 14.04 hosted on RunAbove and DigitalOcean.

The included tasks are following:

  • Update and upgrade Ubuntu packages via apt-get
  • Configure locale
  • Install ntp to synchronize time
  • Install vim and mc (my personal preference)
  • Install fail2ban to block ssh brute-force attempts
  • Delete root password
  • Lock down sudo
  • Lock down ssh to prevent root and password login
  • Setup the ufw firewall
  • Configure unattended security upgrades
  • Install collectd deamon and collect-web front-end client (optionally)
  • Create users (optionally)

Ansible

First of all, install the latest version of Ansible, in Ubuntu:

$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible

Clone scripts

Next, clone this repository:

$ git clone https://github.com/zenzire/ansible-bootstrap-ubuntu.git

Configuration files

Copy sample configuration files:

$ cp hosts.sample hosts
$ cp group_vars/server.yml.sample group_vars/server.yml

Edit configuration files (hosts and group_vars/server.yml) with your own configuration.

Prerequisites for RunAbove hosting

Set password for admin user and add this user to sudoers group.

$ ansible-playbook user.yml

Enter username: admin
Enter password: 
confirm Enter password: 
Enter id_rsa.pub path [~/.ssh/id_rsa.pub]: 
Add user to sudoers group (y/n) [n]: y

Prerequisites for DigitalOcean hosting

Create admin user and add this user to sudoers group.

$ ansible-playbook user.yml --user root

Enter username: admin
Enter password: 
confirm Enter password: 
Enter id_rsa.pub path [~/.ssh/id_rsa.pub]: 
Add user to sudoers group (y/n) [n]: y

Script execution

Finally, execute bootstrap Ansible task for admin user:

$ ansible-playbook bootstrap.yml --ask-sudo
sudo password:

Reboot

After successfully bootstrapping and securing your server, reboot server for kernel updates.

$ ansible-playbook reboot.yml --ask-sudo
sudo password: 
Are you sure you want to reboot server (yes/no)? [no]: yes

Collectd

Also you can install collectd, deamon which collects system performance statistics periodically and collectd-web, web-based front-end for data collected by collectd.

$ ansible-playbook collectd.yml --ask-sudo

Users

You can add new user or update the existing one using the following script:

$ ansible-playbook user.yml --ask-sudo

License

Released under the MIT License, Copyright (c) 2015 - Marcin Mierzejewski

ansible-bootstrap-ubuntu's People

Contributors

ericcrosson avatar rogerz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.