<< Click to Display Table of Contents >> Raynet One > 1.1 > User Guide > Technical overview > Custom inventory scripting > CSM inventory scripting Use case: reading SSH parameters |
The Secure Shell (SSH) is a set of tools and protocols used for device connection and maintenance. It is the favored method of many IT experts for Unix device administration. The /etc/ssh/sshd_config file contains the most critical configuration parameters for the device SSH service. Only-locally-connected devices use to allow the remote connection through the Unix root user. Web services tend to define their own set of users, for example by the www-data username.
Supported OS types: Linux
<CustomScriptSet Name="GetSSHDConfig" Version="1">
<CustomScript Name="GetSSHDConfig1" TargetPlatform="Linux">
<Command Name="lines" OnError="fail">cat /etc/ssh/sshd_config | grep '^[^#].*$'</Command>
<ForeachLine Values="$(lines)" Name="line">
<Command Name="dummy" OnError="fail">echo '$(line)'</Command>
<Item Name="/etc/ssh/sshd_config" Class="SSHDConfig" ItemName="$(dummy):0[0]">
<Property Name="Value" Value="$(dummy):0[1]" />
</Item>
</ForeachLine>
</CustomScript>
</CustomScriptSet>
This program shows you how the lines of a configuration file can be fetched. A dummy variable should be used to put the single line into a compatible object for CSM index-based operators. You can find the index-based operators in lines 6 and 7 inside of the ItemName and the Value XML attributes.