-
Notifications
You must be signed in to change notification settings - Fork 9
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
added a dynamic file provider and config options (traefik_qs_exposedbydefault, traefik_qs_tls_options, traefik_qs_middlewares) #5
base: develop
Are you sure you want to change the base?
Conversation
… services that don't have a traefik.enable=true label will be ignored from the resulting routing configuration. - added config option `traefik_qs_tls_options`: If set to true, three different setups for tls options (modern, intermediate, old) are created according to https://ssl-config.mozilla.org/#server=traefik. - added config option `traefik_qs_middlewares`: If set to true, setup default middleware config for hsts-header, xssfilter-header - added a dynamic file provider: A dynamic file provider is setup by default. It watches the directory `dynamic_conf` which is placed in the data directory for traefik (controlled by the variable `traefik_dir`). You can simply add your own config here. By setting `traefik_qs_tls_options` and/or `traefik_qs_middlewares` to true config files are autogenerated `qs_traefik_tls_options.yml` and/or `qs_traefik_middlewares.yml`.
Can you give an advice why the travis checks are failing? Everything is working on my side. |
What are the next steps to get this pull request included on your side? |
Hi, sry for my late comment, this somehow went under my radar. I will have a look at this and give feedback asap |
- added ipv6 switch
No problem. In the mean time also added support for ipv6. |
tasks/1_setup.yml
Outdated
- name: 'setup : dynamic file config' | ||
become: true | ||
copy: | ||
dest: '{{ traefik_dir }}/traefik_dynamic_file_config.yml' |
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.
should this be in the dynamic_conf directory?
Phew, I finally came around having a good look at it. First off, thanks for the work and the PR 🥳 ! Second, the molecule tests seem to be failing because of a missing dependency, I have updated this in another PR (#6) which you can sync once its merged into And lastly, about the PR itself: 1. Dynamic file provider is somewhat redundant when opt-out and 2. TLS and middleware options should use the static config ansible.traefik/tasks/0_config.yml Lines 3 to 15 in 63ffcbd
This has the main benefit, that the config can be overwritten by a hoastvar if needed, and there is no cleanup of a stale file to be done if the _qs_ option is set to false again.
So to summarize what I think is necessary for merging: Again, thanks for the PR and effort! |
Hi, thanks for your comments. I think you are right with your remarks and i will rework the PR to use the static config in favour of the dynamic config. |
I tried to adapt my setup but i get problems using the defined tls and middleware setups from the static config. Till now i am assigning them using |
Accoding to https://doc.traefik.io/traefik/getting-started/configuration-overview/#the-dynamic-configuration
|
I just stated the dashboard and all tls and middleware configurations from the static config are not shown. Thus i cannot reference them. |
…nfkey_tls - removed unused dynamic fileconfig file (a directory is used)
Just had a look at the Traefik docs to make sure I am (still) understanding everything correctly. According to the docs, middlewares defined in the static entrypoint definition are applied to each router associated with the entrypoint. Have you tried to do something like this: # in config/main.yml
traefik_int_conf_http_middlewares:
https:
http:
middlewares:
hsts-header:
headers:
STSSeconds: 63072000
xssfilter-header:
headers:
browserXssFilter: true and then merge: # tasks/0_config.yml
- name: "config : generate https xss & hsts"
set_fact:
traefik_int_conf_entryPoints: "{{ traefik_int_conf_entryPoints |
combine(traefik_int_conf_http_middlewares, recursive=True) }}"
when: traefik_qs_https and traefik_qs_middlewares If you want to add them to the |
With dynamic file config i had the middlewares defined independend from the entrypoint. I then used docker lables to assign them to the required router. So i propose to stay with defining a dynamic file config per default and using it for such middleware configuration. |
So what you are proposing would be to remove the quick-setup for tls, hsts and xss and just go with a dynamic config option, handing configuration over to the user? I'd be on board with that, as it removes the necessity to maintain a good tls config in this role. Concerning the "making traefik more error prone" part, I think I might not have stated my intentions clear enough. Adding more dynamic providers would not make traefik more error prone, as it is very mutch designed to be used with multiple dynamic config sources. What I was referring to was, that adding a dynamic file provider which is then used by the role as a default way of configuring traefik might introduce maintenance problems later down the line when updating the role or changing config around. Something like this would require much more effort (e.g. tracking and removing config files) to keep the role idempotent and remove any stale config. This is why I very much agree with the point you make:
With that in mind, I would argue that the configuration of hsts, xss and tls is very much in the responsibility of the role user. The responsibility of this role is to give its users the ability to implement these things according to their needs. This would mean, that the role should provide:
This should suffice to achieve any specific middleware config by either rendering it on-the-fly on the server or by using a simple Again to be clear: I do like the Idea of adding dynamic file config, I just need to make sure that the role can be updated cleanly and doues not introduce problems in the future. |
I think your summary:
is correct.
|
Agreed, that would be beneficial, too. So it would then be:
Does that sound ok and doable? |
Yes, thats sounds good. I will report back as soon as i am ready :-). |
…mic_file_config - introduced switch traefik_use_dynamic_file_config to use dynamic file configuration provider - added example playbook to setup traefik - added variable to configure directory to use with dynamic file provider
Sorry for the delay. I have just commited the discussed changes. Looking forward for your review. |
traefik_qs_exposedbydefault
: If set to false,services that don't have a traefik.enable=true label will be ignored from the resulting routing configuration.traefik_qs_tls_options
: If set to true, three different setups for tls options (modern, intermediate, old) are created according to https://ssl-config.mozilla.org/#server=traefik.traefik_qs_middlewares
: If set to true, setup default middleware config for hsts-header, xssfilter-headerA dynamic file provider is setup by default. It watches the directory
dynamic_conf
which is placed in the data directory for traefik (controlled by the variabletraefik_dir
). You can simply add your own config here. By settingtraefik_qs_tls_options
and/ortraefik_qs_middlewares
to true config files are autogeneratedqs_traefik_tls_options.yml
and/orqs_traefik_middlewares.yml
.