Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1540382 - sudo requires a tty while running katello-backup from cron [NEEDINFO]
sudo requires a tty while running katello-backup from cron
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Backup & Restore (Show other bugs)
6.2.13
Unspecified Unspecified
high Severity high (vote)
: 6.3.3
: Unused
Assigned To: Evgeni Golov
Kedar Bidarkar
: Triaged
Depends On:
Blocks: 1122832
  Show dependency treegraph
 
Reported: 2018-01-30 19:09 EST by Alexey Masolov
Modified: 2018-08-31 11 EDT (History)
17 users (show)

See Also:
Fixed In Version: katello-3.4.5-19
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1596353 (view as bug list)
Environment:
Last Closed: 2018-08-22 16:07:08 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
peli: needinfo? (chsimon)


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3346741 None None None 2018-02-07 07:00 EST
Red Hat Knowledge Base (Solution) 3354581 None None None 2018-02-15 08:35 EST
Foreman Issue Tracker 22551 None None None 2018-02-12 07:41 EST

  None (edit)
Description Alexey Masolov 2018-01-30 19:09:42 EST
Description of problem:
If you run katello-backup from cron then it fails with

'sorry, you must have a tty to run sudo'

Version-Release number of selected component (if applicable):
Satellite 6.2.13

How reproducible:
100%

Steps to Reproduce:

Put this line to crontab

33 15 * * * root /usr/bin/katello-backup /var/sat-content --online-backup --skip-pulp-content >> /var/log/satellite/backups.log 2>&1

Actual results:
Starting backup: 2018-01-27 15:33:02 +1100
Creating backup folder /var/sat-content/katello-backup-20180127153302
sudo: sorry, you must have a tty to run sudo
****cancelled****

Expected results:
Completed backup
Comment 1 Alexey Masolov 2018-01-30 19:10:52 EST
I also found that adding this line to /etc/sudoers help to avoid the error but this workaround is unacceptable in secured environments. 

Default !requiretty
Comment 4 Evgeni Golov 2018-02-12 07:41:03 EST
Created redmine issue http://projects.theforeman.org/issues/22551 from this bug
Comment 5 pm-sat@redhat.com 2018-02-12 08:06:27 EST
Upstream bug assigned to egolov@redhat.com
Comment 8 David Leatherman 2018-03-29 08:34:59 EDT
Reproduced it and the fix  "Default !requiretty" in the /etc/sudoers violates our security protocols.
Comment 15 Kedar Bidarkar 2018-08-01 09:06:01 EDT
Added the below entry to /etc/crontab file on the Satellite6

00 09 * * *  root /usr/sbin/satellite-backup -y /var/tmp/sat-content --online-backup --skip-pulp-content >> /var/log/satellite/backups.log 2>&1

---

Starting backup: 2018-08-01 09:00:02 -0400
Creating backup folder /var/tmp/sat-content/satellite-backup-20180801090002
Generating metadata ... 
Done.
Backing up config files... 
Done.
Backing up postgres online schema... 
Done.
Backing up mongo online schema... 
Done.
Done with backup: 2018-08-01 09:01:24 -0400
**** BACKUP Complete, contents can be found in: /var/tmp/sat-content/satellite-backup-20180801090002 ****

[root@testing-sat6 satellite-backup-20180801090002]# ls
candlepin.dump  config_files.tar.gz  foreman.dump  metadata.yml  mongo_dump  pg_globals.dump


VERIFIED with sat6.3.3 snap2 build
Comment 17 errata-xmlrpc 2018-08-22 16:07:08 EDT
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://access.redhat.com/errata/RHBA-2018:2550

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