Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable initiator name based ACL support #44

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ceph_iscsi_config/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ def define_client(self):
# LIO default 15
self.acl.set_attribute('nopin_timeout', '{}'.format(
settings.config.nopin_timeout))

# Use initiator name based ACL by default.
self.tpg.set_attribute('authentication', '0');
except RTSLibError as err:
self.logger.error("(Client.define_client) FAILED to define "
"{}".format(self.iqn))
Expand All @@ -196,13 +199,15 @@ def configure_auth(self, auth_type, credentials):
:return:
"""

disable_auth = False

if '/' in credentials:
client_username, client_password = credentials.split('/', 1)
elif not credentials:
client_username = ''
client_password = ''
credentials = "/"
disable_auth = True

self.logger.debug("configuring auth {}".format(credentials))

Expand Down Expand Up @@ -236,6 +241,11 @@ def configure_auth(self, auth_type, credentials):
self.error_msg = new_chap.error_msg
return

if disable_auth:
self.tpg.set_attribute('authentication', '0');
else:
self.tpg.set_attribute('authentication', '1');

self.logger.debug("Updating config object meta data")
self.metadata['auth']['chap'] = new_chap.chap_str

Expand Down