Commit Graph

170 Commits

Author SHA1 Message Date
Dennis Camera d693bf5f90 Move auth_conf explorer from __dma_auth to __dma 2020-09-28 16:34:12 +02:00
Dennis Camera 445bc75deb [type/__dma_auth] Drop --server parameter
Currently, dma does not differentiate between login users on the SMTP server.
It will pick whatever entry it finds first
(https://github.com/corecode/dma/blob/v0.13/net.c#L531).
As a result, the --server parameter only adds confusion.
2020-09-28 15:35:58 +02:00
matze e800f42a6d __netbox: consistency with __systemd_unit --restart
This commit brings consistency into the --restart parameter for systemd
units. All units except the netbox wrapper service will be restarted on
unit change.
2020-09-09 20:33:20 +02:00
matze dd167f075d __netbox*: fix service restart order
Cause of corrupt databases if the services are restarted incorrectly,
the order and dependencies are adjusted. Now, the `netbox-rq` service
will be included in restarts of `netbox` and required for the WSGI
servers that it must running.

For these changes, the restart command of `__netbox` was adjusted. The
other ones where edited too, to use the same command.

All services now require redis and postgresql to be started before them
to prevent any start order issues.

If someone asked for what the RQ worker is required, see here:
 https://netbox.readthedocs.io/en/stable/additional-features/webhooks/#webhook-processing
2020-09-09 19:08:46 +02:00
matze 5d437839f6 __netbox: replaced secret key character set
The used character set should now only contain characters used by the
`netbox/generate_secret_key.py` program. Finially got correct escaping.
2020-09-08 19:52:03 +02:00
matze 549feb87f9 __netbox: fix --update-notify
Template script for the `configuration.py` interpreted the boolean flag
incorrectly and did the thing the user do not wanted.
2020-09-08 19:20:22 +02:00
matze 398a3da10e __netbox: fix gerneration random generated secret key
Because `/dev/random` was used, the `cdist config` could hang a long
time to get real random values. The pseudo-generated values through
`/dev/urandom` are fully enought for the secret key.
2020-09-08 18:10:15 +02:00
matze 3389752dec __netbox: fix detection of the secret-key to use
Mixed up a parameter. Should be correct now.
2020-09-07 17:23:22 +02:00
matze eed3515424 __netbox: add --ldap-staff-group parameter
Required to get "admin access".
2020-09-07 17:10:59 +02:00
matze 0afc7136f8 __netbox_uwsgi: fix if only --bind-to given
If the here-document is empty because no file could be found, an empty
line will be read. The new line of code will skip in those cases.
2020-09-06 18:39:07 +02:00
matze c9e4e8d7dc __netbox_{gunicorn,uwsgi}: add state parameter
Adds the --state parameter to both types. With it, the transition
between both types can be done smothly.
2020-09-06 13:44:03 +02:00
matze 3b07a660b3 __netbox_uwsgi: add hint to the --serve-static parameter 2020-09-05 22:55:43 +02:00
matze b10f6b71d0 __netbox: avoid useless generated code-remote
Because `set -e` got printed all the time, the type __netbox always had
some generated code for the remote side. This line was removed because
this is already done by cdist when executing the code-remote script.

Rather, the exit-on-error option was set to some scirpts (two ..).
2020-09-05 22:34:14 +02:00
matze 9d330a91bc __netbox_{gunicorn,uwsgi}: add netbox ownership to config file 2020-09-05 22:27:42 +02:00
matze 090a8f015e __netbox_uwsgi: fix uwsgi netbox service file
Revert working directory changes as the configuration file still needs
to be accessable. An absolute path would work, too, but it is not the
preferred way.

To still work with the python wsgi application, `--chdir` is used.
2020-09-05 22:08:37 +02:00
matze ffba3ae776 __netbox_uwsgi: add --serve-static parameter
New option to directly serve static content via uWSGI.
2020-09-05 22:01:15 +02:00
matze 5a403de057 __netbox_uwsgi: fix shellcheck
Fixed shellcheck cause of the find command. This required a bigger
change due to variables and subshell. Now, input is used through a
here-document.
2020-09-05 19:09:34 +02:00
matze 755bd9098e __netbox*: update systemd service files
The `uwsgi-netbox` service now works, also the `netbox` wrapper service.
The PID file was removed from the Gunicorn service as it is not required
and a bit more efford to move it to `/run/` due to permissions.

Generally, all depend on `network.target` instead of
`network-online.target` now, and signals for reload, stop and kill were
added (especially required the uwsgi service).
2020-09-05 15:18:49 +02:00
matze 314a0d4d8e __netbox: kill all running venv processes
To avoid aborts because of the python venv could not be updated by
killing all processes that uses the venv.

It will be done all times to prevent any error, because it could not be
reliably detected if the type installs or updates NetBox.
2020-09-05 13:53:05 +02:00
matze af91b6e3a1 __netbox_uwsgi: mark as singleton
This should have been done much earlier .. :/
2020-09-05 11:26:15 +02:00
matze 243e34f0a5 __netbox_uwsgi: enable further protocols to bind to
Enables multiple protocols like fastcgi or HTTP to bind to. This makes
it more flexible to use.

Also, a little fix for __netbox was done: correctly output a error msg.
2020-09-05 11:20:20 +02:00
matze 2805b6beff __netbox{,_gunicorn}: fix shellcheck directives 2020-09-02 09:15:45 +02:00
matze dbc91cb339 __netbox*: updated man pages 2020-09-02 07:50:12 +02:00
matze facb5a64d3 __netbox{,_gunicorn}: disabled shellcheck warnings
Shellcheck warned about creating content for a python array. As the
string will be printed literally into the config, the warning does not
match to the current case.
2020-09-01 13:20:31 +02:00
matze 9d8b3ebe74 __netbox: add wrapper service to manage the wsgi services
The wrapper service will "control" the services added from the
__netbox_* types to provide a general interface. This is more dynamic
than the alias approach used previously. Through this, it is possible
to handle multiple wsgi services for netbox - if this works ..

See as a reference:
  http://alesnosek.com/blog/2016/12/04/controlling-a-multi-service-application-with-systemd/
2020-09-01 10:02:08 +02:00
matze 1ef4420c53 __netbox_uwsgi: new type to handle uwsgi for netbox 2020-08-27 19:46:09 +02:00
matze bbce0030ab __netbox: enable ldap usage via configuration.py
The REMOTE_AUTH_BACKEND must be set to use LDAP.

It now exports USE_LDAP to generally say if LDAP is being used in the
configuration or not.
2020-08-26 21:07:31 +02:00
matze e0a1b4f663 __netbox_gunicorn: extract gunicorn setup from __netbox
Because someone *want* to use something other than just gunicorn, it was
extracted to a own type. Because gunicorn is a bit deep in the netbox
installation process, it's a bit harder to isolate it.

`__netbox_uwsgi` will come, too.
2020-08-26 20:08:37 +02:00
Dennis Camera 49d39eaee5 [type/__mail_alias] Fix error with some AWK implementations
Some AWK implementations seem to have a problem with parameters named default.

    awk: cmd. line:2: function sepafter(f, default,    _) {
    awk: cmd. line:2:                      ^ syntax error
    awk: cmd. line:5: 	return _ ? _ : default
    awk: cmd. line:5: 	               ^ syntax error

In addition the temp file is removed if an error occurs.
2020-08-26 18:56:02 +02:00
matze eaf639790b __netbox: remove ldap pip3 package if not required 2020-08-26 17:39:19 +02:00
matze 8ff7a4616d __netbox: allow multiple hostnames 2020-08-25 19:30:32 +02:00
matze 7d694342ff __netbox: new parameter for automatic release checks 2020-08-24 19:31:49 +02:00
matze 95fd7d872e __netbox: fix ldap config short-circuit
Forgot to negotate if statement .. works now :/
2020-08-24 18:57:27 +02:00
matze 863c95059e __netbox: fix REMOTE_AUTH_BACKEND module not found
Updated with the backend from the current upstream configuration.
2020-08-23 19:48:56 +02:00
matze 4e90c93eef __netbox: updated copyright
Added me to the copyright after there are some more changes :-)
2020-08-23 17:15:32 +02:00
matze 49bb527dea __netbox: autogen secretkey and store at remote
The secret key is generated if it is not set via parameter and the
explorer does not return any. It will be saved in the netbox home
directory to easily read the key for the config generation.
2020-08-23 16:52:02 +02:00
matze f5c8c26db6 __netbox: new config parameters for data paths
.. to move them to an other partition.
2020-08-23 16:41:58 +02:00
matze 88ddebd040 __netbox: fix deprecated configuration option
Fixes error message `/opt/netbox/netbox/netbox/settings.py:141:
UserWarning: REMOTE_AUTH_DEFAULT_PERMISSIONS should be a dictionary.
Backward compatibility will be removed in v2.10.`
2020-08-22 22:47:15 +02:00
matze 584e0bbda8 __netbox: fix netbox version save
The cdist directory needs to be created to write there. This is done
directly after the new tarball is installed.
2020-08-22 22:24:17 +02:00
matze 0b261070d3 __netbox: man note regards creating a superuser 2020-08-22 22:04:33 +02:00
matze 4a04a2c472 __netbox: repalace tabs with whitespaces
Doing `s/\t/    /g` to have all times the same indents.
2020-08-22 21:58:44 +02:00
matze ce47cec2e7 __netbox: silence curl progress bar
.. but still showing errors if any.
2020-08-22 21:50:54 +02:00
matze ae7ffac6bb __netbox: force virtualenv to be python3
Set a flag to be sure it is python3. Else, you may get an ugly error if
python2 is not installed (and netbox requires python3.6 at minimum).
2020-08-22 21:29:30 +02:00
matze ee3db10ecf __netbox: auto-install sudo as dependency
There are may be systems does not have `sudo` preinstalled like
debian-minimal. Else, `su` could be used as alternative.
2020-08-22 20:55:35 +02:00
matze 9fb3c7f52e __netbox: fix manpage indents 2020-08-22 16:00:15 +02:00
matze 987393942b __netbox: add more database parameters 2020-08-22 15:53:24 +02:00
matze ce77cc4527 __netbox: note + link to find NetBox versions 2020-08-22 14:40:07 +02:00
matze 855843ea34 __netbox: small code and config handling improvements
fixed codestyle and detection if config files need to be copied.
2020-08-22 09:19:12 +02:00
matze e6e6dbcd00 __netbox: added some netbox configuration options
Those who might be useful are added ..
2020-08-21 23:50:24 +02:00
matze a05cb214e1 __netbox: fix shellcheck by changing parameter checks
The working `ls | grep .` like solution was dropped based on the
shellcheck warning. Rather a solution with `find(1)` is used.

As alternative, it could be simply checked if the glob succeeds or not
by test all given arguments if there are existing files. It was dropped
in question if it's really better than the `find(1)` solution.
2020-08-20 19:37:09 +02:00
matze 0281b2c804 __netbox: no ldap config if no ldap parameters
The ldap config file will be empty (only comments) if no parameter
name set matches `^ldap-*`.

It still generate a ldap config if one or more ldap parameters are set,
but not all basic parameters.
2020-08-20 17:53:25 +02:00
matze e47cead637 __netbox: add manpage explanation of the type 2020-08-16 15:31:38 +02:00
matze efab6ac23e __netbox: add version memorisation
This saves the installed version and checks if a new version must be
installed. If no update required, it updates the configuration files
if required.
2020-08-16 15:18:47 +02:00
fnux dfd9f108b1 __netbox: add minimal manpage 2020-08-12 09:15:18 +02:00
fnux 240b8f1615 __netbox: make shellcheck happy 2020-08-12 09:01:05 +02:00
fnux 47584d6da6 __netbox: use __systemd_unit, do not recreate existing directory 2020-08-12 08:58:29 +02:00
sparrowhawk bf5f85068d
Add a type to create a borg repository. 2020-08-07 10:39:38 +02:00
fnux 521433f875 Merge branch '__matrix_riot' into 'master'
__matrix_element

See merge request ungleich-public/cdist-contrib!10
2020-07-28 14:21:03 +02:00
fnux 7eecc99c73 __unbound: fix typo in gencode-remote / service start 2020-07-27 14:53:45 +02:00
fnux 5960356e7b __unbound: add --local_data flag 2020-07-27 14:37:22 +02:00
fnux e2f01bbb3b __matrix_riot: rename to __matrix_element 2020-07-22 17:14:06 +02:00
fnux ef7a214dae __netbox: support basic LDAP group mapping 2020-07-21 08:30:09 +02:00
fnux ab2c826cc3 __netbox: add minimal LDAP support 2020-07-21 07:46:45 +02:00
fnux 70047d10b1 Initial __netbox type 2020-07-20 17:20:33 +02:00
fnux c3a7e62953 Merge branch 'unbound-monitoring' into 'master'
__unbound_exporter: prometheus exporter for unbound

See merge request ungleich-public/cdist-contrib!8
2020-07-20 07:49:43 +02:00
fnux 3314612193 __matrix_riot: improve friendship with shellcheck 2020-07-11 09:21:37 +02:00
fnux 10ccc77803 Merge branch '__matterbridge' into 'master'
__matterbridge type

See merge request ungleich-public/cdist-contrib!3
2020-07-11 08:53:54 +02:00
Dennis Camera 43c59985d0 [type/__mail_alias] Fallback to /etc/aliases instead of /etc/mail/aliases 2020-06-25 18:07:51 +02:00
fnux f6a36a60c0 Import __matrix_riot from ungleich's dot-cdist 2020-06-25 11:15:23 +02:00
Dennis Camera aa605cada4 [type/__mail_aliases] Add support for Alpine Linux
Alpine's DMA package has a typo and installs "newailases" instead of
"newaliases".
I adjusted the code-remote to only run newaliases if it is available.
Otherwise, tough luck, user gotta either fix his system or run manually.
2020-06-22 14:03:53 +02:00
Dennis Camera 27b832f212 [type/__dma] Add support for Alpine Linux
requires the testing repository, currently.
2020-06-22 14:02:13 +02:00
Dennis Camera 0f81b89f70 [type/__dma] Make --smarthost optional 2020-06-22 13:29:28 +02:00
Dennis Camera c777a2b1c2 [type/__mail_alias] Some fixes in continuation line processing 2020-06-11 21:58:58 +02:00
Dennis Camera 27102340de [type/__mail_alias] Add bug notice about commas 2020-06-11 20:54:31 +02:00
Dennis Camera b293c42b5a [type/__dma] Use EQS to split config lines 2020-06-11 19:12:52 +02:00
Dennis Camera 5513485097 [type/__dma] Improve documentation 2020-06-11 19:12:52 +02:00
Dennis Camera 193b1780de Improve error message when invalid --state is used. 2020-06-11 19:12:52 +02:00
Dennis Camera 5b8ae33b4e [type/__dma_auth] Improve documentation and handle duplicate lines better
The state explorer gained a new value "multiple" (it is not used anywhere, just
informative).
The code will only write a "should" line once and drop duplicate lines.
2020-06-11 19:12:52 +02:00
Dennis Camera ca9e011d50 [type/__dma_auth] Fix off-by-one error 2020-06-11 19:03:41 +02:00
Dennis Camera 96fcccf529 [type/__mail_alias] Improve documentation 2020-06-09 21:57:47 +02:00
Dennis Camera 67b989a717 [type/__dma_auth] Simplify code and add more comments 2020-06-09 20:53:01 +02:00
Dennis Camera 45b10f3e09 [type/__dma] Update parameters to match config names in DMA 2020-06-09 14:51:11 +02:00
Dennis Camera 0cd19b3a5d [type/__dma] Use "smarthost" spelling to be consistent with DMA 2020-06-09 14:44:54 +02:00
fnux 4ff703e6aa Fine tuning prometheus exporter for unbound 2020-06-07 10:34:35 +02:00
fnux bffc38ad52 __unbound_exporter: make shellcheck happy again 2020-06-07 08:58:14 +02:00
fnux 1e45d85d4d Add new __unbound_exporter type 2020-06-07 08:53:56 +02:00
fnux 7b9ffb4a41 __unbound: wire remote control configuration 2020-06-07 08:46:18 +02:00
Dennis Camera de4508cb06 Mark __dma_auth and __mail_alias as nonparallel
Both types modify a single file, so they shouldn't be run at the same time.
2020-06-06 21:45:40 +02:00
fnux 3d3a3ef802 Fix shellcheck warnings in newly imported __unbound type 2020-06-03 15:08:04 +02:00
fnux 6b38b248e2 Rename __ungleich_unbound into __unbound 2020-06-03 14:59:42 +02:00
fnux 3adb5ac4ca Import __ungleich_unbound type for ungleich's dot-cdist 2020-06-03 14:58:43 +02:00
Dennis Camera bf822f3f8c [type/__dma] Fix SC2154 2020-06-01 20:26:52 +02:00
Dennis Camera 77e8a93daa [type/__dma_auth] Fix SC2162 2020-06-01 20:25:10 +02:00
Dennis Camera 7183bb3cd1 [type/__dma] Fixes for FreeBSD 2020-06-01 19:24:45 +02:00
Dennis Camera 0657ac4f11 [type/__dma] Fix mailname 2020-06-01 19:21:41 +02:00
Dennis Camera 99d58672c4 [type/__dma_auth] Add semicolon 2020-06-01 19:20:05 +02:00
Dennis Camera 4fdddfd738 [type/__dma] Add --defer, --full-bounce, and --null-client 2020-06-01 17:23:31 +02:00
Dennis Camera c8efbf4825 [type/__dma] Detect AUTHPATH 2020-06-01 17:16:04 +02:00
Dennis Camera 4dfa24723a [type/__dma] Implement config file updates 2020-06-01 17:09:47 +02:00
Dennis Camera b87b67597e [type/__dma] Remove mail aliases functionality 2020-05-31 15:26:52 +02:00