<commit_before>
# Knox Install

    module.exports = header: 'Knox Install', handler: ->
      {knox, realm} = @config.ryba
      {java_home, jre_home} = @config.java
      krb5 = @config.krb5.etc_krb5_conf.realms[realm]

## Register

      @registry.register 'hconfigure', 'ryba/lib/hconfigure'
      @registry.register 'hdp_select', 'ryba/lib/hdp_select'
      @registry.register ['file', 'jaas'], 'ryba/lib/file_jaas'

## Users & Groups

      @group knox.group
      @user knox.user

## IPTables

| Service        | Port  | Proto | Parameter       |
|----------------|-------|-------|-----------------|
| Gateway        | 8443  | http  | gateway.port    |


IPTables rules are only inserted if the parameter "iptables.action" is set to
"start" (default value).

      @iptables
        header: 'IPTables'
        rules: [
          { chain: 'INPUT', jump: 'ACCEPT', dport: knox.site['gateway.port'], protocol: 'tcp', state: 'NEW', comment: "Knox Gateway" }
        ]
        if: @config.iptables.action is 'start'

## Packages

      @call header: 'Packages', timeout: -1, handler: ->
        @service name: 'knox'
        @hdp_select name: 'knox-server'
        # Fix autogen of master secret
        @call 
          if: ->@status -2
        , ->
          @each  [
            '/usr/hdp/current/knox-server/data/security/master'
            '/usr/hdp/current/knox-server/data/security/keystores'
            '/usr/hdp/current/knox-server/conf/topologies/admin.xml'
            '/usr/hdp/current/knox-server/conf/topologies/sandbox.xml'
          ] , (options) ->
              @remove  target: options.key
        @chown
          target: '/var/log/knox'
          uid: knox.user.name
          gid: knox.user.gid
        @render
          target: '/etc/init.d/knox-server'
          source: "#{__dirname}/resources/knox-server.j2"
          local_source: true
          context: @config.ryba.knox
          mode: 0o755

## Configure

      @hconfigure
        header: 'Configure'
        target: "#{knox.conf_dir}/gateway-site.xml"
        properties: knox.site
        merge: true

      @render
        header: 'Knox Ldap Caching'
        target: "#{knox.conf_dir}/ehcache.xml"
        source: "#{__dirname}/resources/ehcache.yml"
        local_source: true

## Env

We do not edit knox-env.sh because environnement variables are directly set
in the gateway.sh service script.

      @file
        header: 'Env'
        target: "#{knox.conf_dir}/gateway.sh"
        write: for k, v of knox.env<commit_msg>Knox: add ldap caching<commit_after>
# Knox Install

    module.exports = header: 'Knox Install', handler: ->
      {knox, realm} = @config.ryba
      {java_home, jre_home} = @config.java
      krb5 = @config.krb5.etc_krb5_conf.realms[realm]

## Register

      @registry.register 'hconfigure', 'ryba/lib/hconfigure'
      @registry.register 'hdp_select', 'ryba/lib/hdp_select'
      @registry.register ['file', 'jaas'], 'ryba/lib/file_jaas'

## Users & Groups

      @group knox.group
      @user knox.user

## IPTables

| Service        | Port  | Proto | Parameter       |
|----------------|-------|-------|-----------------|
| Gateway        | 8443  | http  | gateway.port    |


IPTables rules are only inserted if the parameter "iptables.action" is set to
"start" (default value).

      @iptables
        header: 'IPTables'
        rules: [
          { chain: 'INPUT', jump: 'ACCEPT', dport: knox.site['gateway.port'], protocol: 'tcp', state: 'NEW', comment: "Knox Gateway" }
        ]
        if: @config.iptables.action is 'start'

## Packages

      @call header: 'Packages', timeout: -1, handler: ->
        @service name: 'knox'
        @hdp_select name: 'knox-server'
        # Fix autogen of master secret
        @call 
          if: ->@status -2
        , ->
          @each  [
            '/usr/hdp/current/knox-server/data/security/master'
            '/usr/hdp/current/knox-server/data/security/keystores'
            '/usr/hdp/current/knox-server/conf/topologies/admin.xml'
            '/usr/hdp/current/knox-server/conf/topologies/sandbox.xml'
          ] , (options) ->
              @remove  target: options.key
        @chown
          target: '/var/log/knox'
          uid: knox.user.name
          gid: knox.user.gid
        @render
          target: '/etc/init.d/knox-server'
          source: "#{__dirname}/resources/knox-server.j2"
          local_source: true
          context: @config.ryba.knox
          mode: 0o755

## Configure

      @hconfigure
        header: 'Configure'
        target: "#{knox.conf_dir}/gateway-site.xml"
        properties: knox.site
        merge: true

      @render
        header: 'Knox Ldap Caching'
        target: "#{knox.conf_dir}/ehcache.xml"
        source: "#{__dirname}/resources/ehcache.xml"
        local_source: true

## Env

We do not edit knox-env.sh because environnement variables are directly set
in the gateway.sh service script.

      @file
        header: 'Env'
        target: "#{knox.conf_dir}/gateway.sh"
        write: for k, v of knox.env
{'fraction_non_alphanumeric': 0.14903750744195277, 'fraction_numerical': 0.005556658067076801, 'mean_word_length': 1.9612220916568743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 9}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2721407', 'n_tokens_mistral': 1686, 'n_tokens_neox': 1626, 'n_words': 354}