From a976525a53bf048aa3af25d1e3e08eedfc96316c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 24 Oct 2020 11:13:49 -0400 Subject: [PATCH] Workaround IMM header problems When using IPv6 to IMMv2, the web will reject the fe80:: Set fake 1.2.3.4 headers to always give a pleasant and consistent result to the IMM. Change-Id: I56e738841269f24fe1968f77d7a3aa492f6bee23 --- pyghmi/ipmi/oem/lenovo/imm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index d9f4ba5f..489076ff 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -354,8 +354,9 @@ class IMMClient(object): 'password': self.password, 'SessionTimeout': 60}) headers = {'Connection': 'keep-alive', - 'Referer': 'https://{0}/designs/imm/index.php'.format( - self.imm), + 'Origin': 'https://1.2.3.4/', + 'Host': '1.2.3.4', + 'Referer': 'https://1.2.3.4/designs/imm/index.php', 'Content-Type': 'application/x-www-form-urlencoded'} wc.request('POST', '/data/login', adata, headers) rsp = wc.getresponse()