From patchwork Thu Feb 4 17:06:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bauen1 X-Patchwork-Id: 12067953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06FDBC433E0 for ; Thu, 4 Feb 2021 17:10:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5B5F64F77 for ; Thu, 4 Feb 2021 17:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238184AbhBDRHv (ORCPT ); Thu, 4 Feb 2021 12:07:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237582AbhBDRG4 (ORCPT ); Thu, 4 Feb 2021 12:06:56 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F91C061788 for ; Thu, 4 Feb 2021 09:06:15 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id m1so3641827wml.2 for ; Thu, 04 Feb 2021 09:06:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=7e4XWo4JCocK9TTQXIbvDZgv+rZ6qwNx3Ts6Gpz/hQU=; b=U0Cessz+oUBc75ZKEgLpAAHiO9XsthB19Nk9cl/JLCcYNlh029OHiDu8buzNM6xyPG C0pnNYlBfWzEVPLUbQrgHOLxl9QkU9kDHHCJ2x3aBbB+UB3ozQpfr7McYJWT3pn7sHBd Ak+QPip5lMIY/KkGtGyvC0nRkhoH+H8jwrXSH8zczfFKWHBkpG2d3xkVXimA168hBbzo cKzNciBAK5NF6qa9SH80xcVqHknCcPSIV0kzYj1D6+ze7NtBM76U84B2SI+HFXFWoZ5y zi9pAL2NES4ZnseYONqkCizpU49I0Di86Tgpuvk8flFk0aQnULYBphs/7GUkrPZyG9YU xtqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=7e4XWo4JCocK9TTQXIbvDZgv+rZ6qwNx3Ts6Gpz/hQU=; b=Pzkw0zi9w3tYe1aVCymonAcIO07wvsuAgx22EONg0O/hu25XQ2UaMSrfJzo7Za9XIu OPI4HgE+AFwKlex6NgPxfILBCs5kWly5w8MQTEDt72bUs6h9HYwqEwkph3tPS1UNgrd+ 8xOqNvuZzJ44+CDKTXfAVIYx8kbPy2gp3DtBGy4lCUPc3812/DhMq4vHkJKE0xdBBwK/ UqPJrqayLxUUTjXJF3mKLWQlsf6Whhbx0B6K3Q5BC9ECrBShptdJEvmUzAsX5khoXAoL uTLi8WUaUhBtsRl6v30iPrSaFDWloBmqQEX1b+vp9UtI/12GxZNN0SkNbVFPoSMHs/Dq qwCQ== X-Gm-Message-State: AOAM53110fnP/3sjdiAWYsmTIFhV2/uycyGYoa3wbekl+bkT6r0kymU7 Dmc5O9RWV19BNtE59QCly11HcDq9QCY= X-Google-Smtp-Source: ABdhPJyAxqWSmd6L8kBa2vKcqY0CqugP4vHp0PA0cSNCX/Lkc61XUxbTM3GjQTj44bBYIYrQKibNtg== X-Received: by 2002:a1c:2e83:: with SMTP id u125mr132800wmu.13.1612458374687; Thu, 04 Feb 2021 09:06:14 -0800 (PST) Received: from ?IPv6:2001:a61:340e:e601:8a:719c:9bc1:dcee? ([2001:a61:340e:e601:8a:719c:9bc1:dcee]) by smtp.gmail.com with ESMTPSA id 9sm9689055wra.80.2021.02.04.09.06.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Feb 2021 09:06:14 -0800 (PST) From: bauen1 X-Google-Original-From: bauen1 Subject: [PATCH 2/2] secilc/docs: add syntax highlighting for secil To: selinux@vger.kernel.org Message-ID: <0f97e39d-5e20-0ee6-dbcb-39e27efe8f43@gmail.com> Date: Thu, 4 Feb 2021 18:06:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org This is done by creating a somewhat rudimentary KDE syntax xml for pandoc. The default styles provided by pandoc don't look very good and don't highlight e.g. the strings marked as builtin. Signed-off-by: Jonathan Hettwer --- secilc/docs/Makefile | 10 +- secilc/docs/secil.xml | 224 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 secilc/docs/secil.xml diff --git a/secilc/docs/Makefile b/secilc/docs/Makefile index 79a165ba..a91bcde0 100644 --- a/secilc/docs/Makefile +++ b/secilc/docs/Makefile @@ -28,6 +28,8 @@ FILE_LIST ?= cil_introduction.md \ PANDOC_FILE_LIST = $(addprefix $(TMPDIR)/,$(FILE_LIST)) +PANDOC_HIGHLIGHT_STYLE="pygments" + PDF_OUT=CIL_Reference_Guide.pdf HTML_OUT=CIL_Reference_Guide.html PANDOC = pandoc @@ -54,13 +56,13 @@ $(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil $(SED) -i '1i Example Policy\n=========\n```secil' $@ echo '```' >> $@ -html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil +html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml mkdir -p $(HTMLDIR) - $(PANDOC) -t html $^ -o $(HTMLDIR)/$(HTML_OUT) + $(PANDOC) --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) --syntax-definition=secil.xml --standalone --metadata title="CIL Reference Guide" -t html $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil -o $(HTMLDIR)/$(HTML_OUT) -pdf: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil +pdf: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml mkdir -p $(PDFDIR) - $(PANDOC) --standalone --toc $^ -o $(PDFDIR)/$(PDF_OUT) + $(PANDOC) --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) --syntax-definition=secil.xml --standalone --toc $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil -o $(PDFDIR)/$(PDF_OUT) clean: rm -rf $(HTMLDIR) diff --git a/secilc/docs/secil.xml b/secilc/docs/secil.xml new file mode 100644 index 00000000..e9f252f5 --- /dev/null +++ b/secilc/docs/secil.xml @@ -0,0 +1,224 @@ + + + + + + + auditallow + tunableif + allow + dontaudit + typetransition + typechange + tunable + type + role + user + userattribute + userattributeset + sensitivity + category + categoryset + level + levelrange + class + ipaddr + classmap + classpermission + boolean + string + name + handleunknown + block + blockabstract + classorder + classmapping + classpermissionset + common + classcommon + sid + sidcontext + sidorder + userlevel + userrange + userbounds + userprefix + selinuxuser + selinuxuserdefault + typeattribute + typeattributeset + expandtypeattribute + typealias + typealiasactual + typebounds + typepermissive + rangetransition + userrole + roletype + roletransition + roleallow + roleattribute + roleattributeset + rolebounds + booleanif + neverallow + typemember + sensitivityalias + sensitivityaliasactual + categoryalias + categoryaliasactual + categoryorder + sensitivityorder + sensitivitycategory + constrain + mlsconstrain + validatetrans + mlsvalidatetrans + context + filecon + ibpkeycon + ibendportcon + portcon + nodecon + genfscon + netifcon + pirqcon + iomemcon + ioportcon + pcidevicecon + devicetreecon + fsuse + policycap + optional + defaultuser + defaultrole + defaulttype + mls + defaultrange + + perm + allowx + auditallowx + dontauditx + neverallowx + permissionx + ioctl + unordered + + + + call + macro + blockinherit + in + + + and + or + not + eq + neq + dom + domby + incomp + xor + range + + + + + t1 + t2 + t3 + r1 + r2 + r3 + u1 + u2 + u3 + l1 + l2 + h1 + h2 + true + false + self + object_r + * + udp + tcp + dccp + sctp + all + allow + deny + reject + file + dir + char + socket + pipe + symlink + any + xattr + task + trans + source + target + low + high + low-high + glblub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +