summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Configure new ssl certificateRatan Gupta2018-01-231-44/+42
| | | | | | | | | | | As the web server certificate got expired so configuring the new one. I would come up with proposal for certificate management. Partially Resolves openbmc/openbmc#2423 Change-Id: I69642cb324b8030c7cd21f5efbbadbf2ce459e18 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Security: Disable weak ciphersRatan Gupta2018-01-231-1/+18
| | | | | | | | | Configure the strong ciphers while web server starts. Partially Resolves openbmc/openbmc#2423 Change-Id: I6aad0b292d3755a879e407784dce6a57fd217948 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Security: Cross Site ScriptingRatan Gupta2018-01-231-0/+8
| | | | | | | | | | This commit fixes the Cross Site scripting attack by adding security headers in response packet. Partially Resolves openbmc/openbmc#2423 Change-Id: Ie0ea05408af3d841a54f528863ed1bf65a8c3ed7 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* module: pep8 fixesBrad Bishop2018-01-231-2/+2
| | | | | | | A couple pep8 errors found their way in. Change-Id: I31c1de3b2bc92b20a809b9c2638df0d83c2b2ea3 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* rest_dbus.py:Update abort message for do_postNagaraju Goruganti2018-01-041-1/+1
| | | | | | | | | | | | | -When args are in correct format, but are not in accepted range, in this case the current abort message not seems meaningful. -Updated abort message to suite for both cases when the arg type is not correct or arg value is not in accepted range. Fixes openbmc/openbmc#2576 Change-Id: Id35241b05cd193172e2b7b1c905c396d0f9a9b4b Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* rest_dbus.py: Fix UnknownInterface errorAdriana Kobylak2017-12-141-6/+2
| | | | | | | | | | | | | | The string "org.freedesktop.UnknownInterface" is not an existing dbus error string, all errors are of format *.DBus.Error.* so remove it. Also check the dbus name instead of message for this error. The dbus message is the description of the error, like "Unknown interface 'foo'". The dbus name is the actual error string, like "org.freedesktop.DBus.Error.UnknownInterface", Change-Id: Ib54adef852713bc30f3eefc6598e28fcf5be3d29 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Fix infinite do_put recursive call with retry only onceMarri Devender Rao2017-12-121-6/+6
| | | | | | | | | | | | | | | | For failure in do-put method call REST server computes the argument types based on the signature and makes a recursive call with the modified argument types. Without proper exit clause recursive call is falling into an infinite loop, modified to retry only once. Also fixed do_post which has similar retry logic. Fixes openbmc/openbmc#2653 Change-Id: I150464de5585ebdfab4ae2da2083a62bd63caca1 Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
* websocket client_simple example: add login codeDeepak Kodihalli2017-11-191-6/+8
| | | | | Change-Id: Iff44de21e71508d81f7c5bfbe24b5f317fff000d Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Fix missing return value from do_postNagaraju Goruganti2017-11-171-7/+25
| | | | | | | | | | | | - For example user-initiated dump REST request has to respond with dump ID. This is not happening, the dump-manager is returning the ID, but rest-bus is not passing the ID to caller. - These changes will fix the issue. Fixes openbmc/openbmc#2592 Change-Id: I7ff3f24236249a4ca58ac6ce90cc9dec6fbe0341 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Don't create Image Dir if not presentGunnar Mills2017-11-161-1/+1
| | | | | | | | | | | | | | Return error if the Image directory is not present. The Upload code should not create the image dir, instead the code update or the inotify code should create it. Even if the Upload code creates the directory, the inotify is not looking for a file in that dir and won't untar it. We saw this with 2544. Although not the root cause of 2544 this change would have let the user know sooner (on upload), that there was a problem. Change-Id: I9f161354e1c3243567efb73b6974e8f52ff4c5db Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Call all instances of an objectPath when executing "POST"Saqib Khan2017-11-081-6/+10
| | | | | | | | | | | - For example "DeleteAll" exists in both bmc updater and host updater. Therefore when a user executes DeleteAll using REST, both the two instances should be called upon. Resolves openbmc/openbmc#2490 Change-Id: Ic38b00de137593bc344ff9d743d3144a48bd5f13 Signed-off-by: Saqib Khan <khansa@us.ibm.com>
* Spelling fixesGunnar Mills2017-10-252-4/+4
| | | | | Change-Id: If4902b7c900f4108f4563a49ee8aca18294b32f7 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Add websocket client exampleDeepak Kodihalli2017-10-191-0/+59
| | | | | | | | Add an example client html/js to denote subscription to BMC events via websockets. Change-Id: I9d07c7f720965de0272af31fc1a84faa49e901f5 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rest_dbus: implement client subscription APIDeepak Kodihalli2017-10-181-1/+88
| | | | | | | | | | Import gobject for running the d-bus event loop, and gevent for a greenlets support. Resolves openbmc/openbmc#2318. Change-Id: Ieaf2e6badcc22159f7470e3fdf949b358fc3e3fe Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rest_dbus: add new route for event subscriptionDeepak Kodihalli2017-10-181-0/+31
| | | | | | | | | | | | Add a route, '/subscribe', to be able to receive notifications from the REST server over a websocket. A client is supposed to create a new websocket by pointing to this route in the URL. In this commit, the implementation of the route is to just write a "Connected" message on the websocket. Change-Id: I38a40b2c17eac3ecdccb131d267baefe20b36572 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* phosphor-gevent: fix pep8 complaintsDeepak Kodihalli2017-10-181-2/+2
| | | | | | | Fix under-indented lines. Change-Id: Ic1df92e0699107dd2eafb097ebf74b9f5835eb84 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* phosphor-gevent: enable websocket supportDeepak Kodihalli2017-10-182-3/+14
| | | | | | | | | | Set 'WebSocketHandler' as the handler_class. Websockets are being supported to allow the REST server to be able to "push" events to clients. Change-Id: I4c5536ae9070635c00330bb59fc93d3b4382b461 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Remove unused intf_matchBrad Bishop2017-09-111-1/+0
| | | | | | | This base class member is unused and appears to be dead code. Remove. Change-Id: Iafdab0e28fdf15bb38f9713ae098d654d05c5b4e Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Change ImageUpload to open file onceGunnar Mills2017-08-301-4/+4
| | | | | | | | | | | When uploading an image via REST without a file name, the image upload code closes the file twice, triggering the inotify twice. Resolves openbmc/openbmc#2174 Change-Id: I24ff920c745b865bb4e25468e1895b38abf4a592 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Change Dump file storage locationJayanth Othayoth2017-08-201-2/+1
| | | | | | | | Changed the dump storage location from /tmp/dumps to /var/lib/phosphor-debug-collector/dumps Change-Id: I792f7661d377cb8fc5d77441a61b640fd5c2daf4 Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
* Convert value to expected type during POST methodRatan Gupta2017-08-091-0/+41
| | | | | | | | | | | | | | | | | This fix converts the values passed as the method arguments to the expected type during REST POST method Invalid args exception handling. if Invalid args exception occurs,this commit does the following set of operations. =>Get the method signature. =>Convert the value to the expected type. =>re-execute the post method. Resolves openbmc/openbmc#1889 Change-Id: I3fe9feda40187e4b72adf800b6bc4eb46f05a27c Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Revert "Set content-type to routes that had none set"Brad Bishop2017-07-111-4/+2
| | | | | | | | | | | This reverts commit 0dc67226dd38d5e603c9abc9f443809010ae85ee. No longer needed after 944cd04. Resolves: openbmc/openbmc#1932 Change-Id: I0f0a3fe2462cfd287ea7d7692fa47de685d595ea Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Revert "rest_dbus: run JSON response format plugin conditionally"Brad Bishop2017-07-101-7/+3
| | | | | | | | | This reverts commit 1444fd8c9e9b0807b4f3682236bec7cb3eedeebf. No longer needed after 944cd04. Change-Id: I8b19d6506e8ffb6c51b145e8306498621dd53be0 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Allow json response plugin to be suppressedBrad Bishop2017-07-101-3/+4
| | | | | | | | | Add a static class member suppress_json_resp that when set to True will prevent the JsonApiResp plugin from responding with a json wrapper. Change-Id: I43aadb6b59bb21ef53e5252e4878157c8e13935e Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* pep8 fixesBrad Bishop2017-07-101-1/+1
| | | | | Change-Id: I253b1f23f266a6604e2392d19de25d2d7e7a1ec8 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Set content-type to routes that had none setDeepak Kodihalli2017-07-081-2/+4
| | | | | | | Resolves openbmc/openbmc#1927. Change-Id: I05f0a1e37d8ebc83ebe1ff1d9aecba72ebc3aa39 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rest_dbus: implement route 'download/dump/<dumpid>Jayanth Othayoth2017-07-071-1/+40
| | | | | | | | | | | | This allows user to download dump file from BMC using dump id. 'curl -O -J -c cjar -b cjar -k -X GET https://<bmc_IP>/download/dump/1' - This will download the dump file on to the Host machine. Resolves openbmc/openbmc#1508 Change-Id: I2821bfe8d68f80340512161c062503b92a7a7466 Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
* rest_dbus: run JSON response format plugin conditionallyJayanth Othayoth2017-07-061-3/+12
| | | | | | | | Run JSON response format verification plug-in only if the content-type is 'application/json'. Change-Id: I032b32193f05a68bf695a6c6c51fccfaba9b197a Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
* Close file descriptor to release memoryLeonel Gonzalez2017-06-091-2/+9
| | | | | | | Resolves openbmc/openbmc#1718 Change-Id: Ie3020e38682cd0195202f6b3eedbb0f4907fa666 Signed-off-by: Leonel Gonzalez <lgonzalez@us.ibm.com>
* Converts value to expected typeLeonel Gonzalez2017-06-051-0/+95
| | | | | | | Fixes openbmc/openbmc#1160 Change-Id: I5c36f5bc065a0b2fdac56c2ee92b0ed54258f238 Signed-off-by: Leonel Gonzalez <lgonzalez@us.ibm.com>
* Finds correct property to set fan speedLeonel Gonzalez2017-05-241-2/+3
| | | | | | | Fixes openbmc/openbmc#1563 Change-Id: I73ce61e0416318917902ffdf4969b600236772d9 Signed-off-by: Leonel Gonzalez <lgonzalez@us.ibm.com>
* rest_dbus: fix content-type checkDeepak Kodihalli2017-04-271-1/+2
| | | | | | | | | Check content-type only for PUT, POST and PATCH. Resolves openbmc/openbmc#1525. Change-Id: I8ddddb344ecec13e1c07a7dba2ccac56c80302f7 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rest_dbus: allow route '/upload/image/<filename>'Deepak Kodihalli2017-04-261-17/+50
| | | | | | | | | | | | This allows the user to provide a filename for the uploaded image. 'curl <options> -X PUT -T foo https://<bmc_IP>/upload/image/bar' - This will save the file foo with the name bar on the BMC. Resolves openbmc/openbmc#1332. Change-Id: Ie3d04617114ec574c573ae0ac9ecf65769800062 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rest_dbus: implement route '/upload/image'Deepak Kodihalli2017-04-261-0/+36
| | | | | | | | | | | | | | Implement a route named '/upload/image' to be able to upload software upgrade images to the BMC. A typical upload via cURL would look like this : 'curl <options> -X POST -T <file_to_upload> https://<bmc_IP>/upload/image'. The uploaded files are stored at /tmp/images/. The filename of the uploaded file would be 'imageN', with N starting at 0. Change-Id: I183f50a108791ef8e70b50fd5e331310240d7a78 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rest_dbus: run Json format plugins conditionallyDeepak Kodihalli2017-04-191-0/+11
| | | | | | | | Run Json format verification plug-ins only if the content-type is 'application/json'. Change-Id: Ia6e089b94cc24fbd630042414335af7ce1ccd707 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rest_dbus: add plug-in to check content-typeDeepak Kodihalli2017-04-191-0/+28
| | | | | | | | Add a plug-in which ensures a route's content-type header matches the expected type for that route. Change-Id: I3376a0e35aae22747e90d7c46680639dbfc1404d Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rest_dbus: Add content_typeDeepak Kodihalli2017-04-111-3/+6
| | | | | | | | | | Add the content_type property to indicate the content-type header for routes. As of now, POST and PUT expect 'application/json'. Change-Id: Id7641189c818a2b38382edff37b204c40fb15874 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Change Delete interfaceDeepak Kodihalli2017-04-041-1/+1
| | | | | | | | | To support the 'DELETE' REST verb, the d-bus interface to be implemented is now xyz.openbmc_project.Object.Delete, instead of org.openbmc.Object.Delete. Change-Id: I7ddc139d6e7e5dde04127130ea1749d9a73d34c0 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Fix error response status regressionBrad Bishop2017-03-071-0/+1
| | | | | | | | | | 080a48e introduces a regression where the status field is missing from the response for non 2xx responses. Resolves openbmc/openbmc#1246 Change-Id: Idb18b100c9ebb34275b5c24f7609748603749d58 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Make the attr endpoint case insensitiveBrad Bishop2017-02-261-9/+12
| | | | | | | | This patch makes the attribute after the attr endpoint case insensitive. Change-Id: I1c8a634bffc2eed4c63c8b89b7b5ea281c06a1bc Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Fix attr PUT after empty interfaceBrad Bishop2017-02-261-1/+1
| | | | | | | | Fix an issue that occurs when doing a PUT using the attr endpoint when an object has an interface without properties. Change-Id: Ib3b2bb81dd287365851e6a67fec0c33479fdc543 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Add CORS supportBrad Bishop2017-02-261-0/+51
| | | | | | | | | Enable cross domain applications. https://en.wikipedia.org/wiki/Cross-origin_resource_sharing Change-Id: Id628ae387bb422fbfc4f319ce0847966ca8cbebf Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Add HTTP OPTIONS supportBrad Bishop2017-02-261-11/+32
| | | | | | | | The OPTIONS HTTP method allows clients to query the allowed methods on a given path. Change-Id: I762e85a6dbe2df3473dfa79c252c51ebe49c3ecb Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Allow clients to call HEADBrad Bishop2017-02-261-4/+13
| | | | | | | | The HEAD method allows clients to get page response headers without actually downloading the content. Change-Id: Id69db83a74015df3a9f84d36f91a4a12e11ea7b6 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Add support for error response pluginsBrad Bishop2017-02-211-45/+52
| | | | | | | | | | | | | | The Bottle plugin framework only applies to normal responses. Build on that by monkey-patching the Bottle error handler with a new one that makes a series of callbacks. Update the existing plugins such that where appropriate they can apply their logic to error responses in addition to normal responses as they already do. Change-Id: Ifc2bac0e5120a3b0475f3b78f8bd822711f9c736 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Return HTTP 503 when mapper is busyBrad Bishop2016-11-281-0/+3
| | | | | | | | | Suppress traceback and provide an informative error message when the mapper cannot respond to a query. Resolves openbmc/openbmc#812 Change-Id: I85d4e59c5a25dc8a19fbdb1d1cf8c2a0f4350991
* fix a pep8 errorBrad Bishop2016-11-281-1/+2
| | | | | Change-Id: I173aed206b4da49ca83261e4853426947f07f1f5 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Raise 401 for invalid credentialsBrad Bishop2016-09-081-2/+2
| | | | | | Change-Id: Ie41b568aa45b1f09b0940e5ee1b3472a46b08db1 Resolves: openbmc/phosphor-rest-server#25 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Add python-gevent startup scriptBrad Bishop2016-08-304-0/+57
| | | | | | | | Add a python-gevent startup script that takes a WSGI application as a parameter. Change-Id: I4c637538a1c6d4aa92563d548a2d8673299a23bb Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Split server and applicationBrad Bishop2016-08-309-31/+63
| | | | | | | | | | Provide the REST server as a python module, enabling it to be hosted by any WSGI provider. Provide a Rocket startup script with configurable WSGI application. Change-Id: I1a9c25b10c33b08dfb8f60dc6c33aaf727562a9f Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
OpenPOWER on IntegriCloud