Skip to content
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

Add config files to run gsad as a unix daemon #1486

Merged
merged 3 commits into from Jul 17, 2019
Merged

Add config files to run gsad as a unix daemon #1486

merged 3 commits into from Jul 17, 2019

Conversation

bjoernricks
Copy link
Member

@bjoernricks bjoernricks commented Jul 17, 2019

Add config files for systemd, start arguments and logrotate.

Replaces #760

Checklist:

@bjoernricks bjoernricks marked this pull request as ready for review July 17, 2019 11:00
@bjoernricks bjoernricks requested review from a team, jjnicola and hd-gb July 17, 2019 11:00
Copy link
Contributor

@hsntgm hsntgm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gsad/config/gsad.logrotate.in

These are controlled globally by logrotate.conf so maybe user doesn't want to override it.

  • daily
  • rotate 7

copytruncate may cause lost logs, why we don't use create and kill HUP?

/var/log/gvm/gsad.log {
	sharedscripts
	missingok
        compress
        create
	notifempty
	postrotate
		/bin/kill -HUP `cat /var/run/gsad.pid 2>/dev/null` 2>/dev/null || true
	endscript
}

gsad/config/gsad.service.in

Don't we need gvmd & openvas-scanner before gsad ?
Also why we don't use ExecReload=/bin/kill -HUP $MAINPID

[Unit]
Description=Greenbone Security Assistant
After=network.target
After=openvas-scanner.service
After=gvmd.service
Wants=gvmd.service

[Service]
Type=forking
EnvironmentFile=-${DEFAULT_CONFIG_DIR}/gsad
ExecStart=${SBINDIR}/gsad --listen $GSA_ADDRESS --port $GSA_PORT
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
User=root
Group=root
TimeoutSec=1200

[Install]
WantedBy=multi-user.target

@bjoernricks
Copy link
Member Author

daily
rotate 7

I am going to remove them.

copytruncate may cause lost logs, why we don't use create and kill HUP?

Because I didn't wanted to restart the gsad daemon and therefore not answering to requests. Currently SIGHUP is ignored https://github.com/greenbone/gsa/blob/gsa-8.0/gsad/src/gsad.c#L2489

User=root
Group=root

gsad should not run as root.

After=openvas-scanner.service
After=gvmd.service
Wants=gvmd.service

Don't we need gvmd & openvas-scanner before gsad ?

Yes but currently we don't have service files for them.

This PR is intended as a start to get some service files into the releases. I am fine with adding further PRs to improve them.

@bjoernricks
Copy link
Member Author

copytruncate may cause lost logs, why we don't use create and kill HUP?

Just for curiosity how can log be lost in that case?

Add config files for systemd, start arguments and logrotate.

Replaces #760
@hsntgm
Copy link
Contributor

hsntgm commented Jul 17, 2019

copytruncate
Using copytruncate with size, maxsize options is more secure.

While the truncate operation is very fast, the copy can be quite long (depending of how big is your logfile). Moreover, some log entry can be lost during the time between the copy operation and the truncate.

Also thank you for the info:

Currently SIGHUP is ignored https://github.com/greenbone/gsa/blob/gsa-8.0/gsad/src/gsad.c#L2489

gvmd and open-scanner daemon are in the same situation about SIGHUP ? Then i Hhave to fix all my service files and logrotate files.

@bjoernricks
Copy link
Member Author

gvmd and open-scanner daemon are in the same situation about SIGHUP ?

At least gvmd seems to ignore it too https://github.com/greenbone/gvmd/blob/master/src/gvmd.c#L2605

@codecov
Copy link

codecov bot commented Jul 17, 2019

Codecov Report

Merging #1486 into gsa-8.0 will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           gsa-8.0    #1486   +/-   ##
========================================
  Coverage    37.43%   37.43%           
========================================
  Files          963      963           
  Lines        21812    21812           
  Branches      6068     6089   +21     
========================================
  Hits          8165     8165           
  Misses       12351    12351           
  Partials      1296     1296
Impacted Files Coverage Δ
gsa/src/web/components/loading/loading.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8fde898...8c249d7. Read the comment docs.

@bjoernricks bjoernricks merged commit 455142a into greenbone:gsa-8.0 Jul 17, 2019
@bjoernricks bjoernricks deleted the systemd-files branch July 17, 2019 13:12
@bjoernricks bjoernricks mentioned this pull request Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants