def _get_discoveryauth(self):
config = IscsiClient.instance().get_config()
- user = ''
- password = ''
- chap = config['discovery_auth']['chap']
- if chap:
- user, password = chap.split('/')
- mutual_user = ''
- mutual_password = ''
- chap_mutual = config['discovery_auth']['chap_mutual']
- if chap_mutual:
- mutual_user, mutual_password = chap_mutual.split('/')
+ user = config['discovery_auth']['username']
+ password = config['discovery_auth']['password']
+ mutual_user = config['discovery_auth']['mutual_username']
+ mutual_password = config['discovery_auth']['mutual_password']
return {
'user': user,
'password': password,
target_iqn, client_iqn, image_id)
user = client['auth']['user']
password = client['auth']['password']
- chap = '{}/{}'.format(user, password) if user and password else ''
m_user = client['auth']['mutual_user']
m_password = client['auth']['mutual_password']
- m_chap = '{}/{}'.format(m_user, m_password) if m_user and m_password else ''
IscsiClient.instance(gateway_name=gateway_name).create_client_auth(
- target_iqn, client_iqn, chap, m_chap)
+ target_iqn, client_iqn, user, password, m_user, m_password)
TaskManager.current_task().inc_progress(task_progress_inc)
for group in groups:
group_id = group['group_id']
'image': image
}
luns.append(lun)
- user = None
- password = None
- if '/' in client_config['auth']['chap']:
- user, password = client_config['auth']['chap'].split('/', 1)
- mutual_user = None
- mutual_password = None
- if '/' in client_config['auth']['chap_mutual']:
- mutual_user, mutual_password = client_config['auth']['chap_mutual'].split('/', 1)
+ user = client_config['auth']['username']
+ password = client_config['auth']['password']
+ mutual_user = client_config['auth']['mutual_username']
+ mutual_password = client_config['auth']['mutual_password']
client = {
'client_iqn': client_iqn,
'luns': luns,
<span class="help-block"
*ngIf="discoveryForm.showError('password', formDir, 'pattern')"
i18n>Passwords must have a length of 12 to 16 characters
- and can only contain letters, '@', '-' or '_'.</span>
+ and can only contain letters, '@', '-', '_' or '/'.</span>
</div>
</div>
<span class="help-block"
*ngIf="discoveryForm.showError('mutual_password', formDir, 'pattern')"
i18n>Passwords must have a length of 12 to 16 characters and
- can only contain letters, '@', '-' or '_'.</span>
+ can only contain letters, '@', '-', '_' or '/'.</span>
</div>
</div>
</div>
discoveryForm: CdFormGroup;
USER_REGEX = /[\w\.:@_-]{8,64}/;
- PASSWORD_REGEX = /[\w@\-_]{12,16}/;
+ PASSWORD_REGEX = /[\w@\-_\/]{12,16}/;
constructor(
public bsModalRef: BsModalRef,
<span class="help-block"
*ngIf="initiator.showError('password', formDir, 'pattern')"
i18n>Passwords must have a length of 12 to 16 characters
- and can only contain letters, '@', '-' or '_'.</span>
+ and can only contain letters, '@', '-', '_' or '/'.</span>
</div>
</div>
<span class="help-block"
*ngIf="initiator.showError('mutual_password', formDir, 'pattern')"
i18n>Passwords must have a length of 12 to 16 characters and
- can only contain letters, '@', '-' or '_'.</span>
+ can only contain letters, '@', '-', '_' or '/'.</span>
</div>
</div>
</ng-container>
IQN_REGEX = /^iqn\.(19|20)\d\d-(0[1-9]|1[0-2])\.\D{2,3}(\.[A-Za-z0-9-]+)+(:[A-Za-z0-9-\.]+)*$/;
USER_REGEX = /[\w\.:@_-]{8,64}/;
- PASSWORD_REGEX = /[\w@\-_]{12,16}/;
+ PASSWORD_REGEX = /[\w@\-_\/]{12,16}/;
constructor(
private iscsiService: IscsiService,
<context context-type="sourcefile">app/core/auth/user-form/user-form.component.html</context>
<context context-type="linenumber">42</context>
</context-group>
- </trans-unit><trans-unit id="4b2dd8635fba00476da25977e0884969821e62da" datatype="html">
+ </trans-unit><trans-unit id="fdfee5d7a27e1bdd97a176097277bee078de6aaf" datatype="html">
<source>Passwords must have a length of 12 to 16 characters
- and can only contain letters, '@', '-' or '_'.</source>
+ and can only contain letters, '@', '-', '_' or '/'.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/ceph/block/iscsi-target-form/iscsi-target-form.component.html</context>
<context context-type="linenumber">292</context>
<context context-type="sourcefile">app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.html</context>
<context context-type="linenumber">98</context>
</context-group>
- </trans-unit><trans-unit id="c58e136a292acf8ebccfa6d777fdff9f392b6ee2" datatype="html">
+ </trans-unit><trans-unit id="8406eb7415ee40e54d9ecb209abb056f06e3d666" datatype="html">
<source>Passwords must have a length of 12 to 16 characters and
- can only contain letters, '@', '-' or '_'.</source>
+ can only contain letters, '@', '-', '_' or '/'.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/ceph/block/iscsi-target-form/iscsi-target-form.component.html</context>
<context context-type="linenumber">352</context>
<context context-type="sourcefile">app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.html</context>
<context context-type="linenumber">88</context>
</context-group>
- </trans-unit><trans-unit id="fcbd385c9738f3c376e7f0935c9ac1ae6f863476" datatype="html">
+ </trans-unit><trans-unit id="6682d1c00263bee204583a5d589b308b6be88b0f" datatype="html">
<source>Passwords must have a length of 12 to 16 characters
- and can only contain letters, '@', '-' or '_'.</source>
+ and can only contain letters, '@', '-', '_' or '/'.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.html</context>
<context context-type="linenumber">64</context>
</context-group>
- </trans-unit><trans-unit id="fd0c0472536d61ac9f5bc62d5f9ed01673cf3603" datatype="html">
+ </trans-unit><trans-unit id="8800276925157c666b103c36ff7fe8ffe11980b4" datatype="html">
<source>Passwords must have a length of 12 to 16 characters and
- can only contain letters, '@', '-' or '_'.</source>
+ can only contain letters, '@', '-', '_' or '/'.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.html</context>
<context context-type="linenumber">123</context>
})
@RestClient.api_put('/api/clientauth/{target_iqn}/{client_iqn}')
- def create_client_auth(self, target_iqn, client_iqn, chap, chap_mutual, request=None):
- logger.debug("iSCSI: Creating client auth: %s/%s/%s/%s",
- target_iqn, client_iqn, chap, chap_mutual)
+ def create_client_auth(self, target_iqn, client_iqn, username, password, mutual_username,
+ mutual_password, request=None):
+ logger.debug("iSCSI: Creating client auth: %s/%s/%s/%s/%s/%s",
+ target_iqn, client_iqn, username, password, mutual_username, mutual_password)
return request({
- 'chap': chap,
- 'chap_mutual': chap_mutual
+ 'username': username,
+ 'password': password,
+ 'mutual_username': mutual_username,
+ 'mutual_password': mutual_password
})
@RestClient.api_put('/api/hostgroup/{target_iqn}/{group_name}')
def update_discoveryauth(self, user, password, mutual_user, mutual_password, request=None):
logger.debug("iSCSI: Updating discoveryauth: %s/%s/%s/%s", user, password, mutual_user,
mutual_password)
- chap = ''
- if user and password:
- chap = '{}/{}'.format(user, password)
- chap_mutual = ''
- if mutual_user and mutual_password:
- chap_mutual = '{}/{}'.format(mutual_user, mutual_password)
return request({
- 'chap': chap,
- 'chap_mutual': chap_mutual
+ 'username': user,
+ 'password': password,
+ 'mutual_username': mutual_user,
+ 'mutual_password': mutual_password
})
@RestClient.api_put('/api/targetauth/{target_iqn}')
self.config = {
"created": "2019/01/17 08:57:16",
"discovery_auth": {
- "chap": "",
- "chap_mutual": ""
+ "username": "",
+ "password": "",
+ "password_encryption_enabled": False,
+ "mutual_username": "",
+ "mutual_password": "",
+ "mutual_password_encryption_enabled": False
},
"disks": {},
"epoch": 0,
target_config = self.config['targets'][target_iqn]
target_config['clients'][client_iqn] = {
"auth": {
- "chap": "",
- "chap_mutual": ""
+ "username": "",
+ "password": "",
+ "password_encryption_enabled": False,
+ "mutual_username": "",
+ "mutual_password": "",
+ "mutual_password_encryption_enabled": False
},
"group_name": "",
"luns": {}
target_config = self.config['targets'][target_iqn]
target_config['clients'][client_iqn]['luns'][image_id] = {}
- def create_client_auth(self, target_iqn, client_iqn, chap, chap_mutual):
+ def create_client_auth(self, target_iqn, client_iqn, user, password, m_user, m_password):
target_config = self.config['targets'][target_iqn]
- target_config['clients'][client_iqn]['auth']['chap'] = chap
- target_config['clients'][client_iqn]['auth']['chap_mutual'] = chap_mutual
+ target_config['clients'][client_iqn]['auth']['username'] = user
+ target_config['clients'][client_iqn]['auth']['password'] = password
+ target_config['clients'][client_iqn]['auth']['mutual_username'] = m_user
+ target_config['clients'][client_iqn]['auth']['mutual_password'] = m_password
def create_group(self, target_iqn, group_name, members, image_ids):
target_config = self.config['targets'][target_iqn]
return {'data': ips[self.gateway_name]}
def update_discoveryauth(self, user, password, mutual_user, mutual_password):
- chap = ''
- if user and password:
- chap = '{}/{}'.format(user, password)
- chap_mutual = ''
- if mutual_user and mutual_password:
- chap_mutual = '{}/{}'.format(mutual_user, mutual_password)
- self.config['discovery_auth'] = {
- 'chap': chap,
- 'chap_mutual': chap_mutual
- }
+ self.config['discovery_auth']['username'] = user
+ self.config['discovery_auth']['password'] = password
+ self.config['discovery_auth']['mutual_username'] = mutual_user
+ self.config['discovery_auth']['mutual_password'] = mutual_password
def update_targetauth(self, target_iqn, action):
self.config['targets'][target_iqn]['acl_enabled'] = (action == 'enable_acl')