The ibmsecurity method ibmsecurity.isam.web.password_strength.import_file stopped working on v10.0.3.0. Actually it doesn't work on v10.0.2.0 either. However, I cannot even upload the XLST files via the LMI import file under the Web, Password Strength menu. Trying to import a file results in response code 400 with the response:
{"message":"The uploaded file is not of the correct type."}
I've given up on the file import, it doesn't work at all now, I wish it still did, it would make things a lot easier, as this has broken our automated builds. I opened a case with L2 on this but they are telling me this is a coding issue since they can make it work via the LMI create from copy/paste or from curl by manipulating the line returns. I am hoping someone here can help me make sense of what has changed so I can adjust import_file to work with this latest firmware update.
I modified the import_file method to use a post using the isamAppliance.invoke_post method, passing the id of the rule and the content. However, this is not working either. When it goes into invoke_post, then ISAMAppliance._invoke_request, the data dict gets converted to JSON using json.dumps, where it is ultimately posted to the requests package. However, the issue seems to be the escaping that is going on, and the appliance hates it.
For example, at the end of a line: ">NEWLINE
Gets sent as the following text according to the debug output, notice the escaping of the newline: \\\">\\n
Now if I send it via curl, I can get it to work:
curl -v -X POST -k -H "Accept:application/json" -H "Content-type:application/json" --user "admin@password"
https://lmi.acme.org/wga/pwd_strength --data '{"name":"pw-rule.xslt", "content":"'"$(cat pw-rule.xslt | sed 's|"|\\"|g')"'"}'
However, I am only escaping the double quotes (hence the nasty sed there at the end). It seems if the newline is escaped, then things don't work.
Can someone please explain to me what the LMI wants for valid input data for this XSLT code password strength rule? It feels like it is not dealing with the line returns correctly now, so it seems I am going to have to work around that in the Python code. Can someone help me get the import_file method working with the creating a new file rather than importing it? I can't go diving into modifying stuff in the ISAMAppliance class, so whatever needs done, I need to convert this data before it hits ISAMAppliance.invoke_post, and hence into json.dumps() and ultimately into the Python requests package.
PS: On a side note, I am using ibmsecurity to in conjunction with an Ansible roles based off the isam-ansible-roles project. I have a full hands off build developed, and any time anything like this changes on the LMI, it blows these builds up, and I end up having to spend a considerable amount of time resolving these issues. Unfortunately due to some time constraints, I wasn't able to test these full builds against v10.0.2.0 from scratch. I just confirmed that this is indeed also different in v10.0.2.0. I believe the last full build I ran was v10.0.1.0, after that I have been running deltas to just update things that need changed. Hence, the import_file would have never fired because the rule already existed after the first initial build.
Thanks for any help.
PS: Fail on spelling on the post title, and sadly I can't change it once submitted. At least I can edit this text to say oops :)
------------------------------
Matt
------------------------------