7 Star 54 Fork 12

Seaton Jiang / aegis

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
Notice: Creating folder will generate an empty file .keep, because not support in Git

English | 简体中文

Report Bug · Request Feature

System security hardening tool for Ubuntu Server

💻 Screenshot

Script Execution

Login Information

Mount disk

✨ Features

  • Password can be used for a maximum of 30 days.
  • After 30 days of password expiration, the account will be disabled.
  • The interval between two password changes is 1 day.
  • Warning 7 days before password expiration.
  • Set the system default encryption algorithm to SHA512.
  • Set a session timeout policy of 900 seconds.
  • Each created user will be given their own group.
  • The newly created user home directory permissions are changed to 0750.
  • Modify the permissions of the home directory of the stock user to 0750.
  • Remove useless users and packages.
  • Hardened OpenSSH config (Some configs need to be done manually).
  • Disable login for users without home directory.
  • Disable login by default for new users.
  • Disable apport and popular-contest statistics for uploading user information.
  • Disable ads in the welcome message.
  • Disable root account.
  • Disable synchronous deletion of user groups when deleting users.

There are many more settings that are not listed, and you can refer to the files in the scripts directory for more information.

🚀 Quick start

Step 1: Clone the repo

Make sure the server has git first, otherwise you need to install it using sudo apt install git.

git clone https://github.com/seatonjiang/aegis.git

Step 2: Edit the config file

Go to project directory.

cd aegis

Be sure to authenticate the contents of the config file.

vim aegis.conf

Step 3: Running script

If you are root, you can run it directly, if you are a normal user please use sudo and you must run the script with bash.

sudo bash aegis.sh

📝 Config options

# Verify at the completion of each operation.

# Add a production environment reminder in motd.

# Modify the SSH port
# It is recommended to choose between 10000 and 65535.

# Modify the Time zone

# Modify the hostname
# Tencent Cloud and Alibaba Cloud will automatically get the metadata.

# Modify the DNS server
# Tencent Cloud and Alibaba Cloud will automatically get the metadata.
# DNSPod:      Alidns:
# Google:   Cloudflare:

# Modify the NTP server
# Tencent Cloud and Alibaba Cloud will automatically get the metadata.
# Tencent: ntp.tencent.com   Aliyun: ntp.aliyun.com
# Google: time1.google.com   Pool: pool.ntp.org

# Docker Compose version

🔨 Modular

Aegis contains a number of standalone functions that are not in the auto-executed script and need to be used separately using parameters, which can be viewed using the sudo bash aegis.sh --help for all standalone functions.

Clear system

Clear all system logs, cache and backup files.

sudo bash aegis.sh --clear

Mount disk

Interactively mount the data disk (Tencent Cloud will use the soft link method of elastic cloud hard disk to mount), the data is priceless, remember to be careful during the operation!

If the selected hard disk is already mounted, you will be prompted to unmount and format the operation.

sudo bash aegis.sh --fdisk

Modify the SSH port

Interactively modify the SSH port.

The port range is recommended to be between 10000 and 65535.

sudo bash aegis.sh --sshport

Install docker

Install docker service and set registry mirrors (Tencent Cloud and Alibaba Cloud automatically use their own acceleration address), and add run permission for non-root accounts.

After installation, please log out and log back in, then test docker.

sudo bash aegis.sh --docker

Uninstall agent

Remove the various monitoring components installed into the server by the cloud vendor.

Tencent Cloud monitoring components are currently supported.

sudo bash aegis.sh --removeagent

📂 Structure

A quick look at the folder structure of this project.

├── aegis.conf
├── aegis.sh
├── config
│   └── (some config files)
└── scripts
    └── (some script files)

🤝 Contributing

We welcome all contributions. You can submit any ideas as pull requests or as issues, have a good time! :)

📃 License

The project is released under the GNU General Public License v3.0, see the LICENCE file for details.

Repository Comments ( 0 )

Sign in to post a comment


🛠️ Ubuntu 服务器的系统安全加固工具 expand collapse

Releases (2)






Load More
can not load any more


101014 b92fc32e 1850385 101014 af024cb7 1850385