Modifying Solaris Services
Recently I ran into an issue: the sshd service on a Solaris 10 box needed to be used with a custom configuration file. By default, the sshd service will use /etc/ssh/sshd_config. I needed it to use /etc/ssh/sshd_config_custom. I could not just modify the default configuration file. Don’t ask why – it’s complicated. So here’s what I ended up doing and this process is applicable to modifying any other Solaris 10 (and above) service:
See what SSH services are running on the system
# svc | grep ssh online 16:00:01 svc:/network/ssh:default
Get the details for the “network/ssh” service
# svcs -l network/ssh fmri svc:/network/ssh:default name SSH server enabled true state online next_state none state_time Thu Sep 09 16:00:01 2010 logfile /var/svc/log/network-ssh:default.log restarter svc:/system/svc/restarter:default contract_id 146 dependency require_all/none svc:/system/filesystem/local (online) dependency optional_all/none svc:/system/filesystem/autofs (online) dependency require_all/none svc:/network/loopback (online) dependency require_all/none svc:/network/physical (online) dependency require_all/none svc:/system/cryptosvc (online) dependency require_all/none svc:/system/utmp (online) dependency require_all/restart file://localhost/etc/ssh/sshd_config (online)
Create custom sshd configuration file. For this example we will just make a copy of the default sshd_config and then rename the default file to something else.
cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_custom mv /etc/ssh/sshd_config /etc/ssh/ssh_config_old
Edit the ssh.xml file containing service configuration details for network/ssh service
vi /var/svc/manifest/network/ssh.xml
Find the following line:
value='file://localhost/etc/ssh/sshd_config />'
And change it to:
value='file://localhost/etc/ssh/sshd_config_custom />'
Edit the sshd startup file:
vi /lib/svc/method/sshd
Fine the following line in the “start” section of the “case” function:
/usr/lib/ssh/sshd
And change it to:
/usr/lib/ssh/sshd -f /etc/ssh/sshd_config_custom
Finally, restart sshd service:
svcadm restart network/ssh
And you are done. They sure made managing services startup easier in Solaris 10
Popularity: 1% [?]
Related posts:


