Lines Matching refs:semanage
6 import semanage
151 (trans_cnt, mlist, mlist_size) = semanage.semanage_module_list(sh)
163 module = semanage.semanage_module_list_nth(mlist, idx)
166 print("Module name: %s" % semanage.semanage_module_get_name(module))
171 (status, slist) = semanage.semanage_seuser_list(sh)
183 print("seuser name: %s" % semanage.semanage_seuser_get_name(seuser))
184 print(" seuser mls range: %s" % semanage.semanage_seuser_get_mlsrange(seuser))
185 print(" seuser sename: %s" % semanage.semanage_seuser_get_sename(seuser))
186 semanage.semanage_seuser_free(seuser)
191 (status, ulist) = semanage.semanage_user_list(sh)
203 print("User name: %s" % semanage.semanage_user_get_name(user))
204 print(" User labeling prefix: %s" % semanage.semanage_user_get_prefix(user))
205 print(" User mls level: %s" % semanage.semanage_user_get_mlslevel(user))
206 print(" User mls range: %s" % semanage.semanage_user_get_mlsrange(user))
207 print(" User number of roles: %s" % semanage.semanage_user_get_num_roles(user))
209 (status, rlist) = semanage.semanage_user_get_roles(sh, user)
216 semanage.semanage_user_free(user)
221 (status, plist) = semanage.semanage_port_list(sh)
233 low = semanage.semanage_port_get_low(port)
234 high = semanage.semanage_port_get_high(port)
235 con = semanage.semanage_port_get_con(port)
236 proto = semanage.semanage_port_get_proto(port)
237 proto_str = semanage.semanage_port_get_proto_str(proto)
242 (rc, con_str) = semanage.semanage_context_to_string(sh, con)
246 semanage.semanage_port_free(port)
251 (status, flist) = semanage.semanage_fcontext_list(sh)
263 expr = semanage.semanage_fcontext_get_expr(fcon)
264 type = semanage.semanage_fcontext_get_type(fcon)
265 type_str = semanage.semanage_fcontext_get_type_str(type)
266 con = semanage.semanage_fcontext_get_con(fcon)
270 (rc, con_str) = semanage.semanage_context_to_string(sh, con)
274 semanage.semanage_fcontext_free(fcon)
279 (status, ilist) = semanage.semanage_iface_list(sh)
291 name = semanage.semanage_iface_get_name(iface)
292 msg_con = semanage.semanage_iface_get_msgcon(iface)
293 if_con = semanage.semanage_iface_get_ifcon(iface)
294 (rc, msg_con_str) = semanage.semanage_context_to_string(sh, msg_con)
297 (rc, if_con_str) = semanage.semanage_context_to_string(sh, if_con)
301 semanage.semanage_iface_free(iface)
306 (status, blist) = semanage.semanage_bool_list(sh)
318 name = semanage.semanage_bool_get_name(pbool)
319 value = semanage.semanage_bool_get_value(pbool)
321 semanage.semanage_bool_free(pbool)
326 (status, ablist) = semanage.semanage_bool_list_active(sh)
338 name = semanage.semanage_bool_get_name(abool)
339 value = semanage.semanage_bool_get_value(abool)
341 semanage.semanage_bool_free(abool)
346 (status, nlist) = semanage.semanage_node_list(sh)
359 (status, addr) = semanage.semanage_node_get_addr(sh, node)
363 (status, mask) = semanage.semanage_node_get_mask(sh, node)
367 proto = semanage.semanage_node_get_proto(node)
368 proto_str = semanage.semanage_node_get_proto_str(proto)
369 con = semanage.semanage_node_get_con(node)
371 (status, con_str) = semanage.semanage_context_to_string(sh, con)
376 semanage.semanage_node_free(node)
381 (status, user) = semanage.semanage_user_create(sh)
387 status = semanage.semanage_user_set_name(sh, user, "testPyUser")
391 print("User name set: %s" % semanage.semanage_user_get_name(user))
393 status = semanage.semanage_user_add_role(sh, user, "user_r")
397 status = semanage.semanage_user_set_prefix(sh, user, "user")
401 print("User prefix set: %s" % semanage.semanage_user_get_prefix(user))
403 status = semanage.semanage_user_set_mlsrange(sh, user, "s0")
407 print("User mlsrange: %s" % semanage.semanage_user_get_mlsrange(user))
409 status = semanage.semanage_user_set_mlslevel(sh, user, "s0")
413 print("User mlslevel: %s" % semanage.semanage_user_get_mlslevel(user))
415 (status, key) = semanage.semanage_user_key_extract(sh, user)
421 (status, exists) = semanage.semanage_user_exists_local(sh, key)
428 (status, old_user) = semanage.semanage_user_query_local(sh, key)
435 status = semanage.semanage_begin_transaction(sh)
439 status = semanage.semanage_user_modify_local(sh, key, user)
443 status = semanage.semanage_commit(sh)
448 status = semanage.semanage_begin_transaction(sh)
454 status = semanage.semanage_user_del_local(sh, key)
461 status = semanage.semanage_user_modify_local(sh, key, old_user)
467 status = semanage.semanage_commit(sh)
472 semanage.semanage_user_key_free(key)
473 semanage.semanage_user_free(user)
475 semanage.semanage_user_free(old_user)
480 (status, seuser) = semanage.semanage_seuser_create(sh)
486 status = semanage.semanage_seuser_set_name(sh, seuser, "testPySEUser")
490 print("SEUser name set: %s" % semanage.semanage_seuser_get_name(seuser))
492 status = semanage.semanage_seuser_set_sename(sh, seuser, "root")
496 print("SEUser seuser: %s" % semanage.semanage_seuser_get_sename(seuser))
498 status = semanage.semanage_seuser_set_mlsrange(sh, seuser, "s0:c0.c255")
502 print("SEUser mlsrange: %s" % semanage.semanage_seuser_get_mlsrange(seuser))
504 (status, key) = semanage.semanage_seuser_key_extract(sh, seuser)
510 (status, exists) = semanage.semanage_seuser_exists_local(sh, key)
517 (status, old_seuser) = semanage.semanage_seuser_query_local(sh, key)
524 status = semanage.semanage_begin_transaction(sh)
528 status = semanage.semanage_seuser_modify_local(sh, key, seuser)
532 status = semanage.semanage_commit(sh)
537 status = semanage.semanage_begin_transaction(sh)
543 status = semanage.semanage_seuser_del_local(sh, key)
550 status = semanage.semanage_seuser_modify_local(sh, key, old_seuser)
556 status = semanage.semanage_commit(sh)
561 semanage.semanage_seuser_key_free(key)
562 semanage.semanage_seuser_free(seuser)
564 semanage.semanage_seuser_free(old_seuser)
569 (status, port) = semanage.semanage_port_create(sh)
575 semanage.semanage_port_set_range(port, 150, 200)
576 low = semanage.semanage_port_get_low(port)
577 high = semanage.semanage_port_get_high(port)
581 semanage.semanage_port_set_proto(port, semanage.SEMANAGE_PROTO_TCP)
583 …print("SEPort protocol set: %s" % semanage.semanage_port_get_proto_str(semanage.SEMANAGE_PROTO_TCP…
585 (status, con) = semanage.semanage_context_create(sh)
591 status = semanage.semanage_context_set_user(sh, con, "system_u")
595 print("SEContext user: %s" % semanage.semanage_context_get_user(con))
597 status = semanage.semanage_context_set_role(sh, con, "object_r")
601 print("SEContext role: %s" % semanage.semanage_context_get_role(con))
603 status = semanage.semanage_context_set_type(sh, con, "http_port_t")
607 print("SEContext type: %s" % semanage.semanage_context_get_type(con))
609 status = semanage.semanage_context_set_mls(sh, con, "s0:c0.c255")
613 print("SEContext mls: %s" % semanage.semanage_context_get_mls(con))
615 status = semanage.semanage_port_set_con(sh, port, con)
621 (status, key) = semanage.semanage_port_key_extract(sh, port)
627 (status, exists) = semanage.semanage_port_exists_local(sh, key)
634 (status, old_port) = semanage.semanage_port_query_local(sh, key)
641 status = semanage.semanage_begin_transaction(sh)
645 status = semanage.semanage_port_modify_local(sh, key, port)
649 status = semanage.semanage_commit(sh)
654 status = semanage.semanage_begin_transaction(sh)
660 status = semanage.semanage_port_del_local(sh, key)
667 status = semanage.semanage_port_modify_local(sh, key, old_port)
673 status = semanage.semanage_commit(sh)
678 semanage.semanage_context_free(con)
679 semanage.semanage_port_key_free(key)
680 semanage.semanage_port_free(port)
682 semanage.semanage_port_free(old_port)
687 (status, fcon) = semanage.semanage_fcontext_create(sh)
693 status = semanage.semanage_fcontext_set_expr(sh, fcon, "/test/fcontext(/.*)?")
697 print("SEFContext expr set: %s" % semanage.semanage_fcontext_get_expr(fcon))
699 semanage.semanage_fcontext_set_type(fcon, semanage.SEMANAGE_FCONTEXT_REG)
701 ftype = semanage.semanage_fcontext_get_type(fcon)
702 print("SEFContext type set: %s" % semanage.semanage_fcontext_get_type_str(ftype))
704 (status, con) = semanage.semanage_context_create(sh)
710 status = semanage.semanage_context_set_user(sh, con, "system_u")
714 print("SEContext user: %s" % semanage.semanage_context_get_user(con))
716 status = semanage.semanage_context_set_role(sh, con, "object_r")
720 print("SEContext role: %s" % semanage.semanage_context_get_role(con))
722 status = semanage.semanage_context_set_type(sh, con, "default_t")
726 print("SEContext type: %s" % semanage.semanage_context_get_type(con))
728 status = semanage.semanage_context_set_mls(sh, con, "s0:c0.c255")
732 print("SEContext mls: %s" % semanage.semanage_context_get_mls(con))
734 status = semanage.semanage_fcontext_set_con(sh, fcon, con)
740 (status, key) = semanage.semanage_fcontext_key_extract(sh, fcon)
746 (status, exists) = semanage.semanage_fcontext_exists_local(sh, key)
753 (status, old_fcontext) = semanage.semanage_fcontext_query_local(sh, key)
760 status = semanage.semanage_begin_transaction(sh)
764 status = semanage.semanage_fcontext_modify_local(sh, key, fcon)
768 status = semanage.semanage_commit(sh)
773 status = semanage.semanage_begin_transaction(sh)
779 status = semanage.semanage_fcontext_del_local(sh, key)
786 status = semanage.semanage_fcontext_modify_local(sh, key, old_fcontext)
792 status = semanage.semanage_commit(sh)
797 semanage.semanage_context_free(con)
798 semanage.semanage_fcontext_key_free(key)
799 semanage.semanage_fcontext_free(fcon)
801 semanage.semanage_fcontext_free(old_fcontext)
806 (status, iface) = semanage.semanage_iface_create(sh)
812 status = semanage.semanage_iface_set_name(sh, iface, "test_iface")
816 print("SEIface name set: %s" % semanage.semanage_iface_get_name(iface))
818 (status, con) = semanage.semanage_context_create(sh)
824 status = semanage.semanage_context_set_user(sh, con, "system_u")
828 print("SEContext user: %s" % semanage.semanage_context_get_user(con))
830 status = semanage.semanage_context_set_role(sh, con, "object_r")
834 print("SEContext role: %s" % semanage.semanage_context_get_role(con))
836 status = semanage.semanage_context_set_type(sh, con, "default_t")
840 print("SEContext type: %s" % semanage.semanage_context_get_type(con))
842 status = semanage.semanage_context_set_mls(sh, con, "s0:c0.c255")
846 print("SEContext mls: %s" % semanage.semanage_context_get_mls(con))
848 status = semanage.semanage_iface_set_ifcon(sh, iface, con)
854 status = semanage.semanage_iface_set_msgcon(sh, iface, con)
860 (status, key) = semanage.semanage_iface_key_extract(sh, iface)
866 (status, exists) = semanage.semanage_iface_exists_local(sh, key)
873 (status, old_iface) = semanage.semanage_iface_query_local(sh, key)
880 status = semanage.semanage_begin_transaction(sh)
884 status = semanage.semanage_iface_modify_local(sh, key, iface)
888 status = semanage.semanage_commit(sh)
893 status = semanage.semanage_begin_transaction(sh)
899 status = semanage.semanage_iface_del_local(sh, key)
906 status = semanage.semanage_iface_modify_local(sh, key, old_iface)
912 status = semanage.semanage_commit(sh)
917 semanage.semanage_context_free(con)
918 semanage.semanage_iface_key_free(key)
919 semanage.semanage_iface_free(iface)
921 semanage.semanage_iface_free(old_iface)
926 (status, pbool) = semanage.semanage_bool_create(sh)
932 status = semanage.semanage_bool_set_name(sh, pbool, "allow_execmem")
936 print("SEBool name set: %s" % semanage.semanage_bool_get_name(pbool))
938 semanage.semanage_bool_set_value(pbool, 0)
940 print("SEbool value set: %s" % semanage.semanage_bool_get_value(pbool))
942 (status, key) = semanage.semanage_bool_key_extract(sh, pbool)
948 (status, exists) = semanage.semanage_bool_exists_local(sh, key)
955 (status, old_bool) = semanage.semanage_bool_query_local(sh, key)
962 status = semanage.semanage_begin_transaction(sh)
966 status = semanage.semanage_bool_modify_local(sh, key, pbool)
971 status = semanage.semanage_commit(sh)
976 status = semanage.semanage_begin_transaction(sh)
982 status = semanage.semanage_bool_del_local(sh, key)
989 status = semanage.semanage_bool_modify_local(sh, key, old_bool)
995 status = semanage.semanage_commit(sh)
1000 semanage.semanage_bool_key_free(key)
1001 semanage.semanage_bool_free(pbool)
1003 semanage.semanage_bool_free(old_bool)
1008 (status, key) = semanage.semanage_bool_key_create(sh, "allow_execmem")
1014 (status, old_bool) = semanage.semanage_bool_query_active(sh, key)
1020 (status, abool) = semanage.semanage_bool_create(sh)
1026 status = semanage.semanage_bool_set_name(sh, abool, "allow_execmem")
1030 print("SEBool name set: %s" % semanage.semanage_bool_get_name(abool))
1032 semanage.semanage_bool_set_value(abool, 0)
1034 print("SEbool value set: %s" % semanage.semanage_bool_get_value(abool))
1037 status = semanage.semanage_begin_transaction(sh)
1041 status = semanage.semanage_bool_set_active(sh, key, abool)
1045 status = semanage.semanage_commit(sh)
1051 status = semanage.semanage_begin_transaction(sh)
1055 status = semanage.semanage_bool_set_active(sh, key, old_bool)
1061 status = semanage.semanage_commit(sh)
1066 semanage.semanage_bool_key_free(key)
1067 semanage.semanage_bool_free(abool)
1068 semanage.semanage_bool_free(old_bool)
1073 (status, node) = semanage.semanage_node_create(sh)
1079 … status = semanage.semanage_node_set_addr(sh, node, semanage.SEMANAGE_PROTO_IP6, "ffee:dddd::bbbb")
1083 …status = semanage.semanage_node_set_mask(sh, node, semanage.SEMANAGE_PROTO_IP6, "::ffff:ffff:abcd:…
1087 semanage.semanage_node_set_proto(node, semanage.SEMANAGE_PROTO_IP6)
1089 …print("SENode protocol set: %s" % semanage.semanage_node_get_proto_str(semanage.SEMANAGE_PROTO_IP6…
1091 (status, con) = semanage.semanage_context_create(sh)
1097 status = semanage.semanage_context_set_user(sh, con, "system_u")
1101 print("SEContext user: %s" % semanage.semanage_context_get_user(con))
1103 status = semanage.semanage_context_set_role(sh, con, "object_r")
1107 print("SEContext role: %s" % semanage.semanage_context_get_role(con))
1109 status = semanage.semanage_context_set_type(sh, con, "lo_node_t")
1113 print("SEContext type: %s" % semanage.semanage_context_get_type(con))
1115 status = semanage.semanage_context_set_mls(sh, con, "s0:c0.c255")
1119 print("SEContext mls: %s" % semanage.semanage_context_get_mls(con))
1121 status = semanage.semanage_node_set_con(sh, node, con)
1127 (status, key) = semanage.semanage_node_key_extract(sh, node)
1133 (status, exists) = semanage.semanage_node_exists_local(sh, key)
1140 (status, old_node) = semanage.semanage_node_query_local(sh, key)
1147 status = semanage.semanage_begin_transaction(sh)
1151 status = semanage.semanage_node_modify_local(sh, key, node)
1155 status = semanage.semanage_commit(sh)
1160 status = semanage.semanage_begin_transaction(sh)
1166 status = semanage.semanage_node_del_local(sh, key)
1173 status = semanage.semanage_node_modify_local(sh, key, old_node)
1179 status = semanage.semanage_commit(sh)
1184 semanage.semanage_context_free(con)
1185 semanage.semanage_node_key_free(key)
1186 semanage.semanage_node_free(node)
1188 semanage.semanage_node_free(old_node)
1270 sh = semanage.semanage_handle_create()
1272 if semanage.semanage_is_managed(sh) != 1:
1275 status = semanage.semanage_connect(sh)
1281 status = semanage.semanage_disconnect(sh)
1285 semanage.semanage_handle_destroy(sh)