Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
19.1 Legacy Series
»
[SOLVED] How to start/stop/restart sshd with Monit in GUI
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] How to start/stop/restart sshd with Monit in GUI (Read 8945 times)
LouieLouie
Newbie
Posts: 43
Karma: 8
[SOLVED] How to start/stop/restart sshd with Monit in GUI
«
on:
May 19, 2019, 07:54:42 pm »
Running opnsense 19.1.8, I am trying to add sshd to Monit service monitoring. In the gui, the start and stop commands are required with the full path to the command. I've searched freebsd forums and tutorials, the /etc/rc.d commands don't work (can't even find rc.config), the 'service sshd start' commands aren't accepted.
May I ask for help, please? Thanks in advance!
«
Last Edit: May 20, 2019, 01:04:50 pm by LouieLouie
»
Logged
hbc
Hero Member
Posts: 501
Karma: 47
Re: How to start/stop/restart sshd with Monit in GUI
«
Reply #1 on:
May 20, 2019, 09:01:47 am »
Try:
Code:
[Select]
# /usr/local/sbin/configctl sshd restart
More about configctl:
https://docs.opnsense.org/development/backend/configd.html
Logged
Intel(R) Xeon(R) Silver 4116 CPU @ 2.10GHz (24 cores)
256 GB RAM, 300GB RAID1, 3x4 10G Chelsio T540-CO-SR
LouieLouie
Newbie
Posts: 43
Karma: 8
Re: How to start/stop/restart sshd with Monit in GUI
«
Reply #2 on:
May 20, 2019, 01:10:11 pm »
hbc: Thank you!
This
Code:
[Select]
# /usr/local/sbin/configctl sshd restart
didn't work because the default configd script is named openssh instead of sshd. But, by changing 'sshd' to 'openssh' , it worked.
I've never heard of configctl, that helped immensely. Thanks for you time!
Logged
franco
Administrator
Hero Member
Posts: 17661
Karma: 1611
Re: [SOLVED] How to start/stop/restart sshd with Monit in GUI
«
Reply #3 on:
May 20, 2019, 09:08:27 pm »
Hi,
I built something for you:
# pluginctl -s
configd
dhcpd
dhcpd6
dnsmasq
dpinger
dyndns
flowd_aggregate
ipfw
login
ntpd
openssh
pf
radvd
samplicate
strongswan
syslog
unbound
# pluginctl -s openssh stop
Connection to 10.0.0.1 closed by remote host.
Connection to 10.0.0.1 closed.
It hooks into the service control functionality (start, stop, restart) that you can see on the GUI. It's a patch that will likely be in 19.1.9.
https://github.com/opnsense/core/commit/255e9b76
You can try it on 19.1.8 using this command:
# opnsense-patch 255e9b76
Cheers,
Franco
Logged
LouieLouie
Newbie
Posts: 43
Karma: 8
Re: [SOLVED] How to start/stop/restart sshd with Monit in GUI
«
Reply #4 on:
May 21, 2019, 11:09:19 pm »
Franco, got a 'hunks failed' message when I attempted the patch:
sudo opnsense-patch 255e9b76
Password:
Fetched 255e9b76 via
https://github.com/opnsense/core
1 out of 1 hunks failed while patching sbin/pluginctl
OPNsense 19.1.8-amd64
FreeBSD 11.2-RELEASE-p10-HBSD
LibreSSL 2.8.3
Logged
franco
Administrator
Hero Member
Posts: 17661
Karma: 1611
Re: [SOLVED] How to start/stop/restart sshd with Monit in GUI
«
Reply #5 on:
May 22, 2019, 02:39:00 pm »
Oh, doesn't patch cleanly because of require header stuff....maybe fetch the raw file instead:
# cd /usr/local/sbin
# fetch
https://raw.githubusercontent.com/opnsense/core/master/src/sbin/pluginctl
# chmod 755 pluginctl
Cheers,
Franco
Logged
LouieLouie
Newbie
Posts: 43
Karma: 8
Re: [SOLVED] How to start/stop/restart sshd with Monit in GUI
«
Reply #6 on:
May 23, 2019, 02:21:42 pm »
That worked. I cat'd pluginctl, hoping that I understand correctly
. Testing today. Thanks!
Logged
LouieLouie
Newbie
Posts: 43
Karma: 8
Re: [SOLVED] How to start/stop/restart sshd with Monit in GUI
«
Reply #7 on:
May 23, 2019, 06:51:07 pm »
Franco,
May I ask if you could explain the use of 'pluginctl -c' or '-s' (configure mode vs service mode)?
Aside from that I tried it at the command line using -s and it worked. Adding it to the monit config for unbound and openssh now.
Logged
franco
Administrator
Hero Member
Posts: 17661
Karma: 1611
Re: [SOLVED] How to start/stop/restart sshd with Monit in GUI
«
Reply #8 on:
May 23, 2019, 07:15:26 pm »
Hi LouieLouie,
So configure mode (-c) is calling internal functions to reload the configuration and (all of its) services. Service mode (-s) simply starts stops or restarts a particular service without reconfiguring it.
-c without an argument gives you all possible reconfiguration "points" like bootup, local, remote, vpn where services can be clustered. These calls are all over the code to provide hooks to plugins.
-s without an argument gives you all configured services on the box for starting or stopping them manually (like you would in the GUI under System: Services).
Cheers,
Franco
Logged
lox
Newbie
Posts: 36
Karma: 1
Re: [SOLVED] How to start/stop/restart sshd with Monit in GUI
«
Reply #9 on:
July 19, 2019, 01:22:13 am »
I am trying to setup monit for unbound because it
fails to start on boot
Code:
[Select]
root@router:~ # pluginctl -s
root@router:~ #
It doesn't return anything and pluginctl -s unbound start/stop/restart has no effect
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
19.1 Legacy Series
»
[SOLVED] How to start/stop/restart sshd with Monit in GUI