RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2063353 - semanage import fails with ValueError despite import starting with port -D to delete all first
Summary: semanage import fails with ValueError despite import starting with port -D to...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: policycoreutils
Version: 8.5
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Vit Mojzis
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 2108174
TreeView+ depends on / blocked
 
Reported: 2022-03-11 21:23 UTC by James Hartsock
Modified: 2024-07-30 06:13 UTC (History)
7 users (show)

Fixed In Version: policycoreutils-2.9-20.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2108174 (view as bug list)
Environment:
Last Closed: 2022-11-08 10:56:37 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-115397 0 None None None 2022-03-11 21:27:34 UTC
Red Hat Product Errata RHBA-2022:7805 0 None None None 2022-11-08 10:56:45 UTC

Description James Hartsock 2022-03-11 21:23:03 UTC
Description of problem:
  semanage import is able to import port rules fine as long as port isn't already defined.
  But if try run again (with port -D to delete all first) get error stating port is already defined.


Version-Release number of selected component (if applicable):
  # rpm -qf $(which semanage)
  policycoreutils-python-utils-2.9-16.el8.noarch


How reproducible:
  100%


Steps to Reproduce:
  1. Add custom port definition with semanage
  2. semanage export to file
  3. semanage import file from #2


Actual results:
  # semanage port -D
  # semanage port -a -t http_cache_port_t -r s0 -p tcp 3024

  # semanage export | grep -w port
  port -D
  port -a -t http_cache_port_t -r 's0' -p tcp 3024

  # echo -e "port -D\nport -a -t http_cache_port_t -r 's0' -p tcp 3024"  | semanage import
  ValueError: Port tcp/3024 already defined
  # echo $?
  1


Expected results:

  As the import has delete, it should not get "already defined" error.
  So expected result is should not have to manully delete them before doing import.

  # semanage port -D
  # echo -e "port -D\nport -a -t http_cache_port_t -r 's0' -p tcp 3024"  | semanage import
  # echo $?
  0


Additional info:
  Issue is present in fedora too (works first time, fails once defined)

  # rpm -qf $(which semanage)
  policycoreutils-python-utils-3.3-1.fc35.noarch
  # semanage port -D
  # echo -e "port -D\nport -a -t http_cache_port_t -r 's0' -p tcp 3024"  | semanage import
  # echo -e "port -D\nport -a -t http_cache_port_t -r 's0' -p tcp 3024"  | semanage import
  ValueError: Port tcp/3024 already defined



  Am able to run the delete and create that fails on import successfully on command line
  # semanage port -D ; semanage port -a -t http_cache_port_t -r s0 -p tcp 3024
  # echo $?
  0

Comment 13 errata-xmlrpc 2022-11-08 10:56:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (policycoreutils bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7805

Comment 14 rory586 2024-07-30 06:13:22 UTC Comment hidden (spam)

Note You need to log in before you can comment on or make changes to this bug.