{"action":"opened","issue":{"url":"https://api.github.com/repos/fail2ban/fail2ban/issues/2100","repository_url":"https://api.github.com/repos/fail2ban/fail2ban","labels_url":"https://api.github.com/repos/fail2ban/fail2ban/issues/2100/labels{/name}","comments_url":"https://api.github.com/repos/fail2ban/fail2ban/issues/2100/comments","events_url":"https://api.github.com/repos/fail2ban/fail2ban/issues/2100/events","html_url":"https://github.com/fail2ban/fail2ban/issues/2100","id":310485946,"number":2100,"title":"Misc journald tests fail when run as unprivileged user in CentOS 7","user":{"login":"Ziris85","id":14392979,"avatar_url":"https://avatars2.githubusercontent.com/u/14392979?v=4","gravatar_id":"","url":"https://api.github.com/users/Ziris85","html_url":"https://github.com/Ziris85","followers_url":"https://api.github.com/users/Ziris85/followers","following_url":"https://api.github.com/users/Ziris85/following{/other_user}","gists_url":"https://api.github.com/users/Ziris85/gists{/gist_id}","starred_url":"https://api.github.com/users/Ziris85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ziris85/subscriptions","organizations_url":"https://api.github.com/users/Ziris85/orgs","repos_url":"https://api.github.com/users/Ziris85/repos","events_url":"https://api.github.com/users/Ziris85/events{/privacy}","received_events_url":"https://api.github.com/users/Ziris85/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-02T13:33:29Z","updated_at":"2018-04-02T13:33:29Z","closed_at":null,"author_association":"NONE","body":"### Environment:\r\n\r\n- Fail2Ban version (including any possible distribution suffixes):\r\n- OS, including release name/version: `0.10.2`\r\n- [ ] Fail2Ban installed via OS/distribution mechanisms\r\n- [x] You have not applied any additional foreign patches to the codebase\r\n- [ ] Some customizations were done to the configuration (provide details below is so)\r\n\r\n### The issue:\r\nOn CentOS 7, when you run tests (either with `pythond setup.py test` or `./fail2ban-testcases-all`), the following tests fail when run as an unprivileged user:\r\n```\r\n======================================================================\r\nERROR: testJournalPathArg (fail2ban.tests.filtertestcase.MonitorJournalFailures<FilterSystemd>(monitorjournalfailures_FilterSystemd))\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"./fail2ban/tests/filtertestcase.py\", line 1191, in testJournalPathArg\r\n    self._initFilter(journalpath=jrnlpath)\r\n  File \"./fail2ban/tests/filtertestcase.py\", line 1158, in _initFilter\r\n    self.filter = Filter_(self.jail, **kwargs)\r\n  File \"./fail2ban/server/filtersystemd.py\", line 62, in __init__\r\n    self.__journal = journal.Reader(**jrnlargs)\r\n  File \"/usr/lib64/python2.7/site-packages/systemd/journal.py\", line 153, in __init__\r\n    super(Reader, self).__init__(flags, path, files)\r\nOSError: [Errno 2] No such file or directory: ''\r\n\r\n======================================================================\r\nFAIL: test_WrongChar (fail2ban.tests.filtertestcase.MonitorJournalFailures<FilterSystemd>(monitorjournalfailures_FilterSystemd))\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"./fail2ban/tests/filtertestcase.py\", line 1300, in test_WrongChar\r\n    self.assertTrue(self.isFilled(10))\r\nAssertionError: False is not true\r\n\r\n======================================================================\r\nFAIL: test_delJournalMatch (fail2ban.tests.filtertestcase.MonitorJournalFailures<FilterSystemd>(monitorjournalfailures_FilterSystemd))\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"./fail2ban/tests/filtertestcase.py\", line 1269, in test_delJournalMatch\r\n    self.assert_correct_ban(\"193.168.0.128\", 3)\r\n  File \"./fail2ban/tests/filtertestcase.py\", line 1205, in assert_correct_ban\r\n    self.assertTrue(self.waitFailTotal(test_attempts, 10)) # give Filter a chance to react\r\nAssertionError: False is not true\r\n\r\n======================================================================\r\nFAIL: test_grow_file (fail2ban.tests.filtertestcase.MonitorJournalFailures<FilterSystemd>(monitorjournalfailures_FilterSystemd))\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"./fail2ban/tests/filtertestcase.py\", line 1217, in test_grow_file\r\n    self._test_grow_file()\r\n  File \"./fail2ban/tests/filtertestcase.py\", line 1245, in _test_grow_file\r\n    self.assertTrue(self.isFilled(10))\r\nAssertionError: False is not true\r\n```\r\nI was able to trace the trouble to the user not having access to the systemd journal (which appears to be default behavior for unprivileged users on CentOS 7). Once I added the user to the `systemd-journal` group, the above tests no longer failed.\r\n\r\n#### Steps to reproduce\r\nRun either  `python setup.py test` or `./fail2ban-testcases-all` as an unprivileged user on CentOS 7.\r\n#### Expected behavior\r\nAll tests pass or are gracefully skipped.\r\n#### Observed behavior\r\nTests fail due to insufficient privileges.\r\n#### Any additional information\r\nGiven the nature of the software, needing access to the systemd journal makes sense. Would be nice if the tests would check if it had systemd journal access and threw an error about that before trying to run the tests."}}
{"actor":{"display_login":"Ziris85"}}