Commit Graph

569 Commits

Author SHA1 Message Date
Michael Friedrich 37b715baf1 Replace a few more copyright strings 2019-02-25 16:30:40 +01:00
Michael Friedrich 458f997a18 Replace Copyright header with a short version, part II 2019-02-25 15:09:36 +01:00
Michael Friedrich d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich b81f7a7415
Merge pull request #6577 from Icinga/fix/setup-api-including-users-file
Include api user configuration file during api setup
2019-02-11 16:41:46 +01:00
Michael Friedrich 4c1a54073c
Merge pull request #6748 from Icinga/bugfix/api-setup-fails-missing-confd
Fix api setup to automatically create the conf.d directory
2019-02-11 16:35:57 +01:00
Michael Insel 1352b15220 Fix string comparison on edge cases
This fixes a few edge cases where the string comparison failed before.
2018-12-05 20:12:06 +01:00
Michael Friedrich f3cd3eb870 DSL: Implement getenv()
This patch also restores Utility::GetFromEnvironment()
and replaces the hardcoded `getenv()` calls.
2018-11-19 18:11:16 +01:00
Michael Insel b785674ab2 Fix api setup to automatically create the conf.d directory
This patch creates the conf.d directory automatically when it is not present during api setup.
2018-11-01 19:16:26 +01:00
Michael Friedrich dea5ec614e icinga.com: Update CMakeLists.txt 2018-10-18 09:35:18 +02:00
Michael Friedrich dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Alexander A. Klimov 6d114b16e4 node setup: always respect --accept-config and --accept-commands 2018-10-01 16:33:50 +02:00
Michael Friedrich c8d4e785a1
Merge pull request #6519 from Icinga/fix/erroneous-console-exit
Reset terminal on erroneous console exit
2018-09-13 13:34:58 +02:00
Michael Insel cc417ca176 Fix CI builds 2018-09-04 18:56:54 +02:00
Michael Insel 46163700b4 Include api user configuration file during api setup
refs #6557
2018-09-04 18:38:38 +02:00
Michael Friedrich 1c2a59bf63
Merge pull request #6591 from Icinga/bugfix/lto-builds-static-initialize-namespaces
Fix static initializer priority for namespaces in LTO builds
2018-09-04 16:54:30 +02:00
Michael Friedrich 19993df380 Fix static initializer priority for namespaces in LTO builds
fixes #6575
2018-09-04 16:36:22 +02:00
Alan Jenkins a21166dcf8 Fix logging under systemd
icinga2.service used `-e ${ICINGA2_ERROR_LOG}`, but this is documented
as having no effect without `-d`.  Furthermore, icinga2 under systemd
unconditionally logged everything to the system log (but without setting
the log level etc), which contradicted the documentation.  (Issue #6339)

Stop icinga2 on systemd from logging to stdout - and hence the system log -
once it has finished starting up.  Just like when you start icinga2 from a
terminal using `-d`.  And just like -d, we stop logging fatal errors to
stderr, and instead write to the log file passed with `-e`.

As per docs, mainlog (icinga2.log) is already enabled by default.  And
pre-startup messages including config errors will still appear in the
system log.

This uses a new option --close-stdio, which has the same effect on logging as
--daemonize, but does not fork or call setsid().

For this purpose, I moved setsid() up and into Daemonize().

Consequence of that last point: if anyone is weird enough to specify a TTY
device file as the fatal error log (-e option), that will become icinga's
controlling terminal, which you generally don't want as a daemon.  This
makes it consistent with the existing behaviour for icinga mainlog.  For
this reason you're supposed to use O_NOCTTY in Linux daemons.  But I wasn't
sure where icinga would want to put the ugly `#ifdef _WIN32 ... #else ...`.
2018-08-25 10:21:06 +01:00
Alan Jenkins 50463a6a10 Daemonize(): use one error convention, not three
Standardize on exit() / _exit() (this depends whether we are considered
to be the "main" fork, which should run anything registered with atexit()).
Exclude `return false` and throwing exceptions.

This fixes the error path for fork().  Daemonize() would return false, but
the `return false` error convention was not tested in the caller.

It also fixes the error message for fork() to show the error code.
Everyone loves `strace`, but sysadmins should not have to rerun their
daemons under it just to see an error code.

Also in case an exception is thrown, show its diagnostic information
instead of dropping it on the floor.  In the log message, I mention why we
are uninitializing and then initializing the app at this point.

For the reader, it pushes all the weirdness into the error convention of
Daemonize().  This comes back to the exit() / _exit() distinction.  Once
we have forked, we technically don't want to allow the parent process to
exit(), so we don't want to return to the caller.
2018-08-25 10:07:02 +01:00
Gunnar Beutner e678fa1aa5 Refactor Application::*Const() 2018-08-13 15:27:05 +02:00
Gunnar Beutner 10d6f70a85 Move constants and functions into different namespaces 2018-08-13 13:44:31 +02:00
Michael Friedrich 9be3ee1a1a Update output for `--version`
This moves the system and build information before
the application paths which are normally not that important.
2018-08-07 18:46:18 +02:00
Michael Friedrich a2a1f5c8d2 Take a note why the explicit configDir variable is needed on Windows 2018-08-07 18:33:59 +02:00
Markus Frosch 9fbc40615a Improve path handling in cmake and daemon 2018-08-07 14:10:26 +02:00
Michael Insel eea42c6807 Fix windows build 2018-08-05 20:17:43 +02:00
Michael Insel 51b900b307 Reset terminal on erroneous console exit
This ensures that the terminal is resetted on an erroneous exit when using the Icinga 2 console.

refs #6382
2018-08-05 16:30:36 +02:00
Markus Frosch ddc5b951b3
Revert "Implement support for the --env command-line argument" 2018-07-26 17:09:06 +02:00
Michael Friedrich 46e71a83dc
Merge pull request #6414 from Icinga/feature/icinga-envs
Implement support for the --env command-line argument
2018-07-26 10:09:42 +02:00
Michael Friedrich 89d42fee72
Merge pull request #6440 from Icinga/bugfix/typo
Fix typo
2018-07-26 09:59:20 +02:00
Bas Couwenberg 0891380789 Fix spelling errors.
* occured -> occurred
 * dosen't -> doesn't
2018-07-21 10:38:09 +02:00
Michael Friedrich 7519d23892 Add debug logging for daemonize/timers
The previous commit is 1:1 the same I've implemented
here already. Great teamwork with Alex :)

refs #6445
2018-07-19 13:34:12 +02:00
Alexander A. Klimov 030afee8b0 Fix typo 2018-07-17 14:23:20 +02:00
Gunnar Beutner c577554073 Implement support for the --env command-line argument 2018-06-27 13:15:52 +02:00
Michael Friedrich 2fd6709952 Remove ApiUser password_hash functionality
This affects and fixes

- Windows reload
- Config validation
- RHEL 7.5 OpenSSL memory corruption
- Hash algorithm, requested changes

refs #6378
refs #6279
refs #6278
2018-06-19 11:32:03 +02:00
Michael Friedrich eb1f37905d
Merge pull request #6368 from Icinga/fix/program-options-parsing-6365
Fix program option parsing
2018-06-15 16:09:13 +02:00
Michael Insel e885cf71c6 Fix program option parsing
This fixes the program option parsing.
2018-06-12 19:02:48 +02:00
Jean Flach 9a5d464448 Revert "Fix Windows reload"
This reverts commit 691e3cfd57.
2018-06-12 12:19:16 +02:00
Michael Insel d868780e6d Fix unnecessary blank in log message
This fixes an unnecessary blank in the updating configuraiton log message.

information/cli: Updating ' "conf.d"' include in '/etc/icinga2/icinga2.conf'.

Should be:

information/cli: Updating '"conf.d"' include in '/etc/icinga2/icinga2.conf'.
2018-05-24 19:35:52 +02:00
Michael Friedrich f0f0b47057 Fix style and logging from review; enhance output
refs #4508
2018-05-08 16:59:09 +02:00
Jean Flach b8fc3a3ffa Small changes to node wizard/command
refs #4508
2018-05-08 16:33:06 +02:00
Michael Insel 662d36fd16 Warn in case of failed conf.d exclusion also on master setup
refs #4508
2018-05-08 16:33:04 +02:00
Jean Flach 026359d404 Rename "dont-disable-confd"
Double negation is confusing. Also this would change the default
behaviour and could lead to problems in automated environments.

refs #4508
2018-05-08 16:32:56 +02:00
Jean Flach a43cf8e9ef Warn in case of failed conf.d exclusion
refs #4508
2018-05-08 16:32:53 +02:00
Michael Insel 58f923f5f7 Allow to disable conf.d inclusion through node wizard/setup
This implements a function to disable the conf.d directory through the node wizard/setup.

refs #4508
2018-05-08 16:31:59 +02:00
Michael Friedrich e606a443b7 Add support for config validation log timestamps
This also adds implicit support for the startup.log
generated from API config package validation, e.g. used by
the Icinga Director.

fixes #3455
2018-05-03 11:35:29 +02:00
Michael Friedrich 7c0ef80279 Implement support for connection-less node setup (no csr auto-signing connect) 2018-04-06 19:49:01 +02:00
Michael Friedrich 9f2694bdc1 Unify setting the local and parent zone names for node wizard/setup 2018-04-06 19:18:19 +02:00
Michael Friedrich abdc479d6a Unify setting the master zone name for 'node wizard|setup` in master mode 2018-04-06 17:29:37 +02:00
Jean Flach a742e64e4d Fix reload handling
Make sure we have written the new PID before letting it take over.
2018-03-14 10:43:59 +01:00
Michael Insel 592d1c7d7e Replace std::vector:push_back with initializer list
This replaces a few std::vector::push_back calls with initializer lists.
2018-03-12 20:35:49 +01:00
Gunnar Beutner a9fb714578
Merge pull request #6116 from Icinga/fix/windows-service-restart
Fix Windows reload
2018-02-28 12:23:53 +01:00