Code Monkey home page Code Monkey logo

responseheadervalve's Introduction

ResponseHeaderValve

As part of some required system hardening activities we were asked to enable HTTP Strict Transport Security (HSTS). This entails adding a "Strict-Transport-Security" response header. The web subsystem of the JBoss 6.x application container does not provide a mechanism for adding custom response headers. The code in this repository implements a global valve that inserts the HSTS response header for all client requests. Code has been updated to include a header to prevent MIME attacks, and an IE8 header to help protect against XSS attacks.

Download and Build the Source

  • Minimum requirements:
    • Java Development Kit (v1.8.0 or higher)
    • GIT (v1.7 or higher)
    • Maven (v3.3 or higher)
    • JBoss (v6.x)
  • Download source
# cd /var/local
# git clone https://github.com/carpenlc/ResponseHeaderValve.git
  • Build the source
# cd ResponseHeaderValve
# mvn clean package

Installation

The valve will be installed as a JBoss module.

# mkdir -p ${JBOSS_HOME}/modules/system/layers/base/mil/nga/npd/ResponseHeaderValve/main
# cp ./target/ResponseHeaderValve-1.0.0.jar ${JBOSS_HOME}/modules/system/layers/base/mil/nga/npd/ResponseHeaderValve/main
# cp ./src/main/resources/module.xml ${JBOSS_HOME}/modules/system/layers/base/mil/nga/npd/ResponseHeaderValve/main

Add the valve to the JBoss web subsystem. My JBoss CLI foo is not strong (expecially due to running in domain mode). As such we manually added the valve to the domain.xml file:

<valve name="HSTS-headers" 
       module="mil.nga.npd.ResponseHeaderValve" 
       class-name="mil.nga.npd.ResponseHeaderValve.InsertResponseHeaders" />

Restart JBoss.

responseheadervalve's People

Contributors

carpenlc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.