1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

bitbake: hashserv: Support read-only server

The -r/--readonly argument is added to the bitbake-hashserv app. If this
argument is given then clients may only perform read operations against
the server. The read-only mode is implemented by simply not installing
handlers for write operations, this keeps the permission model simple
and reduces the risk of accidentally allowing write operations.

As a sqlite database can be safely opened by multiple processes in
parallel, it's possible to start two hashserv instances against a single
database if you wish to export both a read-only port and a read-write
port.

(Bitbake rev: 492bb02eb0e071c792407ac3113f92492da1a9cc)

Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Barker
2021-02-05 11:26:07 +00:00
committed by Richard Purdie
parent f5188da2f1
commit 3b559bb16d
4 changed files with 53 additions and 12 deletions
+2 -1
View File
@@ -33,6 +33,7 @@ def main():
parser.add_argument('--bind', default=DEFAULT_BIND, help='Bind address (default "%(default)s")')
parser.add_argument('--database', default='./hashserv.db', help='Database file (default "%(default)s")')
parser.add_argument('--log', default='WARNING', help='Set logging level')
parser.add_argument('-r', '--read-only', action='store_true', help='Disallow write operations from clients')
args = parser.parse_args()
@@ -47,7 +48,7 @@ def main():
console.setLevel(level)
logger.addHandler(console)
server = hashserv.create_server(args.bind, args.database)
server = hashserv.create_server(args.bind, args.database, read_only=args.read_only)
server.serve_forever()
return 0