Linux安全和openssl、gpg加密

                 Linux安全和opensslgpg加密

本章内容:

安全机制

对称加密

不对称加密

散列算法

PKICA

openssl

证书管理

gpg

 

加密需要:

不加密的流量易受攻击性

密码/数据嗅探

数据操作

验证操作

相当于邮寄明信片

 

不安全的传统协议:

telnetftppop3、等;不安全密码

httpsmtpnfs、等;不安全信息

ldapnisrsh、等;不安全验证

 

安全机制:

NIST(美国国家标准与技术研究院)定义的安全属性:

保密性:

    数据保密性;

    隐私性;

完整性:

    不可篡改

    数据完整性

    系统完整性

可用性

    可扩展性

安全攻击:

   spoofing(假冒)、tampering(篡改)、repudiation(否认)、informationdisclosure(信息泄露)、denial of service(拒绝服务)、elevation of privilege(提升权限)

安全机制:

    加密、数字签名、访问控制、数据完整性、认证交换、流量填充、路由控制、公证

安全服务:

    认证

    访问控制

    数据保密性

    链接保密性

    无连接保密性

    选择域保密性

    流量保密性

    数据完整性

    不可否认性

 

设计基本原则:

使用成熟的安全系统

以小人之心度输入数据

外部系统是不安全的

最小授权

减少外部接口

缺省使用外部接口

缺省使用安全模式

安全不是似是而非

stride思考

在入口处检查

从管理上保护好你的系统

 

安全算法:

常用安全技术

   认证

   授权

   安全通信

   审计

密码算法和协议

   对称加密

   公钥加密

   单向加密

   认证协议

Linux系统:opensslgpggpg协议的实现)

 

对称加密算法:

对称加密:加密和解密使用同一个秘钥

   DESdata encryption standard 56bits

    3DES

   AESadvanced128 192 256bits

  IDEARC6CAST5

   特性:

     1、加密、解密使用同一个秘钥,效率高;

     2、将原始数据分隔成固定大小的块,逐个进行加密

   缺陷:

     1、秘钥过多

     2、秘钥分发

     3、数据来源无法确认

 

非对称加密算法:

公钥加密:秘钥是成对出现

公钥:公开所有人:public key

私钥:自己留存,必须保证其私密性,secret key

  特点:

     用公钥加密数据,只能使用与之配对的私钥解密:反之亦然。

  功能:

     数字签名:主要在于让接受方确认发送方身份;

     对称秘钥交换:发送方用对方的公钥加密一个对称秘钥后发送给对方;

     数据加密:适合加密较小的数据;

   缺点:密钥长,加密解密效率低下;

   算法:RSA(加密、数字签名)DSA(数字签名)

 基于一对公钥/密钥对:

       用密钥对中的有个加密,另一个解密

  实现加密:

    接收者:

         生成公钥/密钥对:ps

         公开公钥p,保密密钥s

    发送者:  

     使用接受者的公钥来加密消息m

     pm)发送给接受者

接收者:

    使用密码S来解密:M=Spm))

实现数字签名:

     发送者:

       生成公钥/密钥对:ps

       公开公钥p,保密密钥 s

       使用密钥s来加密消息m

       发送给接收者sm

     接收者:

       使用发送者的公钥来解密M=Ps(m)

    结合签名和加密:

    分离签名:

 

单向散列:

将任意数据缩小成固定大小的“指纹”

   任意长度输入

   固定长度输入

   若修改数据,指纹也会改变(不会产生冲突)

   无法从指纹中重新生成数据(单向)

功能:数据完整性

常见算式:

    md5128bits sha1:160bitssha224sha256sha384sha512

 

 检查MD5加密的文件是否被改过:

    [root@centos7 ~]# md5sum f1 > f1.md5

    [root@centos7 ~]# md5sum –check f1.md5

    f1: OK

    [root@centos7 ~]#

 

常用工具:

    MD5sumsha1sumopenssl rpm -V

 密钥交换:IKEInternet key exchange

   公钥加密:DHDeffie-Hellman

   DH

     1Aa,p协商生成公开的整数a,大素数p

        Ba,p

     2A:生成隐私数据:xx<p,计算的出a^y%p,发送给A

        B:生成隐私数据:y,计算得出a^y%p,发送给A

     3A:计算得出(a^y%p^x=a^xy%p,生成为密钥

        B:计算得出(a^x%p^y=a^xy%p,生成为密钥

 

CA和证书:

PKIpublic key infrastructure

 签证机构:CA

 注册机构:RA

 证书吊销列表:CRL

 证书取存库

 

X.509定义了证书的结构以及认证协议标准:

     版本号      主体公钥

     序列号      CRL分发点

     签名算法    扩展信息

     颁发者      发行者签名

     有效期限

     主体名称

 

证书获取:

     证书类型:

       证书授权机构的证书

       服务器

       用户证书

获取证书的两种方法:

    使用证书授权机构:

        生成签名请求(csr

        将(csr)发送给CA

        CA处接受签名

自签名的证书:

    自己签发自己的公钥

 

安全协议:

sslsecure socket layer

功能:机密性、认证、完整性、重放保护

两阶段协议:分为握手阶段和应用阶段

   握手阶段(协商阶段):客户端和服务器端认证对方的身份,(依赖于PKI体系,利用数字证书进行身份认证),并协商通信中使用的安全参数、密码套件以及主密钥。后续通信使用的所有密钥都是通过Mastersecret生成。

   应用阶段:在握手阶段完成后进入,在应用阶段通信双方使用握手阶段协商好的密钥进行安全通信。

 

SSL/TLS

  SSL protocolssl 协议):

  Handshake协议:包括协商安全参数和密码套件、服务器身份验证(客户端身份认证可选)、密钥交换。

  ChangCipherspec协议:一条消息表明握手协议已经完成。

  Alert协议:对握手协议中的一些异常的错误提醒,分为fatalwarning两个级别,fatal类型错误会直接中断ssl链接,而warning级别的错误ssl链接仍可继续,只是会给出错误警告。

  Record协议:包括对消息的分段、压缩、消息认证和完整性保护、加密等。

  HTTPS协议:就是“http”协议和“ssl/tls”协议的组合。http over ssl http over tls,对http协议的文本数据进行加密处理后,成为二进制形式传输。

 

openssl开源项目:

   三个组件:

     openssl:多用途的命令行工具;

     libcrypot:加密算法库

     libssl:加密模块应用库,实现了ssltls

   openssl命令:

     两种运行模式:交互模式和批处理模式;

     openssl version:程序版本号;

     标准命令、消息摘要命令、加密命令

     标准命令:enccareqdgstpasswd

 

openssl命令:

     对称加密:

       enc命令:对称加密

 

       示例:加密

         加密/root/fstab文件,把加密后的文件保存至fstab.des3文件中,删除原有文件。

          [root@centos7 ~]# openssl  enc -e -des3 -a -salt -in  fstab  -out fstab.des3

          [root@centos7 ~]#rm -rf /root/fstab

 

       示例:解密

          对刚才加密的/root/fstab文件解密,解密成原文件名;

          [root@centos7 ~]# openssl enc -d -des3 -a -salt -in fstab.des3  -out fstab

 

      单向加密:

     工具: md5128bits sha1:160bitssha224sha256sha384sha512

    dgst命令: openssl  dgst

 

     示例:

     1、使用MD5fstab文件单向加密

       [root@centos7 ~]# openssl  dgst  -md5 fstab

       MD5(fstab)= 7821f49dddb994d0156cdc784a8863b6

       [root@centos7 ~]#

 

    2、同时还可以使用:MD5sum   –check  file 将保存到指定文件中的MD5单向加密值,实时检查文件是否被篡改;

       [root@centos7 ~]# openssl dgst -md5 fstab > f1.md5

       [root@centos7 ~]# cat f1.md5

       MD5(fstab)= 7821f49dddb994d0156cdc784a8863b6

       [root@centos7 ~]# md5sum –check f1.md5

       fstab: OK

       [root@centos7 ~]#

 

  生成用户加密口令:

      passwd命令:man  sslpasswd

      openssl    passwd   -1  -salt   #####    SALT(最多8)

 

          示例:

            为用户生成一个加密口令:

            [root@centos7 ~]# openssl  passwd -1 -salt "123456"  centos

            $1$123456$3GFsiB8xUJ7EaYT.K6Spz0

            [root@centos7 ~]#

 

      生成随机数:

            openssl  rand  -base64 | -hex  number(指定数字)

            

           示例:生成随机数

             [root@centos7 ~]# openssl rand -base64 10

             9cqdc7tAaCE5KQ==

             [root@centos7 ~]#

             

      生成密钥对儿(非对称加密):man  genrsa

        生成私钥:

           openssl   genrsa   -out  /PATH/TO/PRIVATE.FILE NUM_BITS

           des:给私钥文件设置个密码;

        从私钥中提取公钥:

           openssl  rsa   -in PRIVATE.FILE  -pubout   PUBLICKEY.FIEL

 

        示例:

         生成私钥文件,在子shell中执行需加上():

         [root@centos7 ~]# (umask 066;openssl genrsa -out key.private -des 2048 )

 

         生成私钥文件的权限600

         [root@centos7 ~]# ll key.private

         -rw——- 1 root root 1738 oct  2 10:35 key.private

         [root@centos7 ~]

 

         从私钥中提取公钥:

         [root@centos7 ~]# openssl rsa -in key.private -pubout -out key.public

         Enter pass phrase for key.private:

         writing RSA key

         [root@centos7 ~]#

 

         生成公钥文件的权限644

         [root@centos7 ~]# ll key.public

         -rw-r–r– 1 root root 451 oct  2 10:47 key.public

         [root@centos7 ~]

    

随机数生成器:伪随机数

    键盘和鼠标

    块设备中断

    /dev/random:仅从熵池返回随机数;随机数用尽,阻塞;

    /dev/urando:从熵池返回随机数,随机数用尽,利用软件生成伪随机数,非阻塞。

       

opensslPKIpublic key  infraStructure

        

 

创建私有CA和申请证书:

创建私有CA

  openssl的配置文件:/etc/pki/tls/openssl.cnf

 

1)创建所需要的文件:

      创建CA数据库文件;

  touch   /etc/pki/CA/index.txt

 

  创建CA数据库索引编号文件;

  echo 01 > /etc/pki/CA/serial

 

(2)CA自签证书:

     生成私钥;

     umask 066; openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048

 

     生成自签名证书:

      openssl  req  -new   -x509  -key  /etc/pki/CA/private/cakey.pem  -days 7300  -0ut

   /etc/pki/CA/cacert.pem

         

          req:申请证书;

         -out:证书的保存路径;

         -new:申请新证书;

         -x509:生成专用于CA的自签证书;

         -key:生成请求时用到的私钥文件;

         -days:证书的有效期;

 

     颁发证书:

       在需要使用证书的主机生成证书请求:

 

      1、 给web服务器生成私钥:

         (umask 066;openssl genrsa -out /etc/httpd/ssl/httpkey.private 2048)

 

      2、生成证书申请文件:

         openssl req -new -key /etc/httpd/ssl/httpkey.private  -days 365 -out /etc/httpd/ssl/httpd.csr

 

      3、将证书申请文件传输给CA

 

      4CA签署证书,并将证书颁发给请求者;

         openssl ca -in /root/httpd.csr -out /etc/pki/CA/certs/httpd.crt -days 365

 

      5、查看证书中的信息;

      openssl  x509  -in /etc/pki/CA/cacert.pem  -noout -text

 

  6、吊销证书;

         openssl  ca  -revoke  /etc/pki/CA/newcerts/SERIAL.pem

 

      7、生成吊销证书编号(第一次吊销一个证书时才需要执行)

         echo "01"  > /etc/pki/CA/crlnumber

 

      8、更新证书吊销列表;

         openssl  ca -gencrl -out /etc/pki/CA/crl/ca.crl

  

     9、查看吊销的crl证书文件;

     openssl crl -in /etc/pki/CA/crl/ca.crl  -noout -text

 

示例:搭建私有CA

   

   *根据openssl的配置文件:/etc/pki/tls/openssl.cnf中定义的文件路径来创建所需文件。

 

(1)创建所需的文件:

     [root@centos7 ~]# touch /etc/pki/CA/index.txt   //创建CA数据库文件

     [root@centos7 ~]# echo "01" > /etc/pki/CA/serial //创建CA数据库索引编号文件

     [root@centos7 ~]# cat /etc/pki/CA/serial

     01

     [root@centos7 ~]#

     

(2)CA自签证书:

 

   1)生成私钥;

     [root@centos7 ~]# (umask 066;openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048)

     Generating RSA private key, 2048 bit long modulus

     …………………………………………………………………………………………………………………………+++

     ……….+++

     e is 65537 (0x10001)

     [root@centos7 ~]#

 

  2)生成自签名证书;

     1[root@centos7 ~]# openssl  req -new -x509 -key /etc/pki/CA/private/cakey.pem -days 7300  -out /etc/pki/CA/cacert.pem

       You are about to be asked to enter information that will be incorporated

        into your certificate request.

        What you are about to enter is what is called a Distinguished Name or a DN.

        There are quite a few fields but you can leave some blank

        For some fields there will be a default value,

        If you enter '.', the field will be left blank.

         —–

        Country Name (2 letter code) [XX]:CN

        State or Province Name (full name) []:beijing

        Locality Name (eg, city) [Default City]:bj

        Organization Name (eg, company) [Default Company Ltd]:mage.com

        Organizational Unit Name (eg, section) []:m20-1

        Common Name (eg, your name or your server's hostname) []:centos7

        Email Address []:admin@magedu.com

        root@centos7 ~]#

 

2)查看所生成的证书:

   root@centos7 CA]# openssl  x509  -in /etc/pki/CA/cacert.pem  -noout -text

   同样也可以copyWindows桌面进行查看,但需要更改证书后缀名为:xxx.cer

 

(3)颁发证书:

     

     1)在需要使用证书的主机生成证书请求:

        例:给www.magedu.com  web服务器申请证书。

        (实验环境说明:CA server为:centos7  web server为:centos6

   

        首先在web服务器中生成一个私钥文件,用私钥文件生成证书申请文件;并将证书申请文件传送给CA

 

        第一步:在web服务器(centos6)中生成一个私钥文件:

        [root@centos6 Desktop]# mkdir /etc/httpd/ssl

        [root@centos6 ]# (umask 066;openssl genrsa -out /etc/httpd/ssl/httpkey.private 2048)

        Generating RSA private key, 2048 bit long modulus

        ………………………+++

        ……………………………………………………………………………………………………………………+++

        e is 65537 (0x10001)

        [root@centos6 Desktop]#

 

        第二步:生成证书申请文件:

        [root@centos6 Desktop]# openssl req -new -key /etc/httpd/ssl/httpkey.private  -days 365 -out /etc/httpd/ssl/httpd.csr

        You are about to be asked to enter information that will be incorporated

        into your certificate request.

        What you are about to enter is what is called a Distinguished Name or a DN.

        There are quite a few fields but you can leave some blank

        For some fields there will be a default value,

        If you enter '.', the field will be left blank.

        —–

        Country Name (2 letter code) [XX]:CN

        State or Province Name (full name) []:beijing

        Locality Name (eg, city) [Default City]:bj

        Organization Name (eg, company) [Default Company Ltd]:magedu.com

        Organizational Unit Name (eg, section) []:m20-1

        Common Name (eg, your name or your server's hostname) []:www.magedu.com

        Email Address []:root@magedu.com

 

        Please enter the following 'extra' attributes

        to be sent with your certificate request

        A challenge password []:

        An optional company name []:

        [root@centos6 Desktop]#

 

        第三步:将证书申请文件通过scp传送给CA

        [root@centos6 Desktop]# scp /etc/httpd/ssl/httpd.csr 192.168.3.11:/root

 

        第四步:CA签署证书,并将证书颁发给请求者;并将证书保存到/etc/pki/CA/certs/目录下。

        [root@centos7 CA]# openssl ca -in /root/httpd.csr -out /etc/pki/CA/certs/httpd.crt -days 365

            

如果该证书存在违法行为,我们该如何吊销此证书呢?

 

   吊销www.magedu.com的证书:

       [root@centos7 newcerts]# openssl  ca -revoke  /etc/pki/CA/newcerts/01.pem

       Using configuration from /etc/pki/tls/openssl.cnf

       Revoking Certificate 01.

       Data Base Updated

       [root@centos7 newcerts]#

 

   生成吊销证书的编号(第一次吊销一个证书时才需要执行)

       [root@centos7 CA]# echo "01"  > /etc/pki/CA/crlnumber

       [root@centos7 CA]#

 

更新证书吊销列表;

   [root@centos7 crl]# openssl  ca  -gencrl -out /etc/pki/CA/crl/ca.crl

   Using configuration from /etc/pki/tls/openssl.cnf

   [root@centos7 crl]#

 

查看吊销的crl证书文件;

   [root@centos7 crl]# openssl crl -in /etc/pki/CA/crl/ca.crl  -noout -text

 

使用gpg实现对称加密:

     对称加密file文件:

      gpg   -c   file  选项: -c:对称加密

      注:加密后的文件会以file.gpg结尾,如果在同一台机器上解密是不用输入密码的。

     

     在另一台主机上解密file

      gpg   -o  file   -d file.gpg  选项:-o:重定向   -d:解密

      

     示例:

      centos7主机上使用gpg加密一个文件,在centos6上解密这个文件,这样可以防止别人偷拷贝你的数据。

      [root@centos7 ~]# gpg -c fstab  //加密后的文件会以fstab.gpg结尾。

      [root@centos6 ~]# gpg -o fstab -d fstab.gpg  //fstab.gpg文件解密到fstab文件中。

 

  使用gpg工具实现公钥加密:

      1)在主机上生成公钥/私钥对儿

         gpg   –gen-key

       注意:生成的公钥私钥文件放在了/root/.gnupg目录下。

  

      2)在主机上查看公钥

         gpg   –list-key

 

      3)在主机中导出公钥到指定的文件中

         gpg   -a  –export  -o  file  选项: -a:表示使用base64机制编码

       注:因为默认的公钥文件是无法使用命令查看的。

 

      4)从A本机复制公钥文件到B主机上加密

          使用scp命令

 

     5)在B主机中导入A主机的公钥

         gpg   —import  file

 

     6)用从A主机导入的公钥,加密B主机的文件file,生成file.gpg

         gpg  -e   -r   PUBLIC_UID  file

         选项:

               -e:加密。

               -r:指定使用哪个 PUBLIC_UID加密文件。

   

     7)复制加密文件到A主机:

         scp   file.gpg   A主机

 

     8)在A主机中解密文件:

         gpg   -d   file.gpg

         gpg   -o file   -d  file.gpg

 

     9)删除公钥和私钥

         gpg   –delete-keys  PUBLIC_UID

         gpg   –delete-secret-keys  PUBLIC_UID (如果私钥存在要先删除私钥)

 

示例:

  使用gpg工具实现公钥加密:

实验环境:在centos7上使用gpg工具生成公钥/私钥密钥对儿,然后把公钥copycentos6主机上,使用centos7的公钥加密文件,然后把加密后的文件在copycentos7上,使用centos7的私钥进行解密该文件。

 

1、centos7上生成公钥/私钥密钥对儿:

       [root@centos7 ~]# gpg –gen-key

    

2、可以使用gpg –list-key进行查看公钥

   [root@centos7 ~]# gpg –list-keys

   /root/.gnupg/pubring.gpg

   ————————

   pub   1024R/0379276C 2016-10-03

   uid                  zhengyibo <root@magedu.com>

   sub   1024R/CF708D9E 2016-10-03

 

   [root@centos7 ~]#

 

3、centos7中的公钥文件以base64机制导入到一个新文件中:

       [root@centos7 ~]# gpg -a –export -o ./zheng.public

 

4、使用scp命令将zheng.public公钥文件copycentos6中。

   [root@centos7 ~]# scp ./zheng.public 192.168.3.2:/root

 

5、centos6中将/root/zheng.public公钥导入到/root/gnupg/pubring.gpg文件中。

       [root@centos6 .gnupg]# gpg –import /root/zheng.public

       gpg: key 0379276C: public key "zhengyibo <root@magedu.com>" imported

       gpg: Total number processed: 1

       gpg:               imported: 1  (RSA: 1)

       [root@centos6 .gnupg]#

 

     * 使用gpg  –list-key进行查看:

       [root@centos6 .gnupg]# gpg –list-key

       /root/.gnupg/pubring.gpg

       ————————

       pub   1024R/0379276C 2016-10-03

       uid                  zhengyibo <root@magedu.com>

       sub   1024R/CF708D9E 2016-10-03

 

       [root@centos6 .gnupg]#

 

6、测试,使用centos7中生成的公钥文件,加密centos6中的文件。

   注:建议不要加密过大的文件,因为文件过大,加密速度会很慢。

   [root@centos6 ~]# vim testgpg

   [root@centos6 ~]# cat testgpg

   kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

   knknkkkkkkkkkkkkkkkkkkkkkkk

   jjjjjjjjjjjjjjjjjjj

   ccccccccccccccccccccccc

   [root@centos6 ~]# gpg -e -r zhengyibo testgpg

   gpg: CF708D9E: There is no assurance this key belongs to the named user

 

   pub  1024R/CF708D9E 2016-10-03 zhengyibo <root@magedu.com>

   Primary key fingerprint: 7F2D 8D74 E242 DCC9 FFD1  D30D F987 C0DB 0379 276C

      Subkey fingerprint: 0E93 FD5A 7B46 2F12 9A61  BA1C D21F BBC5 CF70 8D9E

 

   It is NOT certain that the key belongs to the person named

   in the user ID.  If you *really* know what you are doing,

   you may answer the next question with yes.

 

   Use this key anyway? (y/N) y

   [root@centos6 ~]#

 * 在当前目录使用ls命令查看生成的testgpg.gpg文件。

 

7、使用scp命令copy  testgpg.gpgcentos7主机中。

       [root@centos6 ~]# scp ./testgpg.gpg 192.168.3.11:/root

 

8、在centos7中解密testgpg.gpg文件。

   [root@centos7 ~]# ggp -d testgpg.gpg

 

* testgpg.gpg加密文件重定向到指定的文件中。

  [root@centos7 ~]# gpg -o test -d testgpg.gpg

  [root@centos7 ~]# cat test

  kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

  knknkkkkkkkkkkkkkkkkkkkkkkk

  jjjjjjjjjjjjjjjjjjj

  ccccccccccccccccccccccc

  [root@centos7 ~]#

 

   9、删除centos6上的公钥文件,删除centos7上的公钥/私钥文件

      [root@centos6 ~]# gpg –delete-key zhengyibo   //centos6上的公钥文件

      

      [root@centos7 ~]# gpg –delete-secret-key zhengyibo   //centos7上的私钥文件

      [root@centos7 ~]# gpg –delete-key zhengyibo         //centos7上的公钥文件

 

 注意:在删除公钥时,如果私钥存在,一定要先删除私钥在去删除公钥文件。

 

 

 

 

 

     

 

 

 

 

 

  

 

 

 

 

原创文章,作者:zhengyibo,如若转载,请注明出处:http://www.178linux.com/50307

(1)
上一篇 2016-10-09 08:31
下一篇 2016-10-09 09:02

相关推荐

  • 设计模式(十一)代理模式Proxy(结构型)

    1.概述        因为某个对象消耗太多资源,而且你的代码并不是每个逻辑路径都需要此对象, 你曾有过延迟创建对象的想法吗 ( if和else就是不同的两条逻辑路径) ? 你有想过限制访问某个对象,也就是说,提供一组方法给普通用户,特别方法给管理员用户?以上两种需求都非常类似,并且都需要解决一个更大的问题:你如何提供…

    Linux干货 2015-07-09
  • Linux DNS服务系列之原理介绍及正反向解析配置

    前言 我们在访问一个网站的时候,只要输入该网站的网址就会跳转到该网站页面,而实现这一过程就需要DNS服务器将域名解析为IP地址,进而实现数据通信。那么DNS服务器是如何工作的呢?本系列分为两部分,本文将详解DNS服务原理及正反向解析配置。 DNS服务原理详解 DNS相关知识 DNS:Domain Name Service,域名解析服务 监听端口:udp/53…

    Linux干货 2015-04-13
  • linux用户,组及权限管理

      写在前面: 本博客详解命令如下: useradd, userdel,usermod, passwd,  chage, groupadd,  groupdel, groupmod, gpasswd ,newgrp, chsh, id, su,  chmod,  chowm,  chgrp, &nb…

    Linux干货 2015-12-19
  • 推荐-HA专题: 编译安装并配置DRBD

    HA专题: 编译安装并配置DRBD 前言 实验环境 DRBD介绍 安装前准备工作 获取并编译安装DRBD 配置DRBD 分区 配置文件 启动并设置DRBD 格式化并挂载 验证冗余性 总结 前言 上篇我们讲到使用corosync+pacemaker实现MySQL高可用, 但是NFS容易成为单点故障从而导致数据丢失等严重问题, 我们可以使用drbd来实现MySQ…

    Linux干货 2016-04-12
  • corosync + pacemaker + iscsi实现高可用mysql (下)

    上一篇讲的安装配置iscsi,本章介绍mariadb安装以及高可用的mysql具体实现 一、安装配置mariadb [root@SQL1 ~]# tar xf mariadb-5.5.36-linux-x86_64.tar.gz  -C /usr/local \\解压软件包 [r…

    Linux干货 2015-07-09
  • 系统基础之用户,组及权限管理

    用户及组详解 概论:   现今,大多数操作系统都是多用户(Multi-tasks)多任务(Mulit-Users)的系统.在多年前,计算机资源远没有现在这么丰富,都是多人使用同一台计算机,为了保障使用计算机的用户权益不受到损害,完成资源使用隔离,人们采取了用户机制标识使用者的方法.  每个使用者都是用户,用户是由UID进行标识,通过密码进…

    Linux干货 2016-08-04