-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Systemd control #895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Systemd control #895
Changes from 7 commits
63fb433
56d40d3
42a7434
58bafaa
b425d0a
358811a
da1cfee
c243cd9
5900c89
fccfb6b
23662c5
249ac8d
07e0c4f
314ed7f
2e2dccf
3da96bf
ea84264
0c1817f
79fd4e1
3f2e6dd
2f4d859
e387076
0a09265
309d5e2
df44614
0bc9ad2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,10 +109,13 @@ enable() | |
|
|
||
| if [ "X$2" = "Xdatabase" ]; then | ||
| echo "DB_DAEMON=ossec-dbd" >> ${PLIST}; | ||
| touch ${DIR}/etc/.dbd | ||
| elif [ "X$2" = "Xclient-syslog" ]; then | ||
| echo "CSYSLOG_DAEMON=ossec-csyslogd" >> ${PLIST}; | ||
| touch ${DIR}/etc/.csyslogd | ||
| elif [ "X$2" = "Xagentless" ]; then | ||
| echo "AGENTLESS_DAEMON=ossec-agentlessd" >> ${PLIST}; | ||
| touch ${DIR}/etc/.agentlessd | ||
| elif [ "X$2" = "Xdebug" ]; then | ||
| echo "DEBUG_CLI=\"-d\"" >> ${PLIST}; | ||
| else | ||
|
|
@@ -137,10 +140,13 @@ disable() | |
|
|
||
| if [ "X$2" = "Xdatabase" ]; then | ||
| echo "DB_DAEMON=\"\"" >> ${PLIST}; | ||
| rm /var/ossec/etc/.dbd | ||
| elif [ "X$2" = "Xclient-syslog" ]; then | ||
| echo "CSYSLOG_DAEMON=\"\"" >> ${PLIST}; | ||
| rm /var/ossec/etc/.csyslogd | ||
| elif [ "X$2" = "Xagentless" ]; then | ||
| echo "AGENTLESS_DAEMON=\"\"" >> ${PLIST}; | ||
| rm /var/ossec/etc/.agentlessd | ||
| elif [ "X$2" = "Xdebug" ]; then | ||
| echo "DEBUG_CLI=\"\"" >> ${PLIST}; | ||
| else | ||
|
|
@@ -184,6 +190,7 @@ testconfig() | |
| # Start function | ||
| start() | ||
| { | ||
|
|
||
| SDAEMONS="${DB_DAEMON} ${CSYSLOG_DAEMON} ${AGENTLESS_DAEMON} ossec-maild ossec-execd ossec-analysisd ossec-logcollector ossec-remoted ossec-syscheckd ossec-monitord" | ||
|
|
||
| echo "Starting $NAME $VERSION (by $AUTHOR)..." | ||
|
|
@@ -192,6 +199,16 @@ start() | |
| echo "OSSEC analysisd: Testing rules failed. Configuration error. Exiting." | ||
| exit 1; | ||
| fi | ||
|
|
||
| ## If the system is Linux, look for systemctl. If that file exists, use it. | ||
| ## XXX - system paths and exact execution are probably wrong. | ||
| if [ X`uname` == "XLinux" ]; then | ||
| if [ -x /sbin/systemctl ]; then | ||
| /sbin/ssytemctl start ossec-server.service | ||
| fi | ||
| exit 0 | ||
| fi | ||
|
|
||
| lock; | ||
| checkpid; | ||
|
|
||
|
|
@@ -251,6 +268,14 @@ pstatus() | |
| stopa() | ||
| { | ||
| lock; | ||
|
|
||
| if [ X`uname` == "XLinux" ]; then | ||
| if [ -x /sbin/systemctl ]; then | ||
| /sbin/systemctl stop ossec-server.service | ||
| fi | ||
| exit 0 | ||
| if | ||
|
||
|
|
||
| checkpid; | ||
| for i in ${DAEMONS}; do | ||
| pstatus ${i}; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| [Unit] | ||
| Description=OSSEC Execd | ||
| PartOf=ossec-agent.target | ||
| Before=ossec-ossec-syscheckd.service ossec-agentd.service ossec-logcollector.service | ||
|
||
|
|
||
| [Service] | ||
| EnvironmentFile=/etc/ossec-init.conf | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| [Unit] | ||
| Description=OSSEC Agentless | ||
| PartOf=ossec-server.target | ||
| After=ossec-analysisd.service ossec-execd.service ossec-logcollector.service ossec-maild.service ossec-monitord.service ossec-remoted.service ossec-syscheckd.service | ||
| ConditionPathExists=/var/ossec/etc/.agentlessd | ||
|
|
||
| [Service] | ||
| EnvironmentFile=/etc/ossec-init.conf | ||
| Environment=DIRECTORY=/var/ossec | ||
|
|
||
| ExecStartPre=/usr/bin/env ${DIRECTORY}/bin/ossec-agentlessd -t | ||
| ExecStart=/usr/bin/env ${DIRECTORY}/bin/ossec-agentlessd -f | ||
| ExecStart=/usr/bin/env ${DIRECTORY}/bin/ossec-agentlessd -f |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| [Unit] | ||
| Description=OSSEC Syslog client | ||
| PartOf=ossec-server.target | ||
| After=ossec-analysisd.service ossec-dbd.service ossec-execd.service ossec-logcollector.service ossec-maild.service ossec-monitord.service ossec-remoted.service ossec-syscheckd.service | ||
| ConditionPathExists=/var/ossec/etc/.csyslogd | ||
|
|
||
| [Service] | ||
| EnvironmentFile=/etc/ossec-init.conf | ||
| Environment=DIRECTORY=/var/ossec | ||
|
|
||
| ExecStartPre=/usr/bin/env ${DIRECTORY}/bin/ossec-csyslogd -t | ||
| ExecStart=/usr/bin/env ${DIRECTORY}/bin/ossec-csyslogd -f | ||
| ExecStart=/usr/bin/env ${DIRECTORY}/bin/ossec-csyslogd -f |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| [Unit] | ||
| Description=OSSEC remoted | ||
| PartOf=ossec-server.target | ||
| After=ossec-maild.service ossec-execd.service ossec-analysisd.service ossec-logcollector | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ossec-logcollector.service |
||
| Before=ossec-agentless.service ossec-csyslog.service ossec-dbd.service ossec-monitord.service ossec-syscheckd.service | ||
|
|
||
| [Service] | ||
| EnvironmentFile=/etc/ossec-init.conf | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| [Unit] | ||
| Description=OSSEC syscheckd | ||
| PartOf=ossec-server.target | ||
| After=ossec-maild.service ossec-execd.service ossec-analysisd.service ossec-remoted.service | ||
| Before=ossec-agentless.service ossec-csyslog.service ossec-dbd.service ossec-monitord.service ossec-remoted.service | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ossec-remoted has been in "After" section |
||
|
|
||
| [Service] | ||
| EnvironmentFile=/etc/ossec-init.conf | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.