upload
6 TopicsCreate a IFile {system level} via API - Powershell
Hi All, Attempting the following: 1: Create iFile system level 2: Update existing iRule-> iFile referance the the file uploaded in step 1. Im getting stuck at step 1, any assistance creatly apprecuated. What I have tried: Get Auth Token: # Get API token $big_ip = 'https://[REDACTED]' $url = "{0}{1}" -f $big_ip, '/mgmt/shared/authn/login' $body = @{ username = "[REDACTED]" password = '[REDACTED]' loginProviderName = "tmos" } | ConvertTo-Json $result = Invoke-RestMethod -Method 'POST' -Uri $url -ContentType 'application/json' -Body $body $token = $($result.token.token) Works. Next, Upload my file: $File_Name = 'MyFile' $File_Upload = 'C:\Temp\MyFile' $url = "{0}{1}{2}" -f $big_ip, "/mgmt/shared/file-transfer/uploads/", $File_Name $filelength = (Get-Item $File_Upload).length $headers = @{ 'Content-Type' = 'application/octet-stream' 'X-F5-Auth-Token' = $token 'Content-Range' = "0-$($filelength-1)/$filelength" } $result = Invoke-RestMethod -Method Post -Uri $url -Headers $headers -InFile $File_Upload Works fine too I am returned with: remainingByteCount : 0 usedChunks : @{0=46321} totalByteCount : 46321 localFilePath : /var/config/rest/downloads/MyFile temporaryFilePath : /var/config/rest/downloads/tmp/MyFile generation : 0 lastUpdateMicros : 1661257236246203 Next is where im stuck, creation of the iFile system level from the uploaded file. Ive re-typed the below from the Curl samples here:Syncing local repositories and ifiles using iContr... - DevCentral (f5.com) ### Create a iFile {system level} - does not yet work $File_Name = 'MyFile' $url = "{0}{1}{2}" -f $big_ip, "/mgmt/tm/sys/file/ifile/", $File_Name $headers = @{ 'Content-Type' = 'application/json' 'X-F5-Auth-Token' = $token } $body = @{ 'name' = $File_Name 'source-path' = "file:///var/config/rest/downloads/$File_Name" } | ConvertTo-Json $result = Invoke-RestMethod -Method put -Uri $url -Headers $headers -Body $body Next I am recieving that the file cannot be found. So this query is incorrectly tructured ? Translated these examples to powershell: Syncing local repositories and ifiles using iContr... - DevCentral (f5.com) Invoke-RestMethod : {"code":404,"message":"01020036:3: The requested iFile (/Common/MyFile) was not found.","errorStack":[],"apiError":3} At line:1 char:11 + $result = Invoke-RestMethod -Method put -Uri $url -Headers $headers - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand Any assistance appreated with the above & next up updating the iRule file refence.Solved1.9KViews1like10CommentsiControlREST and Curl to save and download ASM policies
Hi, I want to be able to save/export asm policies on the F5 and then download. I want to do this using iControlREST and curl. I am able to save UCS files with the post shown below: curl -v -sk -u admin:admin https://myF5/mgmt/tm/sys/ucs -H 'Content-Type: application/json' -X POST -d '{"command":"save","name":"blah.ucs"}' | jq However if I try to do something similar for asm I get errors. Below is what I was trying with asm. curl -v -sk -u admin:admin https://myF5/mgmt/tm/asm/policies/fn9GoMrandomGvoN2dD -H 'Content-Type: application/json' -X POST -d '{"command":"save","name":"as_test.xml"}' | jq The error I get is: { "code": 400, "message": "Could not parse/validate the Policy 'Security Policy /Common/as_test'. Unknown field 'command'", "originalRequestBody": "{\"command\":\"save\",\"name\":\"as_test.xml\"", "referer": "x.x.x.x", "restOperationId": 59083, "kind": ":resterrorresponse" } Thank you1.7KViews0likes5CommentsCert Invalid Parameter
I am getting a 400 response from the /mgmt/tm/sys/crypto/cert endpoint. The body I am passing is: {"command":"install","name":"testdomain","from-local-file":"/var/config/rest/downloads/testdomain.key"} . The file exists and if I remove the file, I get an error that the file could not be copied, so I think this actually is copying this file. The response body is: Key management library returned bad status: -4, Invalid Parameter . Any help would be really appreciated. I am following the instruction here, but I am using token auth: https://devcentral.f5.com/questions/upload-ssl-keys-certs-via-icontrol-rest-api This could be related to the issue I am having with uploading files, I opened a question here: https://devcentral.f5.com/questions/unable-to-upload-file-through-icontrol-rest-interface-49232Solved912Views0likes5CommentsBigIP VE (LTM) crashes when uploading iso's by SSH/SCP
Hi all I have an odd problem. There is a virtual machine (BigIP VE) with version 13.1.3.x with enough ressources (RAM, CPU, disk) which crashes when I try to upload an ISO for upgrading using SCP/SSH (not the WebGUI!). When I start the upload it takes a moment (it ranges from 10 to 35% progress) the VE crashes either completly or starts to act strangely (not login possible anymore, but the traffic is still running). I have to power off the VM and then power it on again to actually remedy the issue. We will have an extensive testing with the ESX team and checking the VE itself, but preliminary checks don't show any issues with storage (ESX wise or internally VE, there is enough space) or ressources (like CPU, RAM, etc.). There is a second VM with the same statistics and same version, just another location and another ESX farm, but that one doesn't have an issue. Beside the fact we certainly need to check more in depth with ESX, anyone an idea what I could check on the F5 side what might cause this? Thanks a lot488Views0likes2CommentsSlow file upload when ASM is enabled
Hello, We have a web application where image uploads are painfully slow (x2) when ASM is enabled. Virtual: ltm virtual /PART/uat-app-vs { destination /PART/127.0.0.1:https ip-protocol tcp mask 255.255.255.255 partition PART persist { cookie { default yes } } policies { /ITSS/asm_auto_l7_policy__uat-app-vs } pool /ITSS/uat-app-pool profiles { /ITSS/uat-app-ssl { context clientside } http { } no-reject-dos { } oneconnect { } tcp { context clientside } tcp-lan-optimized { context serverside } websecurity { } } rules { maintenance-unavailable-rule clickjack-hsts-rule secure-cookie-rule /PART/acg-rewrite /PART/show-error-page-rule rewrite-x-fw-for-rule } security-log-profiles { "Log illegal request and response" } source 0.0.0.0/0 source-address-translation { type automap } vlans { EXT-11 } vlans-enabled vs-index 460 } ASM has the following URL configuration: Any ideas why?269Views0likes1CommentF5 not Identifying Parameter in Text/Plain Upload
In a webkit: content disposition header, name="file" ; filename="EXAMPLE DOCUMENT 2024.txt" Content-type: text/plain Document data example system ( The issue is that there is already a parameter built at the URI for file as an upload, set to block executables. Yet, it seems that the F5 continues to scan the document and it is not picking up the built parameter. Is it doing this by design? Since F5 is able to parse text? This seems to happen on uploads whose content types are text and xml.23Views0likes1Comment