Commit 87a4b351 authored by nk2202's avatar nk2202
Browse files

ADD: Check if configfile is readable by others...

parent f92e8b8b
Pipeline #117414 passed with stage
in 23 seconds
......@@ -2,6 +2,7 @@
import argparse
import configparser
import os
import stat
class ArgumentParser(argparse.ArgumentParser):
......@@ -40,8 +41,11 @@ class ArgumentParser(argparse.ArgumentParser):
def parse_args(self, args=None, namespace=None):
args = super().parse_args(args, namespace)
config = configparser.ConfigParser()
if os.path.isfile(os.path.expanduser(args.auth_config)):
configpath = os.path.expanduser(args.auth_config)
if os.path.isfile(configpath):
if os.stat(configpath).st_mode & stat.S_IRWXO:
self.error(f"Config file is readable by others. Please set it at least to 660.")
def load_configoption(option):
if getattr(args, option) is None:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment