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

NAS-130489 / 25.04 / Add support for discovery auth #15009

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
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
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
Loading