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 1176034 - More validation required on ipa-restore's options
Summary: More validation required on ipa-restore's options
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ipa
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: rc
: ---
Assignee: IPA Maintainers
QA Contact: Namita Soman
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-19 08:53 UTC by Martin Kosek
Modified: 2015-03-05 10:19 UTC (History)
2 users (show)

Fixed In Version: ipa-4.1.0-14.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 10:19:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0442 0 normal SHIPPED_LIVE Moderate: ipa security, bug fix, and enhancement update 2015-03-05 14:50:39 UTC

Description Martin Kosek 2014-12-19 08:53:49 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/freeipa/ticket/4797

(1)Restore from data backup without --data option

{{{
[root@dhcp207-214 backup]# ipa-restore -p xxxxxxxx /var/lib/ipa/backup/ipa-data-2014-12-10-17-47-50/ -U
Preparing restore from /var/lib/ipa/backup/ipa-data-2014-12-10-17-47-50/ on dhcp207-214.testrelm.test
Each master will individually need to be re-initialized or
re-created from this one. The replication agreements on
masters running IPA 3.1 or earlier will need to be manually
re-enabled. See the man page for details.
Disabling all replication.
Disabling replication agreement on dhcp207-133.testrelm.test to dhcp207-214.testrelm.test
Stopping IPA services
Restoring from userRoot in TESTRELM-TEST
Restoring from ipaca in TESTRELM-TEST
Starting IPA services
Restarting SSSD
The ipa-restore command was successful
[root@dhcp207-214 backup]# 
}}}

Here restore is happening similar to restore from full backup but actually from data backup and that too without --data option. I am expecting that restore should fail and prompt an error message (or atleast a warning message) that --data option must be used with restore data backup.

Related one with --online option

{{{
[root@dhcp207-214 backup]# ipa-restore -p xxxxxxxx --online /var/lib/ipa/backup/ipa-data-2014-12-10-17-47-50/ -U
Preparing restore from /var/lib/ipa/backup/ipa-data-2014-12-10-17-47-50/ on dhcp207-214.testrelm.test
Each master will individually need to be re-initialized or
re-created from this one. The replication agreements on
masters running IPA 3.1 or earlier will need to be manually
re-enabled. See the man page for details.
Disabling all replication.
Disabling replication agreement on dhcp207-133.testrelm.test to dhcp207-214.testrelm.test
Stopping IPA services
Restoring from userRoot in TESTRELM-TEST
Unable to bind to LDAP server: cannot connect to 'ldapi://%2fvar%2frun%2fslapd-TESTRELM-TEST.socket': 
Restoring from ipaca in TESTRELM-TEST
Unable to bind to LDAP server: cannot connect to 'ldapi://%2fvar%2frun%2fslapd-TESTRELM-TEST.socket': 
Starting IPA services
Restarting SSSD
The ipa-restore command was successful
[root@dhcp207-214 backup]#
}}}

Here expecting an error message that --online option can only provided along with --data option.

(2)Restore with --no-logs option from data backup 

{{{
[root@dhcp207-214 backup]# ipa-restore -p xxxxxxxx --data /var/lib/ipa/backup/ipa-data-2014-12-10-17-38-58/ --no-logs -U
Preparing restore from /var/lib/ipa/backup/ipa-data-2014-12-10-17-38-58/ on dhcp207-214.testrelm.test
Each master will individually need to be re-initialized or
re-created from this one. The replication agreements on
masters running IPA 3.1 or earlier will need to be manually
re-enabled. See the man page for details.
Disabling all replication.
Disabling replication agreement on dhcp207-133.testrelm.test to dhcp207-214.testrelm.test
Stopping Directory Server
Restoring from userRoot in TESTRELM-TEST
Restoring from ipaca in TESTRELM-TEST
Starting Directory Server
The ipa-restore command was successful
[root@dhcp207-214 backup]#
}}}

Here restore should fail prompting an error message (or warning message at least) that --no-logs option can not be used with --data 

(3)Non-existent ds instance in --instance

{{{
[root@dhcp207-214 ~]# ipa-restore --data -p xxxxxxxx --instance=TESTRELM-TEST1 /var/lib/ipa/backup/ipa-full-2014-12-11-13-17-59/
Preparing restore from /var/lib/ipa/backup/ipa-full-2014-12-11-13-17-59/ on dhcp207-214.testrelm.test
No instances to restore to
[root@dhcp207-214 ~]#
}}}
Expecting error message : "Instance TESTRELM-TEST1 does not exist"

Similarly for --backend option

{{{
[root@dhcp207-214 ~]# ipa-restore --data -p xxxxxxxx --backend=userRoot1 /var/lib/ipa/backup/ipa-full-2014-12-11-13-17-59/
Preparing restore from /var/lib/ipa/backup/ipa-full-2014-12-11-13-17-59/ on dhcp207-214.testrelm.test
No instances to restore to
[root@dhcp207-214 ~]#
}}}

Expecting error message : "Backend userRoot1 does not exist"

Comment 1 Martin Kosek 2015-01-14 08:13:02 UTC
Fixed upstream
master:
https://fedorahosted.org/freeipa/changeset/10fe918acd8f7428588f2dff52f64070a9328c29
ipa-4-1:
https://fedorahosted.org/freeipa/changeset/6950e7b14f87bbe0e922f54b76f2c8319ae6c3fd

Note that issue (2) was not addressed upstream as it is benign.

Comment 3 Martin Kosek 2015-01-14 12:08:01 UTC
Master branch regression fixed:

master:
* 35c4fa2e36a83ad80c79a21ac8e495985f38dbde Fix IPA_BACKUP_DIR path name

No change is needed for the ipa-4-1 branch.

Comment 4 Kaleem 2015-01-27 13:24:47 UTC
Verified.

IPA Version:
============
[root@master ~]# rpm -q ipa-server
ipa-server-4.1.0-16.el7.x86_64
[root@master ~]# 

For scenario (1) and (2) of description, now we see that on console it is displayed that what kind of restore from what kind of backup is performed.
In this case, following is displayed.
"Performing DATA restore from DATA backup"

[root@master ~]# ipa-restore -p xxxxxxxx /var/lib/ipa/backup/ipa-data-2015-01-27-21-09-30/ -U
Preparing restore from /var/lib/ipa/backup/ipa-data-2015-01-27-21-09-30/ on master.testrelm.test
Performing DATA restore from DATA backup
Each master will individually need to be re-initialized or
re-created from this one. The replication agreements on
masters running IPA 3.1 or earlier will need to be manually
re-enabled. See the man page for details.
Disabling all replication.
Stopping Directory Server
Restoring from userRoot in TESTRELM-TEST
Restoring from ipaca in TESTRELM-TEST
Starting Directory Server
The ipa-restore command was successful
[root@master ~]#

Scenario (3) of description fixed with expected error messages now.

[root@master ~]# ipa-restore -p xxxxxxxx --data --instance=TESTRELM-TEST1 /var/lib/ipa/backup/ipa-data-2015-01-27-21-09-30/ -U
Preparing restore from /var/lib/ipa/backup/ipa-data-2015-01-27-21-09-30/ on master.testrelm.test
Instance TESTRELM-TEST1 does not exist
[root@master ~]# ipa-restore -p xxxxxxxx --data --backend=userRoot1 /var/lib/ipa/backup/ipa-data-2015-01-27-21-09-30/ -U
Preparing restore from /var/lib/ipa/backup/ipa-data-2015-01-27-21-09-30/ on master.testrelm.test
Backend userRoot1 does not exist
[root@master ~]#

Comment 6 errata-xmlrpc 2015-03-05 10:19:09 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, 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://rhn.redhat.com/errata/RHSA-2015-0442.html


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