-
Notifications
You must be signed in to change notification settings - Fork 283
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
Feature (rhel7/httpd 2.4) : hardening apache and code refactoring #251
Feature (rhel7/httpd 2.4) : hardening apache and code refactoring #251
Conversation
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.
there are hard returns in modules-ng.sls I don't think you want those...
yes, you are right. Thanks ! |
@k-hamza I greatly appreciate your effort! Your code even solves some problems I came across. Thank you! @aboe76 @whiteinge @javierbertoli @landergate We already discussed this in saltstack-formulas/postfix-formula#83. (@ixs) I suggest we start versioning this formula. (https://semver.org) Let's add a tag (i.e. 0.1.0) to mark the state before this PR and after that (depending on possible breaking of Pillar data) set 0.2.0 or 1.0.0. The only real disadvantage I can think of is having to write a migration guide from one version to the other. If we really have to use the "ng" pattern, we should put everything into its very own namespace (read: directory) as the php-formula does. In the hopes of providing constructive criticism, @aboe76 @k-hamza |
@alxwr I know about the issue, with "ng" formula's and I would like to split those too. I don't think that semver and git branches are the solution, those are to "developer"-minded solutions and are hard for simple sysadmins to grasp or even create PR against. I would like to suggest to create separate formula's:
Only downside to this is if somebody wants to use both formula's on one saltmaster... |
@alxwr, I completely dislike the ng solution mostly because, as you and @aboe76 mention, it follows a 'formula-in-formula' concept. But it has already crept into many formulas (from the top of my head, I rememeber it's present in apache, fail2ban, nginx, php...). It seems most of the times as the only solution to 'here's this big refactoring/update to the formula, it's a pain/impossible to make it backward compatible and there's no other proposed method in the formulas ecosystem to introduce these changes nicely' 😞 At this point, separating the formulas can be a solution, but I think that, sooner or later, somebody will again submit a 'formula-in-formula' 'ng-ng' PR, like 'apache-ng/ng' 😄 In the past, when writing Puppet & Chef, the Semver + Release Tags/Branches worked nice for me, but I again agree with @aboe76, it's not the easiest thing to learn how to use and interact for simple sysadmins (it took me a while to do it right 😋) If we decide to do SemVer, we'll need to add proper documentation (perhaps in the template mentioning that:
etc, and try to enforce/maintain things that way whenever possible. When I moved to Salt, I tried to read about the proposed method to maintain formulas, and found that Salt has a Salt Package Manager, but sincerely, never used it nor know if it is widely used. My 2c. |
@aboe76 @javierbertoli I hear your concerns regarding sysadmins. Those are my concerns too. :-) I'm not in favor of creating a new repository for every refactoring, because it's not easier to maintain for anyone. I also was thinking about doing version control in sub directories like so: The Formula File docs suggest the version format Maybe we should give up on „be backwards compatible at any cost“.¹ a) Make it too hard to use. I get that keeping backwards compatibility tries to avoid a), but it drives the formulas to b). (And furthermore: ng/ng/ng/ goes against a) again.) Therefore, another proposal:
Don't take me wrong. I'm not here to enforce my point of view. I'm just committed to keep usability high and maintenance cost low, because I want the formulas to succeed. In the end, I'll go with the developers' consensus. :-) ¹ Why do I have a strong opinion on this?
|
My 2cents as I got pinged. ;-) It's good to see everybody agree that ng sucks and should not be used.
But even in-repo -ng is terrible. I stumbled over the ng version of fail2ban the other day and while that version resolves a few bugs of the non-ng version, it was also not functional. Needed one or two patches first. At the end of the day, I think semver and controlled breakage is the sensible option. |
Ok, let's ask saltstack Organisation to make it clear what they have in mind with the formula's, And I too want the saltstack-formulas be as successful as it can be, because, one, I don't want a mess of multiple roles like @saltstack-formulas/core and @saltstack-formulas/moderators can we have some input on this so we can align all our efforts? |
In case there no vhosts defined in pillar httpd will listen on port 80. Without this default it will not start
A valid question that relates to this discussion |
@javierbertoli yes it is, I was hoping to get the saltstack core team involved to maybe write something in saltstack docs on formulas and git tags...and how to use them, that way we can start teaching people on how to use them by letting them read the official saltstack docs. |
I must say that I agree with you on "ng" pattern ... it is an "anti-pattern" of git usage In the saltstack documentation I found this about formula versionning.
It seems that it is the "official answer" to the question, and it is mostly the same as the proposals above. What do you think about it ? |
I'm think if there is any way to keep one-on-one relation between formula and implementation then we should aim for that. When rewriting the mongdb-formula recently I had this exact dilemma - how to improve without losing backwards compatibility - I eventually found a way to support old and new in same implementation by having a twin-track map.jinja See section two for backwards-compat data structures: In this pattern the first section is the current-preferred-implementation and the second section is a reconstruction of the depreciated dicts to keep backwards compatibility. In this way there is no need for two separate formulas for one piece of software. I will admit writing the SECOND section in map.jinja is challenging but advantage is that its transparent to end users. I'd advocate for some kind of similar approach - let map.jinja do the heavy lifting. Cheers. |
@k-hamza nice finds, in the documentation, let's make it so, I think the majority is for semver and tagging, @alxwr, @noelmcloughlin and @javierbertoli let's educate people and refer to the template-formula. |
@k-hamza maybe we can try this after we set some tags: |
|
Hello team, hope you are doing well |
@k-hamza I'm trying hard to get some GitHub issues and PRs done. :-) |
@k-hamza I (rather hastily) tested this on Ubuntu 18.04 by including all ng-states and running them against @k-hamza @aboe76 @noelmcloughlin @javierbertoli we should now discuss a transition to @myii Is saltstack-formulas/template-formula#21 sufficient to serve as a checklist for this transition? |
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.
I'd approve if it wasn't for the ng-pattern. :-)
We'll work that out.
@alxwr saltstack-formulas/template-formula#21 is still a WIP and does need more discussion (no-one has commented there yet for adjustments!). But if it helps with this process, then please feel free to use it by all means. As a member, you are able to edit the comment, in order to copy the Markdown directly. That will ease pasting and modifying it for any other formula. |
Sorry, I was checking for the other labels and I ended up removing the label by mistake! Reinstated, so nothing to see here! |
minor note: |
@alxwr Your efforts are appreciated. See you next week! |
Nice PR @k-hamza I'm up to my neck in other formulae so cannot review. @alxwr Regarding the ng pattern I have good idea how to smoothly transition away.
Note: we need to update the map.jinja so it can handle both ng and non-ng pillar data - this is possible I have experimented with this idea in mongoDB.
WDYT? I hope focus can be on template-formulae before apache 2.0. There are some new concepts & ideas being discussed which I need to get up to speed with anyway. thanks. |
I agree not to merge it in master branch. |
@k-hamza Thanks for all of your hard work. There have been quite a few developments over the last week or two and we're trying to revamp the way SaltStack-Formulas does things. One of the discussion points has been the
A further issue is that we're working on how to integrate these formulas with SPM. That will also have an effect on the final decision. So the takeaway is to keep track of developments before investing a portion of time into a specific option. Best ways to do that:
|
@alxwr @k-hamza I prefer method 2 as well but I don't know what the repercussions are going to be. One further point: we're close to providing a solution for automatically updating the changelog,
So if that is accepted, this |
@alxwr nice thanks for that, @k-hamza shall I change the base branch of the PR to target this is possible with: https://github.blog/2016-08-15-change-the-base-branch-of-a-pull-request/ |
@k-hamza merged it, |
Thanks for the merge |
Context
The main goal of the changes is to be able to enforce values of directives for hardening purpose, based on CIS Benchmarks apache document
The structure of pillars is modified into lists / dictionnaries so the content can be "easily" parsed and modified
The result is a complete rewrite of config and vhosts states
All changes are backward compatible, they are all new files added (with -ng suffix)
Summary of Changes
apache_directives.py
module to manage both content of server config and vhosts contentvhostdir
variable to/etc/httpd/conf.d
because of/etc/httpd/vhosts.d
doesn't belong to the httpd-2.4 rhel7 rpmTesting