shapeblue / ipmisim

Fake IPMI server based on conpot and pyghmi
https://pypi.python.org/pypi/ipmisim
Apache License 2.0
33 stars 18 forks source link

freeipmi can not operate the sim BMC #11

Open ZombieBlue opened 3 years ago

ZombieBlue commented 3 years ago
[root@gv101 ipmisim]# /opt/autogridview/freeipmi/sbin/ipmipower -h 10.0.41.101 -u admin -p password --debug --stat
10.0.41.101: =====================================================
10.0.41.101: IPMI 1.5 Get Channel Authentication Capabilities Request
10.0.41.101: =====================================================
10.0.41.101: RMCP Header:
10.0.41.101: ------------
10.0.41.101: [               6h] = version[ 8b]
10.0.41.101: [               0h] = reserved[ 8b]
10.0.41.101: [              FFh] = sequence_number[ 8b]
10.0.41.101: [               7h] = message_class.class[ 5b]
10.0.41.101: [               0h] = message_class.reserved[ 2b]
10.0.41.101: [               0h] = message_class.ack[ 1b]
10.0.41.101: IPMI Session Header:
10.0.41.101: --------------------
10.0.41.101: [               0h] = authentication_type[ 8b]
10.0.41.101: [               0h] = session_sequence_number[32b]
10.0.41.101: [               0h] = session_id[32b]
10.0.41.101: [               9h] = ipmi_msg_len[ 8b]
10.0.41.101: IPMI Message Header:
10.0.41.101: --------------------
10.0.41.101: [              20h] = rs_addr[ 8b]
10.0.41.101: [               0h] = rs_lun[ 2b]
10.0.41.101: [               6h] = net_fn[ 6b]
10.0.41.101: [              C8h] = checksum1[ 8b]
10.0.41.101: [              81h] = rq_addr[ 8b]
10.0.41.101: [               0h] = rq_lun[ 2b]
10.0.41.101: [               9h] = rq_seq[ 6b]
10.0.41.101: IPMI Command Data:
10.0.41.101: ------------------
10.0.41.101: [              38h] = cmd[ 8b]
10.0.41.101: [               Eh] = channel_number[ 4b]
10.0.41.101: [               0h] = reserved1[ 3b]
10.0.41.101: [               0h] = get_ipmi_v2.0_extended_data[ 1b]
10.0.41.101: [               3h] = maximum_privilege_level[ 4b]
10.0.41.101: [               0h] = reserved2[ 4b]
10.0.41.101: IPMI Trailer:
10.0.41.101: --------------
10.0.41.101: [              12h] = checksum2[ 8b]
(ipmipower_powercmd.c, _retry_packets, 1383): host = 10.0.41.101; p = 1; Sending retry, retry count=1

please help to resolve this issue, thanks very much.

ZombieBlue commented 3 years ago

[root@gv101 bin]# ./ipmisim 623 /opt/sim_env/venv/lib/python2.7/site-packages/pyghmi/ipmi/private/session.py:31: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release. from cryptography.hazmat.backends import default_backend 2021-04-09 15:34:08,156 - ipmisim - INFO - IPMI BMC initialized. 2021-04-09 15:34:08,157 - ipmisim - INFO - CloudStack IPMI Sim BMC initialized 2021-04-09 15:34:08,157 - ipmisim - INFO - Started IPMI Server on 0.0.0.0:623

rohityadavcloud commented 3 years ago

Hi @ZombieBlue - this is just for testing purposes, it's a simulator that works with ipmitool. I'm not sure about ipmipower utility. cc @DaanHoogland

DaanHoogland commented 3 years ago

@ZombieBlue can you try installing and running with python3?

ZombieBlue commented 3 years ago

thanks @rhtyd @DaanHoogland I will try python3 first .

ZombieBlue commented 3 years ago

running with python36 have this issue too .

rohityadavcloud commented 3 years ago

@ZombieBlue can you try with ipmitool?

ZombieBlue commented 3 years ago

@rhtyd ipmitool can get the power status, but ipmipower can not. [root@localhost venv]# ipmitool -I lanplus -H 192.168.140.128 -U admin -P password chassis power status Chassis Power is off

ZombieBlue commented 3 years ago

send cmd 'ipmipower ...' and debug with pycharm

image

DaanHoogland commented 3 years ago

14 == 1110 so 14 & bin(10000000) is 0 indeed. ipmipower is sending a different format it seems. Can you give us the complete data structure? Do you know if we can recognise what tool is doing the request?

ZombieBlue commented 3 years ago

we can do the request by using ipmipower which can be installed with 'yum install freeipmi' and the command could be ipmipower -h 10.0.41.101 -u admin -p password --stat the data of request is b'\x06\x00\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\t \x18\xc8\x818\x0e\x03\xd6'` it is a pity I don't know how to identify which tool is doing request , but I try with ipmi_sim, it can be operated by both ipmitool and ipmipower.

rohityadavcloud commented 2 years ago

We're historically only used ipmitool, so any PR is welcome to add support for freeipmi too.