Grub2加密
来源:互联网 发布:国家数据统计 编辑:程序博客网 时间:2024/06/15 21:13
前言
使用Bootloader加密,可以避免服务器在启动过程中被不怀好意的人(attckers)或者误操作带来的风险。以下介绍如何加密。
设置用户名密码及进入菜单
配置文件介绍
- /etc/grub.d/01_users kickstart安装过程如果指定使用该模板会建立此文件,如系统中没有可手动建立。此文件用来设置用户及密码
- /etc/grub.d/40_custom 用户系统菜单选项配置文件,用来限定启动系统使用的镜像、内核及用户的组织关系
设置用户及密码加密
[root@localhost ~]# cat /etc/grub.d/01_users cat <<EOFset superusers="wiil" #设置超级用户,拥有所有系统菜单进入、修改、启动权限,必须设置password wiil 123456 #明文密码password_pbkdf2 ok #用户ok的加密密码,后面有介绍如何加密 grub.pbkdf2.sha512.10000.5429F8134584EB531B9C5BFF59ADBFD4FB3751CA19FEB9DA1003A3BBC5638FBE9288D1D6B3F303306D0891EC7710CC526CBAEDBF35AD05F4245C3147100CC34A.72504215A4B0A19F2246CCDDD4D40E12B5BA0287D053B89607E7174B79ADD787745C036F7CDCBA1A2A184CCCA2720FD1A6682ED55CB05ED654CE92209A4673DDEOF[root@localhost ~]#
设置菜单入口加密
[root@localhost ~]# cat /etc/grub.d/40_custom #!/bin/shexec tail -n +3 $0# This file provides an easy way to add custom menu entries. Simply type the# menu entries you want to add after this comment. Be careful not to change# the 'exec tail' line above.menuentry 'Red Hat Enterprise Linux Server 7.1 (Test)' --users wiil {set root=(hd0,msdos1)linux16 /vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root rhgb quietinitrd16 /initramfs-3.10.0-229.el7.x86_64.img}menuentry 'Red Hat Enterprise Linux Server 7.1 (OK)' --users ok {set root=(hd0,msdos1)linux16 /vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root rhgb quietinitrd16 /initramfs-3.10.0-229.el7.x86_64.img
生成grub.cfg
1.基于BIOS的服务器
grub2-mkconfig -o /boot/grub2/grub.cfg
2.基于EFI的服务器
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
备注
1.密码加密
[root@localhost ~]# grub2-mkpasswd-pbkdf2 Enter password: Reenter password: PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.F42D8CCA10D20EE96CCCB8CF732593DCD5BAB8ABA02FECAD7AF89146023CC4877A3EDF57C3D470DEFE71A9363F5386E899538979F41E3089720C356CD04AACBE.043B48C6C0C364740F1D6A6A78749E37FE2AB4C7D4B6A24783817947BA920BC758EBACFC2154360DB026D489E6BE8E041A64A4149AFFF42FE8F76EC2CB3B3E75[root@localhost ~]#
2.使用密码加密必须有superuser,仅有普通用户grub加密不生效
3.官方rh7 grub2 encrypt 参考链接:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sec-GRUB_2_Password_Protection.html
4.拥有–unrestricted属性的菜单,任何人都可以boot,但是不能‘e’,即修改启动参数。并且所有菜单入口的修改均需要user/password。
0 0
- Grub2加密
- grub2
- grub2
- GRUB2
- grub2
- Grub2
- GRUB2
- grub2
- GRUB2
- GRUB2
- RedHat 7 找回root密码和grub2加密
- 【Grub2】grub2修复
- grub2-set-default & grub2-editenv & grub2-mkconfig
- grub2 背景
- Using Grub2
- grub2 配置
- grub2基础教程
- grub2配置
- nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
- JavaScript基础入门 封装DOM 连缀
- CNN的发展史
- [JAVA学习1]注解
- spring封装hbase的代码实现
- Grub2加密
- python 定时任务去检测服务器端口是否通
- 栈和队列面试题
- XML文件各种操作--源码
- 统计学习方法——感知机(perceptron)
- android 内存管理几篇文章
- Java多线程之并发协作生产者消费者设计模式
- 机器学习系列(18)_Kaggle债务违约预测冠军经验分享
- hex2bin 64bit