SELinuxProject / selinux

This is the upstream repository for the Security Enhanced Linux (SELinux) userland libraries and tools. The software provided by this project complements the SELinux features integrated into the Linux kernel and is used by Linux distributions. All bugs and patches should be submitted to selinux@vger.kernel.org
Other
1.35k stars 360 forks source link

dismod: add --actions option to use dispol in non-interactive way #382

Closed masatake closed 1 year ago

masatake commented 1 year ago

Example session:

$ ./dismod --help
Usage:
 ./dismod [OPTIONS] binary_pol_file

Options:
 -h, --help              print this help message
 -a, --actions ACTIONS   run non-interactively

Actions:
  1    display unconditional AVTAB
  2    display conditional AVTAB
  3    display users
  4    display bools
  5    display roles
  6    display types, attributes, and aliases
  7    display role transitions
  8    display role allows
  9    Display policycon
  0    Display initial SIDs
  a    Display avrule requirements
  b    Display avrule declarations
  c    Display policy capabilities
  u    Display the unknown handling setting
  F    Display filename_trans rules

$ ./dismod --actions 16 input.mod
Reading policy...
libsepol.policydb_index_others: security:  0 users, 1 roles, 2 types, 0 bools
libsepol.policydb_index_others: security: 0 sens, 0 cats
libsepol.policydb_index_others: security:  1 classes, 0 rules, 0 cond rules
libsepol.policydb_index_others: security:  0 users, 1 roles, 2 types, 0 bools
libsepol.policydb_index_others: security: 0 sens, 0 cats
libsepol.policydb_index_others: security:  1 classes, 0 rules, 0 cond rules
Binary policy module file loaded.
Module name: input
Module version: 1.0.0
Policy version: 21

unconditional avtab:
--- begin avrule block ---
decl 1:
  allow [httpd_t] [http_port_t] : [tcp_socket] { name_bind };

 [http_port_t] [2]: type flags:0
 [httpd_t] [1]: type flags:0
bachradsusi commented 1 year ago

Thanks for the patches. Please send them to selinux@vger.selinux.org for review when you are ready, see https://github.com/SELinuxProject/selinux/blob/master/CONTRIBUTING.md If you, for any reason, can't send it I could do it for you.

masatake commented 1 year ago

Thank you. I have just sent the changes to the mailing list. I changed the commit log messages are a bit before sending. My changes may be handled on the mailing list. So I close this pull request.