{"id":13835426,"url":"https://github.com/mrmierzejewski/ansible-bootstrap-ubuntu","last_synced_at":"2025-02-27T20:49:25.706Z","repository":{"id":38214181,"uuid":"28914880","full_name":"mrmierzejewski/ansible-bootstrap-ubuntu","owner":"mrmierzejewski","description":"Ansible scripts for bootstrapping and securing an Ubuntu server (locale, fail2ban, firewall, lock down sudo, prevent root and password login, ...)","archived":false,"fork":false,"pushed_at":"2018-04-20T09:27:55.000Z","size":14,"stargazers_count":126,"open_issues_count":2,"forks_count":35,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-10T18:18:00.035Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Nginx","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrmierzejewski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-07T13:09:59.000Z","updated_at":"2024-12-15T20:50:51.000Z","dependencies_parsed_at":"2022-09-04T14:52:47.247Z","dependency_job_id":null,"html_url":"https://github.com/mrmierzejewski/ansible-bootstrap-ubuntu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmierzejewski%2Fansible-bootstrap-ubuntu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmierzejewski%2Fansible-bootstrap-ubuntu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmierzejewski%2Fansible-bootstrap-ubuntu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmierzejewski%2Fansible-bootstrap-ubuntu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrmierzejewski","download_url":"https://codeload.github.com/mrmierzejewski/ansible-bootstrap-ubuntu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241058543,"owners_count":19902206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T14:01:01.703Z","updated_at":"2025-02-27T20:49:25.660Z","avatar_url":"https://github.com/mrmierzejewski.png","language":"Nginx","funding_links":[],"categories":["Nginx"],"sub_categories":[],"readme":"# Boostrapping and securing an Ubuntu server \n\nThis repository contains [Ansible](http://ansible.com) scripts for bootstrapping and securing an Ubuntu server.\nScripts have been tested on Ubuntu 14.04 hosted on [RunAbove](http://www.runabove.com) and [DigitalOcean](http://www.digitalocean.com).\n\nThe included tasks are following:\n\n* Update and upgrade Ubuntu packages via apt-get\n* Configure locale\n* Install ntp to synchronize time\n* Install vim and mc (my personal preference)\n* Install fail2ban to block ssh brute-force attempts\n* Delete root password\n* Lock down sudo\n* Lock down ssh to prevent root and password login\n* Setup the ufw firewall\n* Configure unattended security upgrades\n* Install collectd deamon and collect-web front-end client (optionally) \n* Create users (optionally)\n\n## Ansible\n\nFirst of all, install the latest version of Ansible, in Ubuntu:\n\n```\n$ sudo apt-get install software-properties-common\n$ sudo apt-add-repository ppa:ansible/ansible\n$ sudo apt-get update\n$ sudo apt-get install ansible\n```\n\n## Clone scripts\n\nNext, clone this repository:\n\n```\n$ git clone https://github.com/zenzire/ansible-bootstrap-ubuntu.git\n```\n\n## Configuration files\n\nCopy sample configuration files:\n\n```\n$ cp hosts.sample hosts\n$ cp group_vars/server.yml.sample group_vars/server.yml\n```\n\nEdit configuration files (hosts and group_vars/server.yml) with your own configuration.\n\n## Prerequisites for RunAbove hosting\n\nSet password for admin user and add this user to sudoers group.\n\n```\n$ ansible-playbook user.yml\n\nEnter username: admin\nEnter password: \nconfirm Enter password: \nEnter id_rsa.pub path [~/.ssh/id_rsa.pub]: \nAdd user to sudoers group (y/n) [n]: y\n```\n\n## Prerequisites for DigitalOcean hosting\n\nCreate admin user and add this user to sudoers group.\n\n```\n$ ansible-playbook user.yml --user root\n\nEnter username: admin\nEnter password: \nconfirm Enter password: \nEnter id_rsa.pub path [~/.ssh/id_rsa.pub]: \nAdd user to sudoers group (y/n) [n]: y\n```\n\n## Script execution\n\nFinally, execute bootstrap Ansible task for admin user:\n\n```\n$ ansible-playbook bootstrap.yml --ask-sudo\nsudo password:\n```\n\n## Reboot\n\nAfter successfully bootstrapping and securing your server, reboot server for kernel updates.\n\n```\n$ ansible-playbook reboot.yml --ask-sudo\nsudo password: \nAre you sure you want to reboot server (yes/no)? [no]: yes\n```\n\n## Collectd\n\nAlso you can install [collectd](https://collectd.org/), deamon which collects system performance statistics \nperiodically and [collectd-web](https://github.com/httpdss/collectd-web), web-based front-end for data \ncollected by collectd.\n\n```\n$ ansible-playbook collectd.yml --ask-sudo\n```\n\n## Users\n\nYou can add new user or update the existing one using the following script:\n\n```\n$ ansible-playbook user.yml --ask-sudo\n```\n\n\n## License\n\nReleased under the MIT License, Copyright (c) 2015 - Marcin Mierzejewski\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmierzejewski%2Fansible-bootstrap-ubuntu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrmierzejewski%2Fansible-bootstrap-ubuntu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmierzejewski%2Fansible-bootstrap-ubuntu/lists"}