Latest Posts

openssl help(tools md5 sha256)


在cygwin下的openssl help命令返回如下

 

$ openssl help
Standard commands
asn1parse         ca                ciphers           cms
crl               crl2pkcs7         dgst              dhparam
dsa               dsaparam          ec                ecparam
enc               engine            errstr            gendsa
genpkey           genrsa            help              list
nseq              ocsp              passwd            pkcs12
pkcs7             pkcs8             pkey              pkeyparam
pkeyutl           prime             rand              rehash
req               rsa               rsautl            s_client
s_server          s_time            sess_id           smime
speed             spkac             srp               storeutl
ts                verify            version           x509

Message Digest commands (see the `dgst' command for more details)
blake2b512        blake2s256        gost              md2
md4               md5               rmd160            sha1
sha224            sha256            sha3-224          sha3-256
sha3-384          sha3-512          sha384            sha512
sha512-224        sha512-256        shake128          shake256
sm3

Cipher commands (see the `enc' command for more details)
aes-128-cbc       aes-128-ecb       aes-192-cbc       aes-192-ecb
aes-256-cbc       aes-256-ecb       aria-128-cbc      aria-128-cfb
aria-128-cfb1     aria-128-cfb8     aria-128-ctr      aria-128-ecb
aria-128-ofb      aria-192-cbc      aria-192-cfb      aria-192-cfb1
aria-192-cfb8     aria-192-ctr      aria-192-ecb      aria-192-ofb
aria-256-cbc      aria-256-cfb      aria-256-cfb1     aria-256-cfb8
aria-256-ctr      aria-256-ecb      aria-256-ofb      base64
bf                bf-cbc            bf-cfb            bf-ecb
bf-ofb            camellia-128-cbc  camellia-128-ecb  camellia-192-cbc
camellia-192-ecb  camellia-256-cbc  camellia-256-ecb  cast
cast-cbc          cast5-cbc         cast5-cfb         cast5-ecb
cast5-ofb         des               des-cbc           des-cfb
des-ecb           des-ede           des-ede-cbc       des-ede-cfb
des-ede-ofb       des-ede3          des-ede3-cbc      des-ede3-cfb
des-ede3-ofb      des-ofb           des3              desx
idea              idea-cbc          idea-cfb          idea-ecb
idea-ofb          rc2               rc2-40-cbc        rc2-64-cbc
rc2-cbc           rc2-cfb           rc2-ecb           rc2-ofb
rc4               rc4-40            rc5               rc5-cbc
rc5-cfb           rc5-ecb           rc5-ofb           seed
seed-cbc          seed-cfb          seed-ecb          seed-ofb
zlib

 


Read More

openssl介绍


openssl是一个安全套接字层密码库,囊括主要的密码算法、常用密钥、证书封装管理功能及实现ssl协议。OpenSSL整个软件包大概可以分成三个主要的功能部分:SSL协议库libssl、应用程序命令工具以及密码算法库libcrypto。

在linux系统下安装openssl,需要安装两个软件包:openssl和libssl-dev。具体使用方法和参数列表可参见命令行帮助。使用“openssl help”查看帮助信息


Read More

简单修改ipmitool代码,让工具支持LUN显示。


简单修改ipmitool代码,让工具支持LUN显示。

主要影响两个命令ipmitool sdr elist 和ipmitool sel elist

--- ipmitool-1.8.18/lib/ipmi_sdr.c      2016-05-30 03:56:30.000000000 +0800
+++ ipmitool-1.8.18x2/lib/ipmi_sdr.c    2021-05-28 13:41:11.000000000 +0800
@@ -1655,8 +1655,8 @@ ipmi_sdr_print_sensor_fc(struct ipmi_int
                /*
                 * print sensor name, number, state, entity, reading
                 */
-               printf("%-16s | %02Xh | ",
-                      sr->s_id, sensor->keys.sensor_num);
+               printf("%-16s | %02X.%02Xh | ",
+                      sr->s_id, sensor->keys.sensor_num, sensor->keys.lun);

                if (IS_THRESHOLD_SENSOR(sensor)) {
                        /* Threshold Analog & Discrete */
@@ -2105,9 +2105,9 @@ ipmi_sdr_print_sensor_eventonly(struct i
                               sensor->keys.sensor_num,
                               sensor->entity.id, sensor->entity.instance);
                else if (sdr_extended)
-                       printf("%-16s | %02Xh | ns  | %2d.%1d | Event-Only\n",
+                       printf("%-16s | %02X.%02Xh | ns  | %2d.%1d | Event-Only\n",
                               sensor->id_code ? desc : "",
-                              sensor->keys.sensor_num,
+                              sensor->keys.sensor_num,sensor->keys.lun,
                               sensor->entity.id, sensor->entity.instance);
                else
                        printf("%-16s | Event-Only        | ns\n",
@@ -3230,6 +3230,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_
                case SDR_RECORD_TYPE_COMPACT_SENSOR:
                        if (e->record.common->keys.sensor_num == num &&
                            e->record.common->keys.owner_id == (gen_id & 0x00ff) &&
+                           e->record.common->keys.lun == ((gen_id & 0xff00)>>8) &&
                            e->record.common->sensor.type == type)
                                return e;
                        break;
@@ -3272,6 +3273,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_
                            (struct sdr_record_common_sensor *) rec;
                        if (sdrr->record.common->keys.sensor_num == num
                            && sdrr->record.common->keys.owner_id == (gen_id & 0x00ff)
+                           && sdrr->record.common->keys.lun == ((gen_id & 0xff00)>>8)
                            && sdrr->record.common->sensor.type == type)
                                found = 1;
                        break;

 


Read More

ipmitool lanplus编译需要openssl libssl-dev否则会报错undefined reference to RVP_CIPHER_CTX_reset


本文描述如何在ubuntu下编译lanplus,并描述可能遇到的问题。

1:下载ipmitool的最新版本,并查看如何安装文件INSTALL

2:根据INSTALL文件最简单的,要使用./configure; make; make install进行编译安装

3:如果在执行configure,查看接口如果不支持lanplus,则可能是缺少库文件,需要安装openssl和libssl-dev

可以使用以下命令进行安装。

# apt-get install openssl

# apt-get install libssl-dev

 

异常表现一:lanplus:no

# ./configure 
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for rpmbuild... rpm
checking for sed... sed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking for sys/stat.h... (cached) yes
checking for unistd.h... (cached) yes
checking paths.h usability... yes
checking paths.h presence... yes
checking for paths.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/byteorder.h usability... no
checking sys/byteorder.h presence... no
checking for sys/byteorder.h... no
checking byteswap.h usability... yes
checking byteswap.h presence... yes
checking for byteswap.h... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking whether byte ordering is bigendian... no
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for sys/socket.h... (cached) yes
checking types of arguments for select... int,fd_set *,struct timeval *
checking for working strtod... yes
checking for alarm... yes
checking for gethostbyname... yes
checking for getaddrinfo... yes
checking for getifaddrs... yes
checking for socket... yes
checking for select... yes
checking for memmove... yes
checking for memset... yes
checking for strchr... yes
checking for strdup... yes
checking for strerror... yes
checking for getpassphrase... no
checking how to print strings... printf
checking for a sed that does not truncate output... sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for library containing gethostbyname... none required
checking for library containing getaddrinfo... none required
checking for library containing getifaddrs... none required
checking for library containing socket... none required
checking for EVP_aes_128_cbc in -lcrypto... no
checking for EVP_sha256 in -lcrypto... no
checking for MD5_Init in -lcrypto... no
checking for MD2_Init in -lcrypto... no
checking for linux/compiler.h... no
checking sys/ioccom.h usability... no
checking sys/ioccom.h presence... no
checking for sys/ioccom.h... no
checking linux/ipmi.h usability... yes
checking linux/ipmi.h presence... yes
checking for linux/ipmi.h... yes
checking for ipmi_open_inband in -lfreeipmi... no
checking for ipmi_ctx_open_inband in -lfreeipmi... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for OpenIPMI dual bridge support... no
checking sys/lipmi/lipmi_intf.h usability... no
checking sys/lipmi/lipmi_intf.h presence... no
checking for sys/lipmi/lipmi_intf.h... no
** Unable to build Solaris 9 x86 IPMI interface support!
checking for library containing tgetent... no
checking for library containing initscr... no
checking for library containing readline... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating contrib/Makefile
config.status: creating control/Makefile
config.status: creating control/pkginfo
config.status: creating control/prototype
config.status: creating control/rpmmacros
config.status: creating control/ipmitool.spec
config.status: creating lib/Makefile
config.status: creating include/Makefile
config.status: creating include/ipmitool/Makefile
config.status: creating src/Makefile
config.status: creating src/plugins/Makefile
config.status: creating src/plugins/lan/Makefile
config.status: creating src/plugins/lanplus/Makefile
config.status: creating src/plugins/open/Makefile
config.status: creating src/plugins/free/Makefile
config.status: creating src/plugins/imb/Makefile
config.status: creating src/plugins/bmc/Makefile
config.status: creating src/plugins/usb/Makefile
config.status: creating src/plugins/lipmi/Makefile
config.status: creating src/plugins/serial/Makefile
config.status: creating src/plugins/dummy/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

ipmitool 1.8.18

Interfaces
  lan     : yes
  lanplus : no
  open    : yes
  free    : no
  imb     : yes
  bmc     : no
  usb     : no
  lipmi   : no
  serial  : yes
  dummy   : no

Extra tools
  ipmievd   : yes
  ipmishell : no


异常表现2: undefined reference

 

undefined reference to RVP_CIPHER_CTX_reset


Read More

grep命令用法汇总


 

 

cat example.txt | grep "abcdef" 匹配字符串abcedf,匹配大小写
cat example.txt | grep -i "abcdef" 匹配字符串abcedf,忽略大小写
grep --binary-files=without-match -i -r ">phyinfo" ./ 查找时忽略二进制文件
   

 

 

$ grep --help
用法: grep [选项]... PATTERN [FILE]...
在每个 FILE 或是标准输入中查找 PATTERN。
默认的 PATTERN 是一个基本正则表达式(缩写为 BRE)。
例如: grep -i 'hello world' menu.h main.c

正则表达式选择与解释:
  -E, --extended-regexp     PATTERN 是一个可扩展的正则表达式(缩写为 ERE)
  -F, --fixed-strings       PATTERN 是一组由断行符分隔的字符串。
  -G, --basic-regexp        PATTERN 是一个基本正则表达式(缩写为 BRE)
  -P, --perl-regexp         PATTERN 是一个 Perl 正则表达式
  -e, --regexp=PATTERN      用 PATTERN 来进行匹配操作
  -f, --file=FILE           从 FILE 中取得 PATTERN
  -i, --ignore-case         忽略大小写
  -w, --word-regexp         强制 PATTERN 仅完全匹配字词
  -x, --line-regexp         强制 PATTERN 仅完全匹配一行
  -z, --null-data           一个 0 字节的数据行,但不是空行

杂项:
  -s, --no-messages         不显示错误信息
  -v, --invert-match        选中不匹配的行
  -V, --version             显示版本信息并退出
      --help                显示此帮助并退出

输出控制:
  -m, --max-count=NUM       NUM 次匹配后停止
  -b, --byte-offset         输出的同时打印字节偏移
  -n, --line-number         输出的同时打印行号
      --line-buffered       每行输出清空
  -H, --with-filename       为每一匹配项打印文件名
  -h, --no-filename         输出时不显示文件名前缀
      --label=LABEL         将LABEL 作为标准输入文件名前缀
  -o, --only-matching       只显示匹配PATTERN 部分的行
  -q, --quiet, --silent     不显示所有常规输出
      --binary-files=TYPE   设定二进制文件的TYPE 类型;
                            TYPE 可以是`binary', `text', 或`without-match'
  -a, --text                等同于 --binary-files=text
  -I                        等同于 --binary-files=without-match
  -d, --directories=ACTION  读取目录的方式;
                            ACTION 可以是`read', `recurse',或`skip'
  -D, --devices=ACTION      读取设备、先入先出队列、套接字的方式;
                            ACTION 可以是`read'或`skip'
  -r, --recursive           等同于--directories=recurse
  -R, --dereference-recursive       同上,但遍历所有符号链接
      --include=FILE_PATTERN  只查找匹配FILE_PATTERN 的文件
      --exclude=FILE_PATTERN  跳过匹配FILE_PATTERN 的文件和目录
      --exclude-from=FILE   跳过所有除FILE 以外的文件
      --exclude-dir=PATTERN  跳过所有匹配PATTERN 的目录。
  -L, --files-without-match  只打印不匹配FILEs 的文件名
  -l, --files-with-matches  只打印匹配FILES 的文件名
  -c, --count               只打印每个FILE 中的匹配行数目
  -T, --initial-tab         行首tabs 分隔(如有必要)
  -Z, --null                在FILE 文件最后打印空字符

文件控制:
  -B, --before-context=NUM  打印文本及其前面NUM 行
  -A, --after-context=NUM   打印文本及其后面NUM 行
  -C, --context=NUM         打印NUM 行输出文本
  -NUM                      等同于 --context=NUM
      --color[=WHEN],
      --colour[=WHEN]       使用标记高亮匹配字串;
                            WHEN 可以是`always', `never'或`auto'
  -U, --binary              不要清除行尾的CR 字符(MSDOS/Windows)
  -u, --unix-byte-offsets   忽略CR 字符,报告字节偏移
                             (MSDOS/Windows)
 


Read More

ubuntu图形界面与命令行界面(终端)切换


ubuntu图形界面与命令行界面(终端)切换

1:   图形界面到命令行界面,使用快捷键命令   

ctrl+alt+f1 从图形界面切换到命令行界面tty1。

ctrl+alt+f2 从图形界面切换到命令行界面tty2。

ctrl+alt+f3 从图形界面切换到命令行界面tty3。

ctrl+alt+f4 从图形界面切换到命令行界面tty4。

ctrl+alt+f5 从图形界面切换到命令行界面tty5。

ctrl+alt+f6 从图形界面切换到命令行界面tty6。

2:命令行界面到图形界面,使用快捷键命令   

alt+F7 命令行界面到图形界面

ctrl+alt+F7 命令行界面到图形界面


Read More

ipmitool -b 6 -t 0x2c解释


ipmitool -b 6 -t 0x2c解释

 

Get Me Device Id

ipmitool -I lanplus -H IP -U xxx -P xxx -b 6 -t 2c raw 0x06 0x01


Read More

i2c相关问题核查方向


服务器BMC i2c相关问题核查方向

  • 首先确保链路是通的,当链路不通时,检查硬件。查看是否是对应的i2c线缆没有接上。检查是否 SCL SDA线接反了。
  • 如果链路能通,但数据返回异常,首先确认一下你发送的命令是否准确,换一下命令试试。
  • 数据返回异常时,看一下是都是异常还是部分异常,查看一下驱动能力,变更一下电阻阻值。
  • 如果数据前面正常,后面返回0xFF,修改一下或者去除buffer电路,是否电压导致变化。
  • 如果存在i2c挂死,访问正常一段时间后,无法访问。可以进行压力测试,看i2c挂死的频率,能否恢复。

Read More


© 2008-2022 CunYouLu存有录博客 村友录 存游录 鲁ICP备08005943号