Saltstack Official PHP Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.4KB

  1. {% from "php/ng/map.jinja" import php with context %}
  2. include:
  3. - php.ng.deprecated
  4. - php.ng
  5. - php.ng.dev
  6. {% set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %}
  7. {% if salt['grains.get']('os') == "Ubuntu" %}
  8. {% if phpng_version >= '7.0' %}
  9. {% set suhosin_ext = php.lookup.pkgs.suhosin7_ext %}
  10. {% set suhosin_name = 'suhosin7' %}
  11. {% set suhosin_repo = php.lookup.pkgs.suhosin7_repo %}
  12. {% set tmppath = '/tmp/suhosin7' %}
  13. {% else %}
  14. {% set suhosin_ext = php.lookup.pkgs.suhosin5_ext %}
  15. {% set suhosin_name = 'suhosin' %}
  16. {% set suhosin_repo = php.lookup.pkgs.suhosin5_repo %}
  17. {% set tmppath = '/tmp/suhosin5' %}
  18. {% endif %}
  19. {% elif salt['grains.get']('os_family') == "RedHat" %}
  20. {% if grains['osmajorrelease'] == "7" %}
  21. {% set suhosin_ext = php.lookup.pkgs.suhosin5_ext %}
  22. {% set suhosin_name = 'suhosin' %}
  23. {% set suhosin_repo = php.lookup.pkgs.suhosin5_repo %}
  24. {% set tmppath = '/tmp/suhosin5' %}
  25. {% else %}
  26. {# RHEL version 6 contains PHP 5.3, which is not supported by Suhosin #}
  27. {% endif %}
  28. {% else %}
  29. {% set suhosin_ext = php.lookup.pkgs.suhosin5_ext %}
  30. {% set suhosin_name = 'suhosin' %}
  31. {% set suhosin_repo = php.lookup.pkgs.suhosin5_repo %}
  32. {% set tmppath = '/tmp/suhosin5' %}
  33. {% endif %}
  34. build-pkgs:
  35. pkg.installed:
  36. - pkgs: {{ php.lookup.pkgs.build_pkgs }}
  37. git:
  38. pkg.installed: []
  39. suhosin-source:
  40. git.latest:
  41. - name: {{ suhosin_repo }}
  42. - target: {{ tmppath }}
  43. - unless:
  44. - test -d {{ tmppath }}
  45. - require:
  46. - pkg: git
  47. install-suhosin:
  48. cmd.run:
  49. - name: |
  50. phpize
  51. ./configure
  52. make
  53. make install
  54. - cwd: {{ tmppath }}
  55. - shell: /bin/bash
  56. - runas: root
  57. - unless:
  58. - test -e {{ php.lookup.pkgs.ext_conf_path }}/{{ suhosin_name }}.ini
  59. - require:
  60. - pkg: build-pkgs
  61. - git: suhosin-source
  62. php-suhosin-conf:
  63. file.managed:
  64. - name: {{ php.lookup.pkgs.ext_conf_path }}/{{ suhosin_name }}.ini
  65. - contents: |
  66. extension={{ suhosin_ext }}
  67. suhosin.executor.include.whitelist=phar
  68. - require:
  69. - pkg: php
  70. - cmd: install-suhosin
  71. - unless:
  72. - test -e {{ php.lookup.pkgs.ext_conf_path }}/{{ suhosin_name }}.ini
  73. {% if salt['grains.get']('os_family') == "Debian" %}
  74. php-suhosin-enable:
  75. cmd.run:
  76. - name: {{ php.lookup.pkgs.phpenmod_command }} {{ suhosin_name }}
  77. - require:
  78. - file: php-suhosin-conf
  79. {% endif %}