태그 보관물: syslog

syslog

우분투 서버 16.04-OpenVPN이 시작되지 않는 것 같습니다, 로그가 작성되지 않습니다 start시작하면 시작한

다음 지침에 따라 Ubuntu 서버 16.04에 oepnvpn을 설치하고 oepnvpn을 설치하는 방법-openvpn
-server-on-ubuntu

openVPN 서버를 service openvpn start시작하면 시작한 것처럼 보이지만 로그 옵션이 활성화되어 있어도 로그 파일이 작성되지 않습니다.

status /var/log/openvpn-status.log
log  /var/log/openvpn.log

내가 시도 할 수있는 힌트가 있습니까?

  • 프로세스 / 서비스가 실제로 실행 중인지 어떻게 확인할 수 있습니까?
  • 매번 서비스가 중단되는지 어떻게 알 수 있습니까?
  • 왜 로그 파일이 작성되지 않습니까?

서비스 시작시 출력

root@Diabolo:/etc/openvpn# service openvpn stop
root@Diabolo:/etc/openvpn# service openvpn start
root@Diabolo:/etc/openvpn# service openvpn status
openvpn.service - OpenVPN service
Loaded: loaded (/lib/systemd/system/openvpn.service; enabled; vendor preset: enabled)
Active: active (exited) since Sat 2016-06-25 19:04:12 CEST; 3s ago
Process: 3956 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 3956 (code=exited, status=0/SUCCESS)
Jun 25 19:04:12 Diabolo systemd[1]: Starting OpenVPN service...
Jun 25 19:04:12 Diabolo systemd[1]: Started OpenVPN service.

syslog에 출력

Jun 25 19:04:12 Diabolo systemd[1]: Starting OpenVPN service...
Jun 25 19:04:12 Diabolo systemd[1]: Started OpenVPN service.

구성 파일 server.conf

port 1194
proto udp
dev tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
dh /etc/openvpn/dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
keepalive 10 120
comp-lzo
max-clients 100
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn-status.log
log  /var/log/openvpn.log
verb 3



답변

문제는 서비스 구성이 /lib/systemd/system/openvpn.service단지 호출 /bin/true한다는 것입니다 (왜 제거되지 않았는지 전혀 알 수 없습니다). 사용 가능한 구성은에서 찾을 수 /lib/systemd/system/openvpn@.service있지만 여전히 약간의 해킹이 필요합니다.

나를 위해 일한 솔루션 :

1. 네트워킹 서비스에 대한 의존성 창출

덮어 쓰지 않도록하려면 서브 디렉토리의 별도 파일에 파일을 작성하십시오.

 mkdir -p /lib/systemd/system/openvpn\@.service.d

이 디렉토리에 파일을 작성하십시오. .conf예를 들어 이름은로 끝나야합니다 .

 vi /lib/systemd/system/openvpn\@.service.d/local-after-ifup.conf

이 파일에 다음 내용을 넣으십시오.

[Unit]
Requires=networking.service
After=networking.service

2. 서버를 시작하십시오

systemctl start openvpn@<CONF_NAME>.service

여기서 CONF_NAME은 디렉토리에있는 .conf파일 이름입니다 /etc/openvpn. 귀하의 경우 :

systemctl start openvpn@server.service

3. 모든 것이 작동하면 서비스 자동 시작 활성화

systemctl enable openvpn@server.service


답변

전체를 검색 한 후이 링크를 찾았습니다.

https://a20.net/bert/2016/09/27/openvpn-client-connection-not-started-on-ubuntu-16-04/

edit /etc/default/openvpn, uncomment AUTOSTART=”all”
sudo systemctl daemon-reload
sudo service openvpn restart

나는 그것을 조금 더 끓였다.

echo 'echo "AUTOSTART="\"all"\"" >> /etc/default/openvpn' | sudo -s
sudo systemctl daemon-reload
sudo service openvpn restart


답변

/etc/init.d/openvpn의 버그로 인해?

# check if automatic startup is disabled by AUTOSTART=none
if test "x$AUTOSTART" = "xnone" -o -z "$AUTOSTART" ; then
  log_warning_msg " Autostart disabled."
  exit 0
fi
if test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
  # all VPNs shall be started automatically
  ...

/ etc / default / openvpn에서 AUTOSTART가 비어 있으면 스크립트가 종료되는 것 같습니다. 따라서 Phillip의 솔루션을 선택하거나 119 행에서 두 번째 조건을 제거하십시오.

-o -z "$AUTOSTART"


답변

서버 conf 파일은 myserver.conf입니다.

systemctl enable openvpn@myserver
service openvpn@myserver start

서버 conf 파일은 yourserver.conf입니다.

systemctl enable openvpn@yourserver
service openvpn@yourserver start


답변

Phillip Moxley의 답변에 대한 대안으로 /etc/default/openvpn파일을 편집 하고 AUTOSTART행을

AUTOSTART="server"


답변