Skip to content

Commit

Permalink
Add support for discovery auth
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeagherix committed Nov 21, 2024
1 parent 510930b commit e189c1d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/middlewared/middlewared/etc_files/scst.conf.mako
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,22 @@
fcports_by_port_name = {d['port']: d for d in render_ctx['fcport.query']}
targets_by_id = {d['id']: d for d in targets}
authenticators = defaultdict(list)
for auth in middleware.call_sync('iscsi.auth.query'):
discovery_incoming = []
discovery_outgoing = []
for auth in render_ctx['iscsi.auth.query']:
authenticators[auth['tag']].append(auth)
disc_auth = auth.get('discovery_auth')
if disc_auth in ['CHAP', 'CHAP_MUTUAL']:
user = auth.get('user')
secret = auth.get('secret')
if user and secret:
discovery_incoming.append(f'{user} {secret}')
if disc_auth in ['CHAP_MUTUAL']:
user = auth.get('peeruser')
secret = auth.get('peersecret')
if user and secret:
discovery_outgoing.append(f'{user} {secret}')
def ha_node_wwpn_for_fcport(fcport):
if render_ctx['failover.node'] == 'A':
Expand Down Expand Up @@ -388,6 +402,17 @@ HANDLER ${handler} {
##
####################################################################################
TARGET_DRIVER iscsi {
% if node == 'A':
internal_portal 169.254.10.1
% elif node == 'B':
internal_portal 169.254.10.2
% endif
% for chap_auth in discovery_incoming:
IncomingUser "${chap_auth}"
% endfor
% if discovery_outgoing:
OutgoingUser "${discovery_outgoing[0]}"
% endif
enabled 1
link_local 0
## Currently SCST only supports one iSNS server
Expand Down
1 change: 1 addition & 0 deletions src/middlewared/middlewared/plugins/etc.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class EtcService(Service):
{'method': 'failover.status'},
{'method': 'fc.capable'},
{'method': 'fcport.query'},
{'method': 'iscsi.auth.query'},
{'method': 'iscsi.global.alua_enabled'},
{'method': 'iscsi.global.config'},
{'method': 'iscsi.target.query'},
Expand Down

0 comments on commit e189c1d

Please sign in to comment.