mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-25 09:11:10 +00:00
30 lines
744 B
Python
Executable File
30 lines
744 B
Python
Executable File
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright 2018-present ScyllaDB
|
|
#
|
|
|
|
#
|
|
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
|
|
|
|
import os
|
|
import sys
|
|
from scylla_util import is_redhat_variant, out, sysconfig_parser
|
|
from subprocess import run
|
|
|
|
if __name__ == '__main__':
|
|
if os.getuid() > 0:
|
|
print('Requires root permission.')
|
|
sys.exit(1)
|
|
|
|
if not is_redhat_variant():
|
|
print("scylla_selinux_setup only supports Red Hat variants")
|
|
sys.exit(0)
|
|
|
|
res = out('sestatus')
|
|
if res.split(None)[2] != 'disabled':
|
|
run('setenforce 0', shell=True, check=True)
|
|
cfg = sysconfig_parser('/etc/sysconfig/selinux')
|
|
cfg.set('SELINUX', 'disabled')
|
|
cfg.commit()
|