aboutsummaryrefslogtreecommitdiffstats
path: root/bin/bitbake-hashserv
diff options
context:
space:
mode:
authorPaul Barker <pbarker@konsulko.com>2021-02-05 11:26:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-09 15:57:52 +0000
commit492bb02eb0e071c792407ac3113f92492da1a9cc (patch)
tree55d8ad092d9d6d055e4472fde6aef0b8e827c920 /bin/bitbake-hashserv
parenta9451746a4bd7ccedf4c72cd03ad4ff0ab0143aa (diff)
downloadbitbake-492bb02eb0e071c792407ac3113f92492da1a9cc.tar.gz
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. Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin/bitbake-hashserv')
-rwxr-xr-xbin/bitbake-hashserv3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/bitbake-hashserv b/bin/bitbake-hashserv
index 1bc1f91f3..2669bbd13 100755
--- a/bin/bitbake-hashserv
+++ b/bin/bitbake-hashserv
@@ -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