Configuring the SSH Server
This section describes the configuration model of the SSH server and provides examples of XML packets.
Data Model
The configuration model files matching the SSH server are huawei-stelnet.yang and huawei-ssh-server.yang.
Object |
Description |
Value |
Remarks |
---|---|---|---|
/huawei-stelnet:server/enable |
Enables the STelnet service. |
The value is of the Boolean type:
|
N/A |
/huawei-stelnet:client/first-time-enable |
Enables the initial authentication function on an SSH client. |
The value is of the Boolean type:
|
N/A |
/huawei-ssh-server:ssh-server/default-authentication-type |
Indicates the SSH authentication type. |
The value is of the enumerated type:
|
N/A |
/huawei-ssh-server:ssh-server/user/name |
Indicates the SSH user name. |
The value is a string of 1 to 64 case-sensitive characters without spaces. |
N/A |
/huawei-ssh-server:ssh-server/user/authentication-type |
Indicates the authentication mode of SSH users. |
The value is of the enumerated type: password: password authentication |
N/A |
/huawei-ssh-server:ssh-server/user/service-type |
Indicates the service type of SSH users. |
The value is of the enumerated type: all: SFTP and STelnet service types |
N/A |
Enabling the STelnet Service
This section provides a sample of enabling the STelnet service using the config method.
Operation |
XPATH |
---|---|
edit-config:config |
/huawei-stelnet:server/enable |
Data Requirements
Item |
Data |
Description |
---|---|---|
Whether the STelnet service is enabled |
true |
Enable the STelnet service. |
Request Example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <stelnet:server xmlns:stelnet="urn:huawei:params:xml:ns:yang:huawei-stelnet"> <stelnet:enable>true</stelnet:enable> </stelnet:server> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>
Enabling the Initial Authentication Function on an SSH Client
This section provides a sample of enabling the initial authentication function on an SSH client using the config method.
Operation |
XPATH |
---|---|
edit-config:config |
/huawei-stelnet:client/first-time-enable |
Data Requirements
Item |
Data |
Description |
---|---|---|
Whether the initial authentication function on an SSH client is enabled |
true |
Enable the initial authentication function on an SSH client. |
Request Example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <stelnet:client xmlns:stelnet="urn:huawei:params:xml:ns:yang:huawei-stelnet"> <stelnet:first-time-enable>true</stelnet:first-time-enable> </stelnet:client> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>
Configuring SSH Parameters
This section provides a sample of configuring SSH parameters using the config method.
Operation |
XPATH |
---|---|
edit-config:config |
|
Data Requirements
Item |
Data |
Description |
---|---|---|
SSH user |
a |
Set the SSH user name to a. |
SSH authentication type |
password |
Set the SSH authentication type to password authentication. |
Authentication mode of SSH users |
password |
Set the authentication mode of SSH users to password authentication. |
Service type of SSH users |
all |
Set the service types of SSH users to SFTP and STelnet. |
Request Example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <ssh:ssh-server xmlns:ssh="urn:huawei:params:xml:ns:yang:huawei-ssh-server"> <ssh:default-authentication-type>password</ssh:default-authentication-type> <ssh:user> <ssh:name>a</ssh:name> <ssh:authentication-type>password</ssh:authentication-type> <ssh:service-type>all</ssh:service-type> </ssh:user> </ssh:ssh-server> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>