OPENVPN RESTART SERVICE WITH CRON / OPENVPN REINICIAR SERVIÇO COM CRON
-
I have the following problem.
some users at home office when they connect to the VPN the connection does not enter, but when I go to the service in pfsense and restart it, the user manages to connect.
I would like a very simple solution, I am a beginner in pfsense so that cron restarts the service at least once a day at 11PM.
Can anyone help?
Estou com o seguinte problema.
alguns usuários em home office quando vão se conectar a VPN a conexão não entra, porém quando vou no serviço no pfsense e reinicio o mesmo, o usuário consegue se conecta.
Gostaria de uma solução bem simples, sou iniciante no pfsense para que o cron faça um restart no serviço pelomenos 1 vez no dia ás 11PM.
Alguem pode ajudar?
-
@rafaelvilelacosta94 said in OPENVPN RESTART SERVICE WITH CRON / OPENVPN REINICIAR SERVIÇO COM CRON:
when I go to the service in pfsense and restart it, the user manages to connect.
What does the VPN server log say?
Also is this OpenVPN, IPsec, Wireguard, or some other VPN server? I can move this into a topic specifically for your situation. -
-
I couldn't see the log at the time, but regardless, I wanted a restart of the openvpn service every night. how to do it in a simple way
-
Can someone give a simple step by step on how to run this openvpn restart?
-
Install the pfSense cron package.
Now you can see all the cron tasks, and add others.When I open two console (SSH actually for me) and in the first I goto menu option 8, and use this command :
tail -f /var/log/openvpn.log
and in the other I enter (command line also, option 8) :
/etc/rc.openvpn
I can see that my openvpn server gets restarted.
I'm not using openvpn clients, so I could not test that part.Now it's time to study 'cron syntax' add add your own cron task.
edit :
I never had to restart my openvpn server.
Are your users use an IP address - and is it correct ?
Are they use a host name ? and if so, it 'points' to the correct IP address ?
Can you see them trying in the openvpn server log, and why is there a fail ? -
@gertjan in the authentication logs normally.
What has happened is that in some isolated cases the client cannot connect and I don't have a log at the moment to simulate this situation.
I can only really see if it happens at the time, however I go and restart OPENVPN from the graphical part and it connects again.
I just would like to know how by command line I restart openVPN that's all, I'm new with pfsense.
My questions are:
1° Which command to stop, start, restart openvpn via command line.
2° How is the command to be inserted so that I can schedule the restart of openvpn.
If you can help me I would be grateful.
-
@rafaelvilelacosta94 said in OPENVPN RESTART SERVICE WITH CRON / OPENVPN REINICIAR SERVIÇO COM CRON:
I go and restart OPENVPN from the graphical part and it connects again
A OpenVPN server doesn't initiate a connection. It just 'listens'.
OpenVPN clients, your home workers, initiate the connect.@rafaelvilelacosta94 said in OPENVPN RESTART SERVICE WITH CRON / OPENVPN REINICIAR SERVIÇO COM CRON:
Which command to stop, start, restart openvpn via command line.
As said :
/etc/rc.openvpn
I've tried the command.
It restarted my OpenVPN server.
Did you tried it for yourself ?@rafaelvilelacosta94 said in OPENVPN RESTART SERVICE WITH CRON / OPENVPN REINICIAR SERVIÇO COM CRON:
2° How is the command to be inserted so that I can schedule the restart of openvpn
As said earlier, install the cron pfSense package.
Add this line :
Still, you should solve the real problem.
OpenVPN, like any other serveice running on your pfSense, will run for the eternity. No need to restart unbound, nginx, openvpn, etc etc.
If you think this is needed, then the issue has to be found, and solved.
I never found myself lock out of my OpenVPN connection, it always worked just fine for me.
If my OpenVPN wouldn't work, I have to take the car, and go to my work, and check on site what the issue is. I prefer to stay in bed ^^
If there was a ISP issue, the connection went down, then, yeah, OpenVPN would work. But not need to go on site, as .... there isn't an Internet access anyway, so nothing to 'repair' or solve. -
@gertjan You were very objective.
Thank you very much,
As I'm starting in PFsense it doesn't cost anything to put this CRON to restart at night.
like I mentioned to you very strange, this happens to some person or other and expected.
It seems that OPENVPN stops listening to that user, then when I restart it through the GUI, the client connects, but like, there are others connected and everything is working normally.
But it's fixed, thanks a lot for your support.