{"_id":"586d04ccee5a4823001444e7","version":{"_id":"55db8f901a91690d007ad978","project":"55db8f8f1a91690d007ad975","__v":17,"createdAt":"2015-08-24T21:41:36.034Z","releaseDate":"2015-08-24T21:41:36.034Z","categories":["55db8f901a91690d007ad979","55db9856b3d6540d00886426","55dc751b00a8811900c230e3","55dc766255be9f21004ee250","55dc769200a8811900c230ed","55e4c701177b6e0d003330fa","55f4915caf0bc71900a53130","55f491b2be9c2b2100f0635d","560b22739c7be70d00100bd8","57488c53e8c6a420000b729c","574cefd95953e20e00f40f9f","5798edfd7700d30e00ad250c","579ac88234b5fd0e00b9e140","57c81c6d690c200e0047b72e","57d9b8fbda17c30e003897f1","57d9b90e608ea00e00f358d8","57d9b91cda17c30e003897f4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":0,"category":{"_id":"55dc751b00a8811900c230e3","pages":["55dc75b27fa0290d00559123","55dc75c055be9f21004ee24e","55dc75ef00a8811900c230e7","55dc76036f16451700843e0c","55dc760e00a8811900c230e9","55dc767d55be9f21004ee251","55df5db386ae7f0d00db4ccd","55df64cfaf76b70d0060a60e","55df7263c59b180d005fa70e","55e0b72fa44fae0d002148c5","55e0c42b5087cb1900986c0f","55e36b1bac4eef230079a735","55f363ea2d3bae21009c47aa","55f36bcc5f8674370067b73c","55f36c23ec46040d0030326a","5605d2eda4574a0d00811346","560ac5fef6994b0d0023bca6","561be02937781d0d007942b0","56782f0048c8d00d0094b7fc"],"project":"55db8f8f1a91690d007ad975","version":"55db8f901a91690d007ad978","__v":19,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-25T14:00:59.500Z","from_sync":false,"order":1,"slug":"how-to-get-started","title":"Agent Installation"},"user":"574c9889a1f0be2000ae376e","parentDoc":null,"githubsync":"","project":"55db8f8f1a91690d007ad975","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-04T14:21:00.080Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":9,"body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/87757f8-smooth-spiral.png\",\n        \"smooth-spiral.png\",\n        167,\n        246,\n        \"#c61d08\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Supported Versions\"\n}\n[/block]\nScala (2.11)\nOS: Linux or OSX (64-bit only)\n\nFrameworks:\n* Finagle >= 6.3.x\n* Finatra >= 2.x\n* Play 2.4.x\n* Netty 3.10\n\nFor SQL Injection protection, we support the following JDBC drivers:\n* MySQL >= 5.0.5, PostgreSQL >= 9.1, Oracle (JDBC 4), HSQLDB >= 1.8, H2 >= 1.4\n* ORM:  Anorm\n\nFor Cross-Site Scripting Protection:\n* Twirl 1.1\n\nFor Account protection, use of the authentication API is necessary:\nhttps://docs.immun.io/docs/java-agent-api\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Prerequisites\"\n}\n[/block]\nThe IMMUNIO agent communicates with a management service at https://agent.immun.io. Ensure outbound access to this address is unblocked.​\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Installation\"\n}\n[/block]\nThe IMMUNIO agent comes in the form of a JAR file you can download [here](https://download.immun.io/java/immunio-1.7.0.jar). \n\nWhen installing the agent for the Play framework, the agent jar file needs to be placed in the Play application lib folder.\nThe agent must also be added to the command line of the runtime. For example, for version x.y.z of the agent, the following option must be added to the command line arguments:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"make IMMUNIO_AGENT_JAR=/path/to/immunio-x.y.z.jar\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nEach web server has a different mechanism for adding command line arguments.\n\n## Jetty\nWhen using the Jetty server, export the following environment variable:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"export JAVA_OPTIONS=\\\"${JAVA_OPTIONS} -javaagent:/full/path/to/immunio-x.y.z.jar\\\"\",\n      \"language\": \"shell\",\n      \"name\": \"Jetty\"\n    }\n  ]\n}\n[/block]\n## Tomcat\nWhen using the Tomcat web server, export the following environment variable:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"export CATALINA_OPTS=\\\"${CATALINA_OPTS} -javaagent:/full/path/to/immunio-x.y.z.jar\\\"\",\n      \"language\": \"shell\",\n      \"name\": \"Tomcat\"\n    }\n  ]\n}\n[/block]\n## Netty\nWhen using the Netty server, export the following environment variable:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"export JAVA_OPTS=\\\"${JAVA_OPTS} -javaagent:/full/path/to/immunio-x.y.z.jar\\\"\",\n      \"language\": \"shell\",\n      \"name\": \"Netty\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Configuration\"\n}\n[/block]\nThere are three ways to provide agent configuration: adding settings to an `immunio.properties` file, starting your application with command line options, or setting environment variables at runtime.\n\n## Properties File\nThe IMMUNIO agent will look in​ the following locations for the configuration file:\n\n  * A file location specified via the `io.immun.config.file` system property. System properties are generally set using `-D` command line options. For example: `-Dio.immun.config.file=/path/to/immunio.properties`.\n \n  * `immunio.properties` in the same directory as the IMMUNIO agent jar file.\n \n  * `immunio.properties` in the resources of your project.\n \nThe first location found will be used. Here is an example `immunio.properties` file:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"key = 87637d4f-f01a-406d-b3e6-1ff8f84a3d34\\nsecret = a0ca4263-da57-45f5-aabb-b72e5a78b510\\ncodeProtectionPluginsEnabled = true\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n## Command Line Options\nSettings may be configured at the command line interface using system properties. The system property name is formed by prepending `io.immun.` to the configuration setting. For example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"java ... \\\\\\n-Dio.immun.key=87637d4f-f01a-406d-b3e6-1ff8f84a3d34 \\\\\\n-Dio.immun.secret=a0ca4263-da57-45f5-aabb-b72e5a78b510 \\\\\\n-Dio.immun.codeProtectionPluginsEnabled=true \\\\\\n...\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThe method for setting command line options varies by web server. You may be able to pass them using the `-javaagent` command line argument as described above.\n\n## Environment Variables\nWhen using environment variables, convert setting names to uppercase and prepend `IMMUNIO_`. For example, the key would be provided in the environment variable `IMMUNIO_KEY`​.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"export IMMUNIO_KEY=87637d4f-f01a-406d-b3e6-1ff8f84a3d34\\nexport IMMUNIO_SECRET=a0ca4263-da57-45f5-aabb-b72e5a78b510\\nexport IMMUNIO_CODE_PROTECTION_PLUGINS_ENABLED=true\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Account Protection Configuration\",\n  \"body\": \"If you do not plan to use IMMUNIO's Code Protection features, you can set the code protection variable to false or simply exclude that line from your configuration.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Verification\"\n}\n[/block]\nOnce the agent is installed and configured, start your application and send an HTTP request to it. Without that first HTTP call, the agent status will display INACTIVE in the dashboard. Within seconds of your first request, the agent should report in and change its status indicator to OK. Your app is now protected with IMMUNIO!​","excerpt":"","slug":"scala","type":"basic","title":"Scala"}
[block:image] { "images": [ { "image": [ "https://files.readme.io/87757f8-smooth-spiral.png", "smooth-spiral.png", 167, 246, "#c61d08" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Supported Versions" } [/block] Scala (2.11) OS: Linux or OSX (64-bit only) Frameworks: * Finagle >= 6.3.x * Finatra >= 2.x * Play 2.4.x * Netty 3.10 For SQL Injection protection, we support the following JDBC drivers: * MySQL >= 5.0.5, PostgreSQL >= 9.1, Oracle (JDBC 4), HSQLDB >= 1.8, H2 >= 1.4 * ORM: Anorm For Cross-Site Scripting Protection: * Twirl 1.1 For Account protection, use of the authentication API is necessary: https://docs.immun.io/docs/java-agent-api [block:api-header] { "type": "basic", "title": "Prerequisites" } [/block] The IMMUNIO agent communicates with a management service at https://agent.immun.io. Ensure outbound access to this address is unblocked.​ [block:api-header] { "type": "basic", "title": "Installation" } [/block] The IMMUNIO agent comes in the form of a JAR file you can download [here](https://download.immun.io/java/immunio-1.7.0.jar). When installing the agent for the Play framework, the agent jar file needs to be placed in the Play application lib folder. The agent must also be added to the command line of the runtime. For example, for version x.y.z of the agent, the following option must be added to the command line arguments: [block:code] { "codes": [ { "code": "make IMMUNIO_AGENT_JAR=/path/to/immunio-x.y.z.jar", "language": "shell" } ] } [/block] Each web server has a different mechanism for adding command line arguments. ## Jetty When using the Jetty server, export the following environment variable: [block:code] { "codes": [ { "code": "export JAVA_OPTIONS=\"${JAVA_OPTIONS} -javaagent:/full/path/to/immunio-x.y.z.jar\"", "language": "shell", "name": "Jetty" } ] } [/block] ## Tomcat When using the Tomcat web server, export the following environment variable: [block:code] { "codes": [ { "code": "export CATALINA_OPTS=\"${CATALINA_OPTS} -javaagent:/full/path/to/immunio-x.y.z.jar\"", "language": "shell", "name": "Tomcat" } ] } [/block] ## Netty When using the Netty server, export the following environment variable: [block:code] { "codes": [ { "code": "export JAVA_OPTS=\"${JAVA_OPTS} -javaagent:/full/path/to/immunio-x.y.z.jar\"", "language": "shell", "name": "Netty" } ] } [/block] [block:api-header] { "type": "basic", "title": "Configuration" } [/block] There are three ways to provide agent configuration: adding settings to an `immunio.properties` file, starting your application with command line options, or setting environment variables at runtime. ## Properties File The IMMUNIO agent will look in​ the following locations for the configuration file: * A file location specified via the `io.immun.config.file` system property. System properties are generally set using `-D` command line options. For example: `-Dio.immun.config.file=/path/to/immunio.properties`. * `immunio.properties` in the same directory as the IMMUNIO agent jar file. * `immunio.properties` in the resources of your project. The first location found will be used. Here is an example `immunio.properties` file: [block:code] { "codes": [ { "code": "key = 87637d4f-f01a-406d-b3e6-1ff8f84a3d34\nsecret = a0ca4263-da57-45f5-aabb-b72e5a78b510\ncodeProtectionPluginsEnabled = true", "language": "text" } ] } [/block] ## Command Line Options Settings may be configured at the command line interface using system properties. The system property name is formed by prepending `io.immun.` to the configuration setting. For example: [block:code] { "codes": [ { "code": "java ... \\\n-Dio.immun.key=87637d4f-f01a-406d-b3e6-1ff8f84a3d34 \\\n-Dio.immun.secret=a0ca4263-da57-45f5-aabb-b72e5a78b510 \\\n-Dio.immun.codeProtectionPluginsEnabled=true \\\n...", "language": "shell" } ] } [/block] The method for setting command line options varies by web server. You may be able to pass them using the `-javaagent` command line argument as described above. ## Environment Variables When using environment variables, convert setting names to uppercase and prepend `IMMUNIO_`. For example, the key would be provided in the environment variable `IMMUNIO_KEY`​. [block:code] { "codes": [ { "code": "export IMMUNIO_KEY=87637d4f-f01a-406d-b3e6-1ff8f84a3d34\nexport IMMUNIO_SECRET=a0ca4263-da57-45f5-aabb-b72e5a78b510\nexport IMMUNIO_CODE_PROTECTION_PLUGINS_ENABLED=true", "language": "shell" } ] } [/block] [block:callout] { "type": "info", "title": "Account Protection Configuration", "body": "If you do not plan to use IMMUNIO's Code Protection features, you can set the code protection variable to false or simply exclude that line from your configuration." } [/block] [block:api-header] { "type": "basic", "title": "Verification" } [/block] Once the agent is installed and configured, start your application and send an HTTP request to it. Without that first HTTP call, the agent status will display INACTIVE in the dashboard. Within seconds of your first request, the agent should report in and change its status indicator to OK. Your app is now protected with IMMUNIO!​