Handle pfctl_cfg_write output as expected
This commit is contained in:
		| @ -54,7 +54,7 @@ def create_app(): | ||||
|         return jsonify({'anchor': f'f2b-jail/{remote_user}', | ||||
|                         'table': f'f2b-{name}', | ||||
|                         'operation': 'flush', | ||||
|                         'result': res}) | ||||
|                         'result': [x.decode('ascii') for x in res]}) | ||||
|  | ||||
|     @app.route("/register", methods=['PUT', 'DELETE']) | ||||
|     @auth.login_required | ||||
| @ -88,12 +88,11 @@ def create_app(): | ||||
|                            table=f'f2b-{name}', | ||||
|                            operation='kill') | ||||
|         app.logger.info(f'pfctl -a f2b-jail/{remote_user} -f-') | ||||
|         return jsonify({'remote_user': remote_user, 'data': data}) | ||||
|         return jsonify({'anchor': f'f2b-jail/{remote_user}', | ||||
|                         'table': f'f2b-{name}', | ||||
|                         'action': 'start' if request.method == 'PUT' | ||||
|                         else 'stop', | ||||
|                         'result': res}) | ||||
|                         'result': [x.decode('ascii') for x in res]}) | ||||
|  | ||||
|     @app.route("/ban", methods=['PUT', 'DELETE']) | ||||
|     @auth.login_required | ||||
|  | ||||
| @ -29,7 +29,7 @@ def pfctl_cfg_write(anchor, cfg): | ||||
|     if res: | ||||
|         logging.info('Result: %s', res) | ||||
|         res.check_returncode() | ||||
|         return res | ||||
|         return res.stdout.splitlines() | ||||
|  | ||||
|  | ||||
| def pfctl_table_op(anchor, **kwargs): | ||||
|  | ||||
		Reference in New Issue
	
	Block a user