audit CIS加固性能对比

 

总结:

三组充分的对比实验:

1. 内核关闭audit

2. 内核开启但是system service disable

3. 内核开启且system service enable但无规则

4. 内核开启且system service disable且写规则(依照CIS benchmark方式加固)

指标(主要):

1. Execl

2. File Copy

3. Pipe Throughput

4. Pipe-based Context Switching

5. Process Creation

6. System Call Overhead

结论:

  1. 第一组和第二组的结果是接近几乎一致的,说明内核支持只要system关闭是不影响客户的。
  2. 第三组相比前两组性能是有一定的影响的,大部分都是在2-10%之间,只有system call overhead性能下降了32%。
  3. 第四组相比前两组性能是有很大的影响的,少数是在5-10%之间,有一些达到了30-50%,如:file copy和Pipe Throughput,特别是system call overhead性能损失严重,下降了71%。
  4. 开启CIS加固会很大程度上影响文件拷贝/系统调用开销问题,其余是小部分影响,但其中不会影响读写(随机/顺序等)。
  5. amazon和redhat加固镜像中开启了audit模块,但性能是一定受影响的。

 

Audit条目CentOS7.6AmazonAliyun开启前
CONFIG_FSNOTIFYyyy
CONFIG_IMAyynot set
CONFIG_INTEGRITYyyy
CONFIG_AUDITyynot set
CONFIG_AUDIT_ARCHyyy
CONFIG_AUDITSYSCALLyynull
CONFIG_AUDIT_WATCHyynull
CONFIG_AUDIT_TREEyynull
CONFIG_NETFILTER_XT_TARGET_AUDITmmnull
CONFIG_INTEGRITY_AUDITnullynull
CONFIG_KVM_MMU_AUDITyynot set
CONFIG_IMA_AUDITynullnull
CONFIG_HAVE_ARCH_AUDITSYSCALLnullyy

 

一、 UnixBench测试

结论:

  1. 单线程-高-影响:File Copy,Pipe Throughput,System Call Overhead
  2. 单线程-低-影响:Pipe-based Context Switching,Process Creation,Shell Scripts(copy)
  3. 多线程-高-影响:Pipe Throughput,Pipe-based Context Switching,Shell Scripts(copy)
  4. 多线程-低-影响:File Copy,System Call Overhead,Process Creation
  5. 非影响因素:是否sudo用户,是否sudo用户做benchmark限制,是否在系统层面(日志或者目录访问,提权,账户变更)做加固。

1.1 1个线程

------------------------------------------------------------------------

Benchmark Run: Wed Apr 10 2019 08:10:23 - 16:38:29

16 CPUs in system; running 1 parallel copy of tests

加固前:Dhrystone 2 using register variables       29511633.9 lps   (10.0 s, 7 samples)

加固后:---------------------------------------- 29573692.6 lps   (10.0 s, 7 samples)

加固前:Double-Precision Whetstone                     3672.8 MWIPS (9.9 s, 7 samples)

加固后:----------------------------------------- 3665.2 MWIPS (9.9 s, 7 samples)

加固前:Execl Throughput(6.6%下降)          4270.3 lps   (30.0 s, 2 samples)

加固后:------------------------------------ 3986.8 lps   (30.0 s, 2 samples)

加固前:File Copy 1024 bufsize 2000 maxblocks(35.0%下降)  988749.2 KBps  (30.0 s, 2 samples)

加固后:----------------------------------------------------- 642355.5 KBps  (30.0 s, 2 samples)

加固前:File Copy 256 bufsize 500 maxblocks(37.4%下降)  262803.5 KBps  (30.0 s, 2 samples)

加固后:--------------------------------------------------- 164420.2 KBps  (30.0 s, 2 samples)

加固前:File Copy 4096 bufsize 8000 maxblocks(29.1.0%下降) 2936522.3 KBps  (30.0 s, 2 samples)

加固后:------------------------------------------------------- 2081661.4 KBps  (30.0 s, 2 samples)

加固前:Pipe Throughput(46.6%下降)                1792076.0 lps   (10.0 s, 7 samples)

加固后:----------------------------------------   956265.1 lps   (10.0 s, 7 samples)

加固前:Pipe-based Context Switching (6.1%下降)     36441.8 lps   (10.0 s, 7 samples)

加固后:---------------------------------------------- 34194.4 lps   (10.0 s, 7 samples)

加固前:Process Creation (4.5%下降)                7526.3 lps   (30.0 s, 2 samples)

加固后:---------------------------------------- 7181.7 lps   (30.0 s, 2 samples)

加固前:Shell Scripts (1 concurrent)(7.2%下降)       7227.9 lpm   (60.0 s, 2 samples)

加固后:-------------------------------------------- 6700.3 lpm   (60.0 s, 2 samples)

加固前:Shell Scripts (8 concurrent)(9.1%下降)     3571.0 lpm   (60.0 s, 2 samples)

加固后:------------------------------------------- 3245.5 lpm   (60.0 s, 2 samples)

加固前:System Call Overhead(71.7%下降)     2688394.9 lps   (10.0 s, 7 samples)

加固后:-------------------------------------     760775.0 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX

加固前:Dhrystone 2 using register variables         116700.0   29511633.9   2528.8

加固后:----------------------------------------- 116700.0   29573692.6   2534.2

加固前:Double-Precision Whetstone                       55.0       3672.8    667.8

加固后:------------------------------------------ 55.0       3665.2    666.4

加固前:Execl Throughput                                 43.0       4270.3    993.1

加固后:-------------------------------------  43.0       3986.8    927.2

加固前:File Copy 1024 bufsize 2000 maxblocks          3960.0     988749.2   2496.8

加固后:--------------------------------------------  3960.0     642355.5   1622.1

加固前:File Copy 256 bufsize 500 maxblocks            1655.0     262803.5   1587.9

加固后:-------------------------------------------- 1655.0     164420.2    993.5

加固前:File Copy 4096 bufsize 8000 maxblocks          5800.0    2936522.3   5063.0

加固后:--------------------------------------------- 5800.0    2081661.4   3589.1

加固前:Pipe Throughput                                12440.0    1792076.0   1440.6

加固后:------------------------------------ 12440.0      956265.1     768.7

加固前:Pipe-based Context Switching                   4000.0      36441.8     91.1

加固后:----------------------------------------- 4000.0      34194.4     85.5

加固前:Process Creation                                126.0        226.9     18.0

加固后:------------------------------------  126.0       7181.7    570.0

加固前:Shell Scripts (1 concurrent)                     42.4       7227.9   1704.7

加固后:---------------------------------------- 42.4       6700.3   1580.3

加固前:Shell Scripts (8 concurrent)                      6.0       3571.0   5951.6

加固后:----------------------------------------  6.0       3245.5   5409.2

加固前:System Call Overhead                          15000.0    2688394.9   1792.3

加固后:-------------------------------------- 15000.0     760775.0     507.2

                                                                  ========

加固前:System Benchmarks Index Score                                        1031.3

加固后:--------------------------------------------------------- 1032.7

------------------------------------------------------------------------

 

1.2 16个线程

------------------------------------------------------------------------

Benchmark Run: Wed Apr 10 2019 16:38:29 - 17:06:41

16 CPUs in system; running 16 parallel copies of tests

加固前:Dhrystone 2 using register variables      444397377.0 lps   (10.0 s, 7 samples)

加固后:--------------------------------------- 447987601.1 lps   (10.0 s, 7 samples)

加固前:Double-Precision Whetstone                    57708.6 MWIPS (9.9 s, 7 samples)

加固后:---------------------------------------- 57730.9 MWIPS (9.8 s, 7 samples)

加固前:Execl Throughput(4.8%下降)               46136.6 lps   (30.0 s, 2 samples)

加固后:--------------------------------------   43888.9 lps   (30.0 s, 2 samples)

加固前:File Copy 1024 bufsize 2000 maxblocks (5.1%下降) 631571.6 KBps  (30.0 s, 2 samples)

加固后:---------------------------------------------------- 598740.6 KBps  (30.0 s, 2 samples)

加固前:File Copy 256 bufsize 500 maxblocks(5.1%下降)   164229.8 KBps  (30.0 s, 2 samples)

加固后:--------------------------------------------------- 155765.0 KBps  (30.0 s, 2 samples)

加固前:File Copy 4096 bufsize 8000 maxblocks(3.6%下降) 1977958.5 KBps  (30.0 s, 2 samples)

加固后:---------------------------------------------------  1905713.2 KBps  (30.0 s, 2 samples)

加固前:Pipe Throughput(48.5%下降)           27556701.3 lps   (10.0 s, 7 samples)

加固后:------------------------------------- 14184212.7 lps   (10.0 s, 7 samples) 

加固前:Pipe-based Context Switching(22.6%下降)      3201985.0 lps   (10.0 s, 7 samples)

加固后:-----------------------------------------------  2476089.9 lps   (10.0 s, 7 samples)

加固前:Process Creation(2.8%下降)                    58887.4 lps   (30.0 s, 2 samples)

加固后:------------------------------------------ 57202.3 lps   (30.0 s, 2 samples)

加固前:Shell Scripts (1 concurrent)(19.3%下降)          55909.7 lpm   (60.0 s, 2 samples)

加固后:----------------------------------------------- 45104.7 lpm   (60.0 s, 2 samples)

加固前:Shell Scripts (8 concurrent)(17.8%下降)                9172.0 lpm   (60.0 s, 2 samples)

加固后:--------------------------------------  7536.6 lpm   (60.0 s, 2 samples)

加固前:System Call Overhead(3.4%下降)    3863401.7 lps   (10.0 s, 7 samples)

加固后:------------------------------------  3731058.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX

加固前:Dhrystone 2 using register variables         116700.0  444397377.0  38080.3

加固后:----------------------------------------- 116700.0  447987601.1  38388.0

加固前:Double-Precision Whetstone                       55.0      57708.6  10492.5

加固后:------------------------------------------ 55.0      57730.9  10496.5

加固前:Execl Throughput                                 43.0      46136.6  10729.4

加固后:------------------------------------- 43.0      43888.9  10206.7

加固前:File Copy 1024 bufsize 2000 maxblocks          3960.0     631571.6   1594.9

加固后:-------------------------------------------- 3960.0     598740.6   1512.0

加固前:File Copy 256 bufsize 500 maxblocks            1655.0     164229.8    992.3

加固后:-------------------------------------------- 1655.0     155765.0    941.2

加固前:File Copy 4096 bufsize 8000 maxblocks          5800.0    1977958.5   3410.3

加固后:-------------------------------------------- 5800.0    1905713.2   3285.7

加固前:Pipe Throughput                               12440.0   27556701.3  22151.7

加固后:-----------------------------------  12440.0   14184212.7  11402.1

加固前:Pipe-based Context Switching                   4000.0    3201985.0   8005.0

加固后:----------------------------------------- 4000.0    2476089.9   6190.2

加固前:Process Creation                                 126.0      58887.4   4673.6

加固后:------------------------------------- 126.0      57202.3   4539.9

加固前:Shell Scripts (1 concurrent)                     42.4      55909.7  13186.3

加固后:---------------------------------------- 42.4      45104.7  10637.9

加固前:Shell Scripts (8 concurrent)                       6.0       9172.0  15286.6

加固后:----------------------------------------- 6.0       7536.6  12561.1

加固前:System Call Overhead                          15000.0    3863401.7   2575.6

加固后:-------------------------------------- 15000.0    3731058.8   2487.4

                                                                  ========

加固前:System Benchmarks Index Score                                        6810.4

加固后:--------------------------------------------------------- 5969.6

------------------------------------------------------------------------

 

二、 fio测试

结论:

  1. 读写测试性能几乎不受影响。

测试分为如下几类:

  fio <测试纬度> <bs> <iodep> <jobs> <rw>
# do bandwidth tests
  fio bandwidth 128k 128 1 read
  fio bandwidth 128k 128 1 write

# do latency test
  fio latency 4k 1 1 read
  fio latency 4k 1 1 write
  fio latency 4k 1 1 randread
  fio latency 4k 1 1 randwrite
  
# do iops tests
  fio iops 4k 32 4 randread
  fio iops 4k 32 4 randwrite
  fio iops 4k 32 4 randrw

 

测试设置:

[global]

ioengine=libaio

bs=4k

iodepth=1

direct=1

time_based

directory=./

group_reporting

runtime=30

size=10g

fallocate=none

[tester]

rw=read

numjobs=1

 

测试命令:

sudo fio fio.config --append-terse --output=/sdk/jasonxing.xwl/fio_result.log

 

1.1 bandwidth read

加固前:read : io=14407MB, bw=491206KB/s, iops=3837, runt= 30033msec

加固后:read : io=14428MB, bw=491918KB/s, iops=3843, runt= 30033msec

 

1.2 bandwidth write

加固前:write: io=12011MB, bw=409239KB/s, iops=3197, runt= 30054msec

加固后:write: io=12417MB, bw=423306KB/s, iops=3307, runt= 30038msec

 

1.3 latency read

加固前:read : io=2139.5MB, bw=73024KB/s, iops=18256, runt= 30001msec

加固后:read : io=2135.4MB, bw=72888KB/s, iops=18221, runt= 30000msec

 

1.4 latency write

加固前:write: io=1884.2MB, bw=64313KB/s, iops=16078, runt= 30000msec

加固后:write: io=1886.4MB, bw=64374KB/s, iops=16093, runt= 30001msec

 

1.5 latency randread

加固前:read : io=873432KB, bw=29113KB/s, iops=7278, runt= 30001msec

加固后:read : io=871956KB, bw=29064KB/s, iops=7266, runt= 30001msec

 

1.6 latency randwrite

加固前:write: io=1868.4MB, bw=63771KB/s, iops=15942, runt= 30001msec

加固后:write: io=1883.3MB, bw=64278KB/s, iops=16069, runt= 30001msec

 

1.7 iops randread

加固前:read : io=6008.7MB, bw=205074KB/s, iops=51268, runt= 30003msec

加固后:read : io=6013.3MB, bw=205230KB/s, iops=51307, runt= 30003msec

 

1.8 iops randwrite

加固前:write: io=4775.6MB, bw=162967KB/s, iops=40741, runt= 30004msec

加固后:write: io=4761.9MB, bw=162514KB/s, iops=40628, runt= 30004msec

 

1.9 iops randrw

加固前:read : io=2646.3MB, bw=90314KB/s, iops=22578, runt= 30004msec

加固后:read : io=2641.5MB, bw=90139KB/s, iops=22534, runt= 30003msec

 

加固前:write: io=2636.6MB, bw=89986KB/s, iops=22496, runt= 30003msec

加固后:write: io=2633.2MB, bw=89870KB/s, iops=22467, runt= 30003msec

 

三、dd测试

结论:

  1. 读写测试性能几乎不受影响。

$dd bs=1M count=20000 if=/dev/zero of=test.dd conv=fdatasync

加固前:20971520000 bytes (21 GB) copied, 57.6266 s, 364 MB/s

加固后:20971520000 bytes (21 GB) copied, 58.8594 s, 356 MB/s

 

$dd bs=1M count=20000 if=/dev/zero of=test.dd.2 conv=fsync

加固前:20971520000 bytes (21 GB) copied, 58.179 s, 360 MB/s

加固后:20971520000 bytes (21 GB) copied, 58.815 s, 357 MB/s

 

$dd bs=1M count=20000 if=/dev/zero of=test.dd oflag=dsync

加固前:20971520000 bytes (21 GB) copied, 73.6669 s, 285 MB/s

加固后:20971520000 bytes (21 GB) copied, 73.5859 s, 285 MB/s

 

$dd bs=1M count=20000 if=/dev/zero of=test.dd.2 oflag=sync

加固前:20971520000 bytes (21 GB) copied, 75.5267 s, 278 MB/s

加固后:20971520000 bytes (21 GB) copied, 74.4605 s, 282 MB/s

 

3. UnixBench测试

结论:

  1. 影响项:File Copy,Pipe Throughput,System Call Overhead
  2. 非影响因素:是否sudo用户,是否sudo用户做benchmark限制,是否在系统层面(日志或者目录访问,提权,账户变更)做加固。

加固前后对比(仅1个线程):

------------------------------------------------------------------------

Benchmark Run: Tue Apr 09 2019 19:12:33 - 19:40:24

32 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       28994799.5 lps   (10.0 s, 7 samples)

-- 加固后:----------------------------- 28971632.2 lps   (10.0 s, 7 samples)

Double-Precision Whetstone                     2094.8 MWIPS (10.0 s, 7 samples)

-- 加固后:------------------------------ 2091.2 MWIPS (10.0 s, 7 samples)

Execl Throughput                               3330.4 lps   (30.0 s, 2 samples)

-- 加固后:------------------------- 3200 (30.0 s, 2 samples)

File Copy 1024 bufsize 2000 maxblocks        790834.6 KBps  (30.0 s, 2 samples)

-- 加固后:--------------------------------  651098.1 KBps  (30.0 s, 2 samples)

File Copy 256 bufsize 500 maxblocks          210153.4 KBps  (30.0 s, 2 samples)

-- 加固后:------------------------------- 172194.0 KBps  (30.0 s, 2 samples)

File Copy 4096 bufsize 8000 maxblocks       2455179.0 KBps  (30.0 s, 2 samples)

-- 加固后:-------------------------------- 1993955.9 KBps  (30.0 s, 2 samples)

Pipe Throughput                             1595619.4 lps   (10.0 s, 7 samples)

-- 加固后:----------------------- 1092480.9 lps   (10.0 s, 7 samples)

Pipe-based Context Switching                 115385.4 lps   (10.0 s, 7 samples)

-- 加固后:----------------------------- 107857.0 lps   (10.0 s, 7 samples)

Process Creation                               7973.0 lps   (30.0 s, 2 samples)

-- 加固后:------------------------- 7833.9 lps   (30.0 s, 2 samples)

Shell Scripts (1 concurrent)                   7320.2 lpm   (60.0 s, 2 samples)

-- 加固后:---------------------------- 7042.4 lpm   (60.0 s, 2 samples)

Shell Scripts (8 concurrent)                   3897.5 lpm   (60.0 s, 2 samples)

-- 加固后:---------------------------- 3717.4 lpm   (60.0 s, 2 samples)

System Call Overhead(62.4%下降)    2733357.9 lps   (10.0 s, 7 samples)

-- 加固后:--------------------------- 1026018.0 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX

Dhrystone 2 using register variables         116700.0   28994799.5   2484.6

-- 加固后:------------------------------ 116700.0   28971632.2   2482.6

Double-Precision Whetstone                       55.0       2094.8    380.9

-- 加固后:-------------------------------- 55.0       2091.2    380.2

Execl Throughput                                 43.0       3330.4    774.5

-- 加固后:--------------------------- 43.0       3200.8    744.4

File Copy 1024 bufsize 2000 maxblocks          3960.0     790834.6   1997.1

-- 加固后:---------------------------------- 3960.0     651098.1   1644.2

File Copy 256 bufsize 500 maxblocks            1655.0     210153.4   1269.8

-- 加固后:--------------------------------- 1655.0     172194.0   1040.4

File Copy 4096 bufsize 8000 maxblocks          5800.0    2455179.0   4233.1

-- 加固后:---------------------------------- 5800.0    1993955.9   3437.9

Pipe Throughput                               12440.0    1595619.4   1282.7

-- 加固后:------------------------- 12440.0    1092480.9    878.2

Pipe-based Context Switching                   4000.0     115385.4    288.5

-- 加固后:------------------------------- 4000.0     107857.0    269.6

Process Creation                                126.0       7973.0    632.8

-- 加固后:-------------------------- 126.0       7833.9    621.7

Shell Scripts (1 concurrent)                     42.4       7320.2   1726.5

-- 加固后:----------------------------- 42.4       7042.4   1660.9

Shell Scripts (8 concurrent)                      6.0       3897.5   6495.8

-- 加固后:------------------------------ 6.0       3717.4   6195.7

System Call Overhead                          15000.0    2733357.9   1822.2

-- 加固后:--------------------------- 15000.0    1026018.0    684.0

                                                                  ========

System Benchmarks Index Score                                        1353.0

-- 加固后:---------------------------------------------- 1128.9

------------------------------------------------------------------------

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值