-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
executable file
·2515 lines (1146 loc) · 77.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">
<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">
<link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">
<meta name="keywords" content="Hexo, NexT">
<meta name="keywords" content="bmc linux">
<meta property="og:type" content="website">
<meta property="og:title" content="Ruixia,Sun's Technique Blog">
<meta property="og:url" content="https://sunleaf2002.github.io/index.html">
<meta property="og:site_name" content="Ruixia,Sun's Technique Blog">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Ruixia,Sun's Technique Blog">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Gemini',
version: '5.1.4',
sidebar: {"position":"right","display":"always","offset":12,"b2t":false,"scrollpercent":true,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="https://sunleaf2002.github.io/">
<title>Ruixia,Sun's Technique Blog</title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container sidebar-position-right
page-home">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">Ruixia,Sun's Technique Blog</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle">Record the step of upgrading......</p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br>
首页
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section">
<i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
标签
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br>
分类
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
归档
</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about/" rel="section">
<i class="menu-item-icon fa fa-fw fa-user"></i> <br>
关于
</a>
</li>
<li class="menu-item menu-item-search">
<a href="javascript:;" class="popup-trigger">
<i class="menu-item-icon fa fa-search fa-fw"></i> <br>
搜索
</a>
</li>
</ul>
<div class="site-search">
<div class="popup search-popup local-search-popup">
<div class="local-search-header clearfix">
<span class="search-icon">
<i class="fa fa-search"></i>
</span>
<span class="popup-btn-close">
<i class="fa fa-times-circle"></i>
</span>
<div class="local-search-input-wrapper">
<input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
</div>
</div>
<div id="local-search-result"></div>
</div>
</div>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="https://sunleaf2002.github.io/2020/05/19/Postman工具在openbmc中的使用举例/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ruixia,sun">
<meta itemprop="description" content>
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Ruixia,Sun's Technique Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2020/05/19/Postman工具在openbmc中的使用举例/" itemprop="url">Postman工具在openbmc中的使用举例</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2020-05-19T10:45:04+08:00">
2020-05-19
</time>
</span>
<span class="post-category">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/bmc/" itemprop="url" rel="index">
<span itemprop="name">bmc</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="一、用root账号登录并生成token"><a href="#一、用root账号登录并生成token" class="headerlink" title="一、用root账号登录并生成token"></a>一、用root账号登录并生成token</h2><p>1.创建一个用例,路径是 <a href="https://IP/login,post方法" target="_blank" rel="noopener">https://IP/login,post方法</a><br>2.声明数据格式,在Header的Tab页中输入一组key/value<br>Content-Type/ application/json<br>3.为登录口令创建加密串,openbmc登录用的加密串,将生成的串存储为参数。<br>在pre-request-script的Tab页输入</p>
<p>var pw = CryptoJS.enc.Utf8.parse(“xxx”)<br>var base64 = CryptoJS.enc.Base64.stringify(pw)<br>pm.environment.set(“originPassword”, base64)</p>
<p>4.输入post方法的参数,使用上一步生成的originPassword参数<br>在Body的Tab页输入</p>
<p>{“username” : “root”, “password” : “{ {originPassword} }” }</p>
<p>5.完成测试代码,并生成root-token全局变量,这个变量可以在所有的用例中作为登录认证来使用<br>在Test的Tab页输入</p>
<!--noindex-->
<div class="post-button text-center">
<a class="btn" href="/2020/05/19/Postman工具在openbmc中的使用举例/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="https://sunleaf2002.github.io/2020/05/08/一键同步git库和文本中commit号到编译服务器/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ruixia,sun">
<meta itemprop="description" content>
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Ruixia,Sun's Technique Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2020/05/08/一键同步git库和文本中commit号到编译服务器/" itemprop="url">一键同步git库和文本中commit号到编译服务器</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2020-05-08T11:15:44+08:00">
2020-05-08
</time>
</span>
<span class="post-category">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/git/" itemprop="url" rel="index">
<span itemprop="name">git</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>经常要将bmcweb的git库同步到编译服务器上,并更新服务器上的commit号,太繁琐,忍无可忍,拼凑了几个脚本,可以实现自动同步git库和更新commit号的功能,记下来,供大家参考。</p>
<p>主体是4个脚本,不会写大脚本,分开写,再合并为一个脚本命令一键执行,所有脚本创建后都要chmod +x *.sh授予执行权限。</p>
<p>脚本及以下操作都在本地的bmcweb目录中进行。</p>
<p>先查看本地bmcweb中.git/config文件配置如下:</p>
<pre><code>[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = [email protected]:openbmc-v28/github.com.openbmc.bmcweb.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "v28"]
url = [email protected]:/home/kunlun/rxsunSource/openbmc-v28/build/downloads/git2/github.com.openbmc.bmcweb.git/
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[credential]
helper = store
```</code></pre><p>其中的v28远程库对应着编译服务器,origin对应着gitlab开发服务器,这里不用。</p>
<hr>
<p>第一个脚本01-git-push.sh 是将本地的git库push到服务器上,push的目的地v28,-f选项是强制提交,bios是v28远程库所在机器的用户kunlun的口令</p>
<p>###01-git-push.sh </p>
<pre><code>#!/usr/bin/expect
spawn git push v28 master -f
expect "password"
send "bios\r"
expect eof</code></pre><p>第二个脚本02-scp-from-18.sh 是将v28服务器上的bmcweb_git.bb复制到本地bmcweb目录下</p>
<p>###02-scp-from-18.sh </p>
<pre><code>#!/usr/bin/expect
spawn scp [email protected]:/home/kunlun/rxsunSource/openbmc-v28/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb .
expect "password"
send "bios\r"
expect eof</code></pre><p>第三个脚本03-sed-commitId.sh 是将bmcweb_git.bb中commit号替换为最新的commit号,因为sed不能保存,所以重定向到临时文件再重命名</p>
<p>###03-sed-commitId.sh </p>
<pre><code>#!/bin/bash
newCommitId=`git rev-parse HEAD`
originCommitId=`cat bmcweb_git.bb | grep SRCREV | gawk -F= '{ print $2}' | sed 's/"//g'`
echo change $originCommitId to $newCommitId
sed "s/$originCommitId/$newCommitId/g" bmcweb_git.bb > bmcweb_git.bb.tmp
mv bmcweb_git.bb.tmp bmcweb_git.bb</code></pre><p>第四个脚本04-scp-to-18.sh 是将改后的bmcweb_git.bb拷贝到远程服务器上,可以覆盖目的地的同名文件</p>
<p>###04-scp-to-18.sh</p>
<pre><code>#!/usr/bin/expect
spawn scp bmcweb_git.bb [email protected]:/home/kunlun/rxsunSource/openbmc-v28/meta-phosphor/recipes-phosphor/interfaces/
expect "password"
send "bios\r"
expect eof</code></pre><hr>
<p>将以上四个脚本的执行命令写到一个文件里,命名为a.sh ,记得执行chmod +x a.sh</p>
<p>./01-git-push.sh && ./02-scp-from-18.sh && ./03-sed-commitId.sh && ./04-scp-to-18.sh</p>
<p>执行时只要./a.sh就可以完成以前的很多步操作。</p>
<hr>
<p>使用注意事项:</p>
<p>1.配置本地的.git/config文件,添加编译服务器的目录为远程库;</p>
<p>2.将01-git-push.sh中的“spawn git push v28 master -f”的“v28”改自己的远程库名称;</p>
<p>3.在02-scp-from-18.sh、03-sed-commitId.sh和04-scp-to-18.sh中bb文件的位置和名称,要替换成自己工作文件的位置和名称;</p>
<p>4.将所有send后面的bios替换为自己远程库用户的口令;</p>
<p>5.我的有些服务器可接受客户端公钥文件内容到authorized_keys中,免口令scp,也可以先自己服务器上尝试一下;</p>
<p>6.本地机器上需要有expect包,用apt-get install expect安装。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="https://sunleaf2002.github.io/2019/09/30/在-6服务器上改ftpServer配置/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ruixia,sun">
<meta itemprop="description" content>
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Ruixia,Sun's Technique Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2019/09/30/在-6服务器上改ftpServer配置/" itemprop="url">在.6服务器上改ftpServer配置</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2019-09-30T15:50:44+08:00">
2019-09-30
</time>
</span>
<span class="post-category">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/linux/" itemprop="url" rel="index">
<span itemprop="name">linux</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>为bmc在0.6上开一个用户:</p>
<p>useradd -d /home/bmc -s /sbin/nologin bmc<br>usermod -g ftpuser bmc<br>以及 zkxiao jdzhang htliu</p>
<p>vi /etc/vsftpd/vsftpd.conf<br>主要参数:<br>chroot_local_user=YES —只能访问自己的目录<br>chroot_list_enable=YES 可以跃出自己的目录<br>chroot_list_file=/etc/vsftpd/chroot_list (但是chroot_list 的内容为空)<br>userlist_enable=YES —-写每个用户的固有目录<br>user_config_dir=/etc/vsftpd/userconfig<br>在userconfig目录下 vim zhaoxin 写一行 local_root=/home/zhaoxin<br>同样vim bmc 写一行 local_root=/home/bmc</p>
<p>systemctl restart vsftpd</p>
<p>以下是为了改为默认的被动模式:<br>vi /etc/vsftpd/vsftpd.conf<br>pasv_enable=YES<br>pasv_min_port=10060<br>pasv_max_port=10090<br>再开放端口<br>[root@kunlunweb userconfig]# firewall-cmd –permanent –zone=public –add-port=10060-10090/tcp<br>success<br>[root@kunlunweb userconfig]# firewall-cmd –reload<br>success</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="https://sunleaf2002.github.io/2019/08/30/为openbmc生成认证文件/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ruixia,sun">
<meta itemprop="description" content>
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Ruixia,Sun's Technique Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2019/08/30/为openbmc生成认证文件/" itemprop="url">为openbmc生成认证文件</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2019-08-30T15:20:38+08:00">
2019-08-30
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>openbmc的新版webui有<br>升级openssl、如何自己创建证书、配置证书到服务器和自建CA。</p>
<h2 id="验证版本"><a href="#验证版本" class="headerlink" title="验证版本"></a>验证版本</h2><p>kunlun@kunlunsec:<del>$ mkdir certificate_bmc<br>kunlun@kunlunsec:</del>$ cd certificate_bmc/<br>kunlun@kunlunsec:~/certificate_bmc$ openssl version -a<br>OpenSSL 1.1.0h 27 Mar 2018 (Library: OpenSSL 1.1.1c 28 May 2019)<br>built on: Fri May 31 12:25:41 2019 UTC<br>platform: debian-amd64<br>options: bn(64,64) rc4(16x,int) des(int) blowfish(ptr)<br>compiler: gcc -fPIC -pthread -m64 -Wa,–noexecstack -Wall -Wa,–noexecstack -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2<br>OPENSSLDIR: “/usr/lib/ssl”<br>ENGINESDIR: “/usr/lib/x86_64-linux-gnu/engines-1.1”</p>
<p>要求版本大于1.0.1g,本机是OpenSSL 1.1.1c </p>
<h2 id="生成私钥"><a href="#生成私钥" class="headerlink" title="生成私钥"></a>生成私钥</h2><p>使用命名openssl genrsa -des3 -out private.key 2048<br>其中-des3代表加上了加密,后面的2048是代表生成的密钥的位数<br>kunlun@kunlunsec:~/certificate_bmc$ openssl genrsa -des3 -out private.key 2048<br>Generating RSA private key, 2048 bit long modulus<br>……+++++<br>……………+++++<br>e is 65537 (0x010001)<br>Enter pass phrase for private.key:<br>Verifying - Enter pass phrase for private.key:<br>这里的口令随意输入,比如dddd。</p>
<p>kunlun@kunlunsec:~/certificate_bmc$ ll –查看文件名<br>-rw——- 1 kunlun kunlun 1751 8月 30 15:32 private.key</p>
<p>可见,private.key是个私钥文件。</p>
<h2 id="生成证书请求"><a href="#生成证书请求" class="headerlink" title="生成证书请求"></a>生成证书请求</h2><p>kunlun@kunlunsec:~/certificate_bmc$ openssl req -new -key private.key -out server.cs<br>Enter pass phrase for private.key:<br>You are about to be asked to enter information that will be incorporated<br>into your certificate request.<br>What you are about to enter is what is called a Distinguished Name or a DN.<br>There are quite a few fields but you can leave some blank<br>For some fields there will be a default value,</p>
<h2 id="If-you-enter-‘-’-the-field-will-be-left-blank"><a href="#If-you-enter-‘-’-the-field-will-be-left-blank" class="headerlink" title="If you enter ‘.’, the field will be left blank."></a>If you enter ‘.’, the field will be left blank.</h2><p>Country Name (2 letter code) [AU]:<br>State or Province Name (full name) [Some-State]:<br>Locality Name (eg, city) []:<br>Organization Name (eg, company) [Internet Widgits Pty Ltd]:<br>Organizational Unit Name (eg, section) []:<br>Common Name (e.g. server FQDN or YOUR name) []:192.168.200.40<br>Email Address []:</p>
<p>Please enter the following ‘extra’ attributes<br>to be sent with your certificate request<br>A challenge password []:<br>An optional company name []:</p>
<p>只有第一个输入口令“dddd”,以及Common Name输入了服务器地址,其它都回车了。</p>
<p>kunlun@kunlunsec:~/certificate_bmc$ ll<br>-rw——- 1 kunlun kunlun 1751 8月 30 15:32 private.key<br>-rw-rw-r– 1 kunlun kunlun 993 8月 30 15:43 server.csr</p>
<p>可见,server.csr是个请求文件。</p>
<h2 id="生成服务器的私钥"><a href="#生成服务器的私钥" class="headerlink" title="生成服务器的私钥"></a>生成服务器的私钥</h2><p>kunlun@kunlunsec:<del>/certificate_bmc$ openssl rsa -in private.key -out server.key<br>Enter pass phrase for private.key:<br>writing RSA key<br>口令还是“dddd”<br>kunlun@kunlunsec:</del>/certificate_bmc$ ll<br>-rw——- 1 kunlun kunlun 1751 8月 30 15:32 private.key<br>-rw-rw-r– 1 kunlun kunlun 993 8月 30 15:43 server.csr<br>-rw——- 1 kunlun kunlun 1679 8月 30 15:46 server.key</p>
<p>可见,server.key 是个服务器的私钥文件。</p>
<h2 id="使用私钥为证书请求签名,生成给服务器签署的证书,格式是x509的PEM格式"><a href="#使用私钥为证书请求签名,生成给服务器签署的证书,格式是x509的PEM格式" class="headerlink" title="使用私钥为证书请求签名,生成给服务器签署的证书,格式是x509的PEM格式"></a>使用私钥为证书请求签名,生成给服务器签署的证书,格式是x509的PEM格式</h2><p>kunlun@kunlunsec:<del>/certificate_bmc$ openssl x509 -req -in server.csr -out server.crt -outform pem -signkey server.key -days 3650<br>Signature ok<br>subject=C = AU, ST = Some-State, O = Internet Widgits Pty Ltd, CN = 192.168.200.40<br>Getting Private key<br>kunlun@kunlunsec:</del>/certificate_bmc$ ll<br>-rw——- 1 kunlun kunlun 1751 8月 30 15:32 private.key<br>-rw-rw-r– 1 kunlun kunlun 1176 8月 30 15:49 server.crt<br>-rw-rw-r– 1 kunlun kunlun 993 8月 30 15:43 server.csr<br>-rw——- 1 kunlun kunlun 1679 8月 30 15:46 server.key</p>
<p>可见,server.crt是给服务器的签过名的证书文件</p>
<p>将这些文件移动到目录新创建的privateKey中。</p>
<p>因为bmcserver只认可pem证书,而且要用CA证书进行签名,而不是用自己的私钥为证书请求签名,上面生成的server.crt不能用户bmcserver,能用于普通的http等服务器。</p>
<p>下面使用CA.pl创建CA根证书</p>
<h2 id="查找openssl-cnf文件"><a href="#查找openssl-cnf文件" class="headerlink" title="查找openssl.cnf文件"></a>查找openssl.cnf文件</h2><p>kunlun@kunlunsec:<del>/certificate_bmc$ ll /usr/lib/ssl/<br>总用量 20<br>drwxr-xr-x 3 root root 4096 10月 18 2018 ./<br>drwxr-xr-x 174 root root 12288 8月 8 14:43 ../<br>lrwxrwxrwx 1 root root 14 3月 17 2017 certs -> /etc/ssl/certs/<br>drwxr-xr-x 2 root root 4096 10月 18 2018 misc/<br>lrwxrwxrwx 1 root root 20 5月 12 2018 openssl.cnf -> /etc/ssl/openssl.cnf<br>lrwxrwxrwx 1 root root 16 3月 17 2017 private -> /etc/ssl/private/<br>kunlun@kunlunsec:</del>/certificate_bmc$ vim /usr/lib/ssl/openssl.cnf<br>核实default_bits=2048</p>
<h2 id="创建私钥和证书"><a href="#创建私钥和证书" class="headerlink" title="创建私钥和证书"></a>创建私钥和证书</h2><p>执行./CA.pl -newca命令<br>CA.pl会使用/usr/lib/ssl/openssl.cnf中的配置来创建私钥和证书。<br>创建CA证书过程中,不输入信息,直接回车,填写加密私钥的密码和生成CA证书的相关信息。<br>创建完之后会生成demoCA目录,查看</p>
<p>kunlun@kunlunsec:~/certificate_bmc$ ./CA.pl -newca<br>CA certificate filename (or enter to create)</p>
<h1 id="Making-CA-certificate-…"><a href="#Making-CA-certificate-…" class="headerlink" title="Making CA certificate …"></a>Making CA certificate …</h1><p>openssl req -new -keyout ./demoCA/private/cakey.pem -out ./demoCA/careq.pem<br>Generating a 2048 bit RSA private key<br>……………………………………………………………………………….+++++<br>…………+++++<br>writing new private key to ‘./demoCA/private/cakey.pem’<br>Enter PEM pass phrase:</p>
<h2 id="Verifying-Enter-PEM-pass-phrase"><a href="#Verifying-Enter-PEM-pass-phrase" class="headerlink" title="Verifying - Enter PEM pass phrase:"></a>Verifying - Enter PEM pass phrase:</h2><p>You are about to be asked to enter information that will be incorporated<br>into your certificate request.<br>What you are about to enter is what is called a Distinguished Name or a DN.<br>There are quite a few fields but you can leave some blank<br>For some fields there will be a default value,</p>
<h2 id="If-you-enter-‘-’-the-field-will-be-left-blank-1"><a href="#If-you-enter-‘-’-the-field-will-be-left-blank-1" class="headerlink" title="If you enter ‘.’, the field will be left blank."></a>If you enter ‘.’, the field will be left blank.</h2><p>Country Name (2 letter code) [AU]:CHINA<br>string is too long, it needs to be no more than 2 bytes long<br>Country Name (2 letter code) [AU]:CH<br>State or Province Name (full name) [Some-State]:BEIJING<br>Locality Name (eg, city) []:BEIJING<br>Organization Name (eg, company) [Internet Widgits Pty Ltd]:ZDKJ<br>Organizational Unit Name (eg, section) []:BIOS<br>Common Name (e.g. server FQDN or YOUR name) []:192.168.200.40<br>Email Address []:<a href="mailto:[email protected]" target="_blank" rel="noopener">[email protected]</a></p>
<p>Please enter the following ‘extra’ attributes<br>to be sent with your certificate request<br>A challenge password []:dddd<br>An optional company name []:zdkj</p>
<h1 id="gt-0"><a href="#gt-0" class="headerlink" title="==> 0"></a>==> 0</h1><p>====<br>openssl ca -create_serial -out ./demoCA/cacert.pem -days 1095 -batch -keyfile ./demoCA/private/cakey.pem -selfsign -extensions v3_ca -infiles ./demoCA/careq.pem<br>Using configuration from /usr/lib/ssl/openssl.cnf<br>Enter pass phrase for ./demoCA/private/cakey.pem:<br>Can’t open ./demoCA/index.txt.attr for reading, No such file or directory<br>139984384927488:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:72:fopen(‘./demoCA/index.txt.attr’,’r’)<br>139984384927488:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:79:<br>Check that the request matches the signature<br>Signature ok<br>Certificate Details:<br> Serial Number:<br> 8b:a7:7b:6f:f9:07:db:81<br> Validity<br> Not Before: Aug 30 08:47:46 2019 GMT<br> Not After : Aug 29 08:47:46 2022 GMT<br> Subject:<br> countryName = CH<br> stateOrProvinceName = BEIJING<br> organizationName = ZDKJ<br> organizationalUnitName = BIOS<br> commonName = 192.168.200.40<br> emailAddress = <a href="mailto:[email protected]" target="_blank" rel="noopener">[email protected]</a><br> X509v3 extensions:<br> X509v3 Subject Key Identifier:<br> 9B:8F:B3:47:98:55:F8:42:3F:82:F3:C4:EF:55:19:E3:37:D2:AE:85<br> X509v3 Authority Key Identifier:<br> keyid:9B:8F:B3:47:98:55:F8:42:3F:82:F3:C4:EF:55:19:E3:37:D2:AE:85<br> X509v3 Basic Constraints: critical<br> CA:TRUE<br>Certificate is to be certified until Aug 29 08:47:46 2022 GMT (1095 days)</p>
<p>Write out database with 1 new entries<br>Data Base Updated</p>
<h1 id="gt-0-1"><a href="#gt-0-1" class="headerlink" title="==> 0"></a>==> 0</h1><p>CA certificate is in ./demoCA/cacert.pem</p>
<p>输入口令的地方都是“dddd”。</p>
<p>kunlun@kunlunsec:<del>/certificate_bmc$ sudo openssl genrsa -des3 -out private.key 2048<br>Generating RSA private key, 2048 bit long modulus<br>………………….+++++<br>…………………………………………………………………+++++<br>e is 65537 (0x010001)<br>Enter pass phrase for private.key:<br>Verifying - Enter pass phrase for private.key:<br>kunlun@kunlunsec:</del>/certificate_bmc$ sudo openssl req -new -key private.key -out server.csr<br>Enter pass phrase for private.key:<br>You are about to be asked to enter information that will be incorporated<br>into your certificate request.<br>What you are about to enter is what is called a Distinguished Name or a DN.<br>There are quite a few fields but you can leave some blank<br>For some fields there will be a default value,</p>
<h2 id="If-you-enter-‘-’-the-field-will-be-left-blank-2"><a href="#If-you-enter-‘-’-the-field-will-be-left-blank-2" class="headerlink" title="If you enter ‘.’, the field will be left blank."></a>If you enter ‘.’, the field will be left blank.</h2><p>Country Name (2 letter code) [AU]:CH<br>State or Province Name (full name) [Some-State]:BEIJING<br>Locality Name (eg, city) []:BEIJING<br>Organization Name (eg, company) [Internet Widgits Pty Ltd]:ZDKJ<br>Organizational Unit Name (eg, section) []:BIOS<br>Common Name (e.g. server FQDN or YOUR name) []:192.168.200.40<br>Email Address []:<a href="mailto:[email protected]" target="_blank" rel="noopener">[email protected]</a></p>
<p>Please enter the following ‘extra’ attributes<br>to be sent with your certificate request<br>A challenge password []:dddd<br>An optional company name []:zdkj</p>
<p>kunlun@kunlunsec:<del>/certificate_bmc$ sudo openssl rsa -in private.key -out server.key<br>Enter pass phrase for private.key:<br>writing RSA key<br>kunlun@kunlunsec:</del>/certificate_bmc$ cp server.csr newreq.pem<br>kunlun@kunlunsec:~/certificate_bmc$ ll<br>总用量 40<br>drwxrwxr-x 4 kunlun kunlun 4096 8月 30 16:51 ./<br>drwxr-xr-x 54 kunlun kunlun 4096 8月 30 15:28 ../<br>-rwxrwxrwx 1 kunlun kunlun 6754 8月 30 16:00 CA.pl*<br>drwxrwxr-x 6 kunlun kunlun 4096 8月 30 16:47 demoCA/<br>-rw-r–r– 1 kunlun kunlun 1110 8月 30 16:51 newreq.pem<br>-rw——- 1 root root 1751 8月 30 16:50 private.key<br>drwxrwxr-x 2 kunlun kunlun 4096 8月 30 16:35 privateKey/<br>-rw-r–r– 1 root root 1110 8月 30 16:50 server.csr<br>-rw——- 1 root root 1679 8月 30 16:51 server.key</p>
<h1 id="kunlun-kunlunsec-certificate-bmc-CA-pl-sign"><a href="#kunlun-kunlunsec-certificate-bmc-CA-pl-sign" class="headerlink" title="kunlun@kunlunsec:~/certificate_bmc$ ./CA.pl -sign"></a>kunlun@kunlunsec:~/certificate_bmc$ ./CA.pl -sign</h1><p>openssl ca -policy policy_anything -out newcert.pem -infiles newreq.pem<br>Using configuration from /usr/lib/ssl/openssl.cnf<br>Enter pass phrase for ./demoCA/private/cakey.pem:<br>Check that the request matches the signature<br>Signature ok<br>Certificate Details:<br> Serial Number:<br> 8b:a7:7b:6f:f9:07:db:82<br> Validity<br> Not Before: Aug 30 08:51:43 2019 GMT<br> Not After : Aug 29 08:51:43 2020 GMT<br> Subject:<br> countryName = CH<br> stateOrProvinceName = BEIJING<br> localityName = BEIJING<br> organizationName = ZDKJ<br> organizationalUnitName = BIOS<br> commonName = 192.168.200.40<br> emailAddress = <a href="mailto:[email protected]" target="_blank" rel="noopener">[email protected]</a><br> X509v3 extensions:<br> X509v3 Basic Constraints:<br> CA:FALSE<br> Netscape Comment:<br> OpenSSL Generated Certificate<br> X509v3 Subject Key Identifier:<br> B6:25:F8:1C:62:AC:23:0B:67:C2:E7:56:88:D4:1E:0D:BF:AE:F4:58<br> X509v3 Authority Key Identifier:<br> keyid:9B:8F:B3:47:98:55:F8:42:3F:82:F3:C4:EF:55:19:E3:37:D2:AE:85</p>
<p>Certificate is to be certified until Aug 29 08:51:43 2020 GMT (365 days)<br>Sign the certificate? [y/n]:y<br>1 out of 1 certificate requests certified, commit? [y/n]y<br>Write out database with 1 new entries<br>Data Base Updated</p>
<h1 id="gt-0-2"><a href="#gt-0-2" class="headerlink" title="==> 0"></a>==> 0</h1><p>Signed certificate is in newcert.pem<br>kunlun@kunlunsec:~/certificate_bmc$ ll<br>-rwxrwxrwx 1 kunlun kunlun 6754 8月 30 16:00 CA.pl*<br>drwxrwxr-x 6 kunlun kunlun 4096 8月 30 16:52 demoCA/<br>-rw-rw-r– 1 kunlun kunlun 4669 8月 30 16:52 newcert.pem<br>-rw-r–r– 1 kunlun kunlun 1110 8月 30 16:51 newreq.pem<br>-rw——- 1 root root 1751 8月 30 16:50 private.key<br>drwxrwxr-x 2 kunlun kunlun 4096 8月 30 16:35 privateKey/<br>-rw-r–r– 1 root root 1110 8月 30 16:50 server.csr<br>-rw——- 1 root root 1679 8月 30 16:51 server.key</p>
<p>以上参考了<br><a href="https://blog.csdn.net/pz0605/article/details/51954876" target="_blank" rel="noopener">https://blog.csdn.net/pz0605/article/details/51954876</a></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="https://sunleaf2002.github.io/2019/08/28/搭建NBD-Server的过程/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="ruixia,sun">
<meta itemprop="description" content>
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Ruixia,Sun's Technique Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2019/08/28/搭建NBD-Server的过程/" itemprop="url">搭建NBD Server的过程</a></h1>