From patchwork Wed Apr 29 11:53:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Topi Miettinen X-Patchwork-Id: 11516769 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 352561805 for ; Wed, 29 Apr 2020 11:53:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1963B2064C for ; Wed, 29 Apr 2020 11:53:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J+Sd0S3e" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726516AbgD2Lxd (ORCPT ); Wed, 29 Apr 2020 07:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726511AbgD2Lxc (ORCPT ); Wed, 29 Apr 2020 07:53:32 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86591C03C1AD for ; Wed, 29 Apr 2020 04:53:32 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id l19so2251045lje.10 for ; Wed, 29 Apr 2020 04:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zanJ48XWx6afXcaPBWy/lKMTaJRgJmlSPIxFMmX4B34=; b=J+Sd0S3ewTzUBOKHhpws/6hATUT9mzaD5wiPXvcUTMFadJav0ykLhc+CgUadmHs5IM CJM9fV7uDH2HB0DSerkoetl6ANv6lj6oDiuNv4e/vV9QFX7ptmnzrIee4XPES/i/xGXA ClDDoeRebLneIux2mm5GQwwYTJWuGOnL22Z31vynrh6mWM3aloKuOJDrjZmUSBOPDbhY SzbjnAewIIqs+yDIbQjvbmTbumWusNy4pUaDP75z1RJqqCFJSSaoP/NdC02aagiquqkN JGMG69deJ+/Cb+KIRVIZmaLRtk/kpyd+hEqA/2m45Te/XN+3tv8dO24vDEdzaAOpuf5U NGbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zanJ48XWx6afXcaPBWy/lKMTaJRgJmlSPIxFMmX4B34=; b=QiQOalx28jUDjXcsGHdihsOZWvMaN4iJLoqv/rTLOnaTOXpN7BlSK8qBhcicio8C3b nE7lUm2oJ3ZlcbvEM+GcluejRmUS0iTFKnfgdxmNVcYLuofbB3wMQLApsH7NrErmgN4Y uEP8IgrznOvA92z5IPgeL1/E4rO8CPlx607z3LoPr0s833Hfy4WVrxmC6EwTUJFT/uwt 4RZ9WfDf7fdSlyVQlMVPfGcAC370afR/b63m2rOsE0ANyO3X6yZRIhsPhWnfYkyX0AhE rnREi18sh3xZJ3zJSumed4cE+Bc88VRSDctGj6JHjrFR0qdoBR3Iimiu7r3sVh+wfuMo A7lQ== X-Gm-Message-State: AGi0PuZH1bpJdHWY9/lMTunK7m23a0q0i3udKqY3O4ul89DJmG7SKQR+ fWOh6l9K48kiAHmb2ZVA3ULZac+M X-Google-Smtp-Source: APiQypIFn+UPgMh8oTDcOjttBXywu5pHAH3kf5AudD1oTqzpi/U+tejaDkzfUpZEqOtNySAapkEOkg== X-Received: by 2002:a2e:b5b9:: with SMTP id f25mr20346715ljn.11.1588161210689; Wed, 29 Apr 2020 04:53:30 -0700 (PDT) Received: from localhost.localdomain (88-114-211-119.elisa-laajakaista.fi. [88.114.211.119]) by smtp.gmail.com with ESMTPSA id e4sm1262409lfn.37.2020.04.29.04.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 04:53:29 -0700 (PDT) From: Topi Miettinen To: selinux@vger.kernel.org Cc: Topi Miettinen Subject: [PATCH] sepolicy: fix some typos and port definitions #230 Date: Wed, 29 Apr 2020 14:53:21 +0300 Message-Id: <20200429115321.21541-1-toiwoton@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org The range of unreserved ports starts from 1024 and ends to 65535 (inclusive). (Secure) RPC ports can be between 512 and 1023 (inclusive). Signed-off-by: Topi Miettinen --- python/sepolicy/sepolicy/generate.py | 4 ++-- python/sepolicy/sepolicy/interface.py | 2 +- python/sepolicy/sepolicy/network.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/sepolicy/sepolicy/generate.py b/python/sepolicy/sepolicy/generate.py index e8d07e7d..4e1ed4e9 100644 --- a/python/sepolicy/sepolicy/generate.py +++ b/python/sepolicy/sepolicy/generate.py @@ -340,7 +340,7 @@ class policy: (self.generate_root_user_types, self.generate_root_user_rules), (self.generate_new_types, self.generate_new_rules)) if not re.match(r"^[a-zA-Z0-9-_]+$", name): - raise ValueError(_("Name must be alpha numeric with no spaces. Consider using option \"-n MODULENAME\"")) + raise ValueError(_("Name must be alphanumeric with no spaces. Consider using option \"-n MODULENAME\"")) if type == CGI: self.name = "httpd_%s_script" % name @@ -438,7 +438,7 @@ class policy: def set_init_script(self, initscript): if self.type != DAEMON: - raise ValueError(_("Only Daemon apps can use an init script..")) + raise ValueError(_("Only Daemon apps can use an init script.")) self.initscript = initscript diff --git a/python/sepolicy/sepolicy/interface.py b/python/sepolicy/sepolicy/interface.py index 187419fa..7d4ebd7e 100644 --- a/python/sepolicy/sepolicy/interface.py +++ b/python/sepolicy/sepolicy/interface.py @@ -198,7 +198,7 @@ def get_xml_file(if_file): filename = os.path.basename(if_file).split(".")[0] rc, output = getstatusoutput("/usr/bin/python3 /usr/share/selinux/devel/include/support/segenxml.py -w -m %s" % (basedir + filename)) if rc != 0: - sys.stderr.write("\n Could not proceed selected interface file.\n") + sys.stderr.write("\n Could not process selected interface file.\n") sys.stderr.write("\n%s" % output) sys.exit(1) else: diff --git a/python/sepolicy/sepolicy/network.py b/python/sepolicy/sepolicy/network.py index ff308fad..add837b6 100755 --- a/python/sepolicy/sepolicy/network.py +++ b/python/sepolicy/sepolicy/network.py @@ -49,15 +49,15 @@ def get_network_connect(src, protocol, perm, check_bools=False): if "port_t" in tlist: continue if i == "port_t": - d[(src, protocol, perm)].append((i, ["all ports with out defined types"])) + d[(src, protocol, perm)].append((i, ["all ports without defined types"])) if i == "port_type": d[(src, protocol, perm)].append((i, ["all ports"])) elif i == "unreserved_port_type": - d[(src, protocol, perm)].append((i, ["all ports > 1024"])) + d[(src, protocol, perm)].append((i, ["all ports > 1023"])) elif i == "reserved_port_type": d[(src, protocol, perm)].append((i, ["all ports < 1024"])) elif i == "rpc_port_type": - d[(src, protocol, perm)].append((i, ["all ports > 500 and < 1024"])) + d[(src, protocol, perm)].append((i, ["all ports > 511 and < 1024"])) else: try: d[(src, protocol, perm)].append((i, portrecs[(i, protocol)]))