pax_global_header00006660000000000000000000000064141255002030014502gustar00rootroot0000000000000052 comment=dd21d767135e79ba9d583ecccd25bf9012cac6d7 tomcatjss-8.0.0/000077500000000000000000000000001412550020300135165ustar00rootroot00000000000000tomcatjss-8.0.0/.classpath000066400000000000000000000020471412550020300155040ustar00rootroot00000000000000 tomcatjss-8.0.0/.copr/000077500000000000000000000000001412550020300145375ustar00rootroot00000000000000tomcatjss-8.0.0/.copr/Makefile000066400000000000000000000002521412550020300161760ustar00rootroot00000000000000srpm: dnf install -y git ./build.sh --with-timestamp --with-commit-id srpm if [[ "${outdir}" != "" ]]; then \ mv ${HOME}/build/tomcatjss/SRPMS/* ${outdir}; \ fi tomcatjss-8.0.0/.github/000077500000000000000000000000001412550020300150565ustar00rootroot00000000000000tomcatjss-8.0.0/.github/workflows/000077500000000000000000000000001412550020300171135ustar00rootroot00000000000000tomcatjss-8.0.0/.github/workflows/pki-tests.yml000066400000000000000000000155271412550020300215730ustar00rootroot00000000000000name: PKI Tests on: [push, pull_request] jobs: init: name: Initializing Workflow runs-on: ubuntu-latest outputs: matrix: ${{ steps.init.outputs.matrix }} repo: ${{ steps.init.outputs.repo }} steps: - name: Clone repository uses: actions/checkout@v2 - name: Initialize workflow id: init env: BASE64_MATRIX: ${{ secrets.BASE64_MATRIX }} BASE64_REPO: ${{ secrets.BASE64_REPO }} run: | tests/bin/init-workflow.sh build: name: Building TomcatJSS needs: init runs-on: ubuntu-latest strategy: matrix: ${{ fromJSON(needs.init.outputs.matrix) }} steps: - name: Clone repository uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Build runner image uses: docker/build-push-action@v2 with: context: . build-args: | OS_VERSION=${{ matrix.os }} COPR_REPO=${{ needs.init.outputs.repo }} BUILD_OPTS=--with-timestamp --with-commit-id tags: tomcatjss-runner target: tomcatjss-runner outputs: type=docker,dest=/tmp/tomcatjss-runner.tar - name: Upload runner image uses: actions/upload-artifact@v2 with: name: tomcatjss-runner-${{ matrix.os }} path: /tmp/tomcatjss-runner.tar # https://github.com/dogtagpki/pki/blob/master/docs/installation/server/Installing_Basic_PKI_Server.md ssl-test: name: Testing SSL Connector needs: [init, build] runs-on: ubuntu-latest env: SHARED: /tmp/workdir/tomcatjss strategy: matrix: ${{ fromJSON(needs.init.outputs.matrix) }} steps: - name: Clone repository uses: actions/checkout@v2 - name: Download runner image uses: actions/download-artifact@v2 with: name: tomcatjss-runner-${{ matrix.os }} path: /tmp - name: Load runner image run: docker load --input /tmp/tomcatjss-runner.tar - name: Run container run: | IMAGE=tomcatjss-runner \ NAME=pki \ HOSTNAME=pki.example.com \ tests/bin/runner-init.sh - name: Install PKI packages run: docker exec pki dnf install -y pki-server sslscan - name: Create PKI server run: docker exec pki pki-server create - name: Create NSS database run: docker exec pki pki-server nss-create --no-password - name: Create SSL server cert request run: | docker exec pki pki \ -d /var/lib/pki/pki-tomcat/conf/alias \ nss-cert-request \ --subject "CN=pki.example.com" \ --ext /usr/share/pki/server/certs/sslserver.conf \ --csr sslserver.csr docker exec pki openssl req -text -noout -in sslserver.csr - name: Issue self-signed SSL server cert run: | docker exec pki pki \ -d /var/lib/pki/pki-tomcat/conf/alias \ nss-cert-issue \ --csr sslserver.csr \ --ext /usr/share/pki/server/certs/sslserver.conf \ --cert sslserver.crt docker exec pki openssl x509 -text -noout -in sslserver.crt - name: Import SSL server cert run: | docker exec pki pki \ -d /var/lib/pki/pki-tomcat/conf/alias \ nss-cert-import \ --cert sslserver.crt \ sslserver - name: Enable JSS in PKI server run: docker exec pki pki-server jss-enable - name: Create SSL connector run: | docker exec pki pki-server http-connector-add \ --port 8443 \ --scheme https \ --secure true \ --sslEnabled true \ --sslProtocol SSL \ --sslImpl org.dogtagpki.tomcat.JSSImplementation \ Secure - name: Configure SSL certificate run: | docker exec pki pki-server http-connector-cert-add \ --keyAlias sslserver \ --keystoreType pkcs11 \ --keystoreProvider Mozilla-JSS - name: Create ROOT web application run: | docker exec pki mkdir /var/lib/pki/pki-tomcat/webapps/ROOT docker exec pki touch /var/lib/pki/pki-tomcat/webapps/ROOT/index.html - name: Start PKI server run: docker exec pki pki-server start --wait - name: Verify SSL connection run: docker exec pki sslscan pki.example.com:8443 - name: Stop PKI server run: docker exec pki pki-server stop --wait - name: Remove PKI server run: docker exec pki pki-server remove # https://github.com/dogtagpki/pki/blob/master/docs/installation/ca/Installing_CA.md ca-test: name: Testing CA Installation needs: [init, build] runs-on: ubuntu-latest env: SHARED: /tmp/workdir/tomcatjss strategy: matrix: ${{ fromJSON(needs.init.outputs.matrix) }} steps: - name: Clone repository uses: actions/checkout@v2 - name: Download runner image uses: actions/download-artifact@v2 with: name: tomcatjss-runner-${{ matrix.os }} path: /tmp - name: Load runner image run: docker load --input /tmp/tomcatjss-runner.tar - name: Run container run: | IMAGE=tomcatjss-runner \ NAME=pki \ HOSTNAME=pki.example.com \ tests/bin/runner-init.sh - name: Install DS and PKI packages run: docker exec pki dnf install -y 389-ds-base pki-ca - name: Install DS run: docker exec pki ${SHARED}/tests/bin/ds-create.sh - name: Install CA run: docker exec pki pkispawn -f /usr/share/pki/server/examples/installation/ca.cfg -s CA -v - name: Run PKI healthcheck run: docker exec pki pki-healthcheck --debug - name: Verify CA admin run: | docker exec pki pki-server cert-export ca_signing --cert-file ca_signing.crt docker exec pki pki client-cert-import ca_signing --ca-cert ca_signing.crt docker exec pki pki client-cert-import \ --pkcs12 /root/.dogtag/pki-tomcat/ca_admin_cert.p12 \ --pkcs12-password-file /root/.dogtag/pki-tomcat/ca/pkcs12_password.conf docker exec pki pki -n caadmin ca-user-show caadmin - name: Gather artifacts if: always() run: | tests/bin/ds-artifacts-save.sh pki tests/bin/pki-artifacts-save.sh pki - name: Remove CA run: docker exec pki pkidestroy -i pki-tomcat -s CA -v - name: Remove DS run: docker exec pki ${SHARED}/tests/bin/ds-remove.sh - name: Upload artifacts if: always() uses: actions/upload-artifact@v2 with: name: ca-${{ matrix.os }} path: | /tmp/artifacts/pki tomcatjss-8.0.0/.gitignore000066400000000000000000000000301412550020300154770ustar00rootroot00000000000000/bin build dist target/ tomcatjss-8.0.0/.gitlab-ci.yml000066400000000000000000000012321412550020300161500ustar00rootroot00000000000000image: fedora sync: script: - echo "Synchronizing $CI_COMMIT_BRANCH branch from $UPSTREAM_URL to $CI_PROJECT_URL" - dnf install -y git - git remote set-url origin https://sync:$ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git - git remote remove upstream || true - git remote add upstream $UPSTREAM_URL - git remote -v - git fetch upstream $CI_COMMIT_BRANCH - git checkout upstream/$CI_COMMIT_BRANCH - git log origin/$CI_COMMIT_BRANCH..upstream/$CI_COMMIT_BRANCH --oneline - GIT_SSL_NO_VERIFY=true git push origin HEAD:$CI_COMMIT_BRANCH rules: - if: $SYNC == "true" tags: # Use shared runners. - shared tomcatjss-8.0.0/.project000066400000000000000000000005601412550020300151660ustar00rootroot00000000000000 tomcatjss org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature tomcatjss-8.0.0/.settings/000077500000000000000000000000001412550020300154345ustar00rootroot00000000000000tomcatjss-8.0.0/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000561231412550020300224250ustar00rootroot00000000000000eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=120 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.indentation.size=8 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=false org.eclipse.jdt.core.formatter.join_wrapped_lines=false org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true tomcatjss-8.0.0/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000052561412550020300221130ustar00rootroot00000000000000eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_PKI Project Profile formatter_settings_version=12 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=false sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_missing_override_annotations_interface_methods=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=false sp_cleanup.format_source_code_changes_only=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true tomcatjss-8.0.0/Dockerfile000066400000000000000000000023121412550020300155060ustar00rootroot00000000000000# # Copyright Red Hat, Inc. # # SPDX-License-Identifier: GPL-2.0-or-later # ARG OS_VERSION="latest" ARG COPR_REPO="@pki/master" ################################################################################ FROM registry.fedoraproject.org/fedora:$OS_VERSION AS tomcatjss-builder ARG COPR_REPO ARG BUILD_OPTS # Enable COPR repo if specified RUN if [ -n "$COPR_REPO" ]; then dnf install -y dnf-plugins-core; dnf copr enable -y $COPR_REPO; fi # Import source COPY . /tmp/tomcatjss/ WORKDIR /tmp/tomcatjss # Build packages RUN dnf install -y git rpm-build RUN dnf builddep -y --spec tomcatjss.spec RUN ./build.sh $BUILD_OPTS --work-dir=build rpm ################################################################################ FROM registry.fedoraproject.org/fedora:$OS_VERSION AS tomcatjss-runner ARG COPR_REPO EXPOSE 389 8080 8443 # Enable COPR repo if specified RUN if [ -n "$COPR_REPO" ]; then dnf install -y dnf-plugins-core; dnf copr enable -y $COPR_REPO; fi # Import packages COPY --from=tomcatjss-builder /tmp/tomcatjss/build/RPMS /tmp/RPMS/ # Install packages RUN dnf localinstall -y /tmp/RPMS/*; rm -rf /tmp/RPMS # Install systemd to run the container RUN dnf install -y systemd CMD [ "/usr/sbin/init" ] tomcatjss-8.0.0/LICENSE000066400000000000000000000635041412550020300145330ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! tomcatjss-8.0.0/README000066400000000000000000000107651412550020300144070ustar00rootroot00000000000000JSS Connector for Apache Tomcat, installed via the tomcatjss package, is a Java Secure Socket Extension (JSSE) module for Apache Tomcat that uses Java Security Services (JSS), a Java interface to Network Security Services (NSS). JSS Connector for Apache Tomcat defines a number of attributes for a Connector including: clientauth: specify if client authentication is required in the connector (or port), it can be true or false. If true then client authentication is required. sslOptions: specify a comma-delimited list of ssl options to pass into the ssl implementation. Each option takes the form of: option=[true|false]. JSS Connector for Apache Tomcat supports the options: ssl2, ssl3, tls. ssl2Ciphers: specify a list of SSL2 ciphers that JSS Connector for Apache Tomcat should accept or reject from the client. You can use + to denote "accept", - means "reject" ssl3Ciphers: specifies a list of SSL3 ciphers that JSS Connector for Apache Tomcat should accept or reject from the client. You can use + to denote "accept", - means "reject". tlsCiphers: specifies a list of TLS ciphers that JSS Connector for Apache Tomcat should accept or reject from the client. You can use + to denote "accept", - means "reject". serverCertNickFile: a file in which specify the nickname of the server certificate. The file should contain a single line that contains the nickname. passwordFile: specify a file in which a password that is required to access NSS's security database. Each entry in the file needs to appear on its own line and has the form: token_name=password certdbDir: specify the directory the NSS security database resides in. passwordClass: specify the class that will be used to read the password. sslProtocol: needs to be SSL sslImplementationName: MUST be org.apache.tomcat.util.net.jss.JSSImplementation in order to use the plugin Here is an example of a secure connector: tomcatjss-8.0.0/build.sh000077500000000000000000000207561412550020300151660ustar00rootroot00000000000000#!/bin/bash -e # BEGIN COPYRIGHT BLOCK # (C) 2018 Red Hat, Inc. # All rights reserved. # END COPYRIGHT BLOCK NAME=tomcatjss SCRIPT_PATH="$(readlink -f "$0")" SCRIPT_NAME="$(basename "$SCRIPT_PATH")" SRC_DIR="$(dirname "$SCRIPT_PATH")" WORK_DIR="$HOME/build/$NAME" SOURCE_TAG= WITH_TIMESTAMP= WITH_COMMIT_ID= DIST= VERBOSE= DEBUG= usage() { echo "Usage: $SCRIPT_NAME [OPTIONS] " echo echo "Options:" echo " --work-dir= Working directory (default: $WORK_DIR)." echo " --source-tag= Generate RPM sources from a source tag." echo " --with-timestamp Append timestamp to release number." echo " --with-commit-id Append commit ID to release number." echo " --dist= Distribution name (e.g. fc28)." echo " -v,--verbose Run in verbose mode." echo " --debug Run in debug mode." echo " --help Show help message." echo echo "Target:" echo " src Generate RPM sources." echo " spec Generate RPM spec." echo " srpm Build SRPM package." echo " rpm Build RPM packages (default)." } generate_rpm_sources() { TARBALL="$NAME-$VERSION${_PHASE}.tar.gz" if [ "$SOURCE_TAG" != "" ] ; then if [ "$VERBOSE" = true ] ; then echo "Generating $TARBALL from $SOURCE_TAG tag" fi git -C "$SRC_DIR" \ archive \ --format=tar.gz \ --prefix $NAME-$VERSION${_PHASE}/ \ -o "$WORK_DIR/SOURCES/$TARBALL" \ $SOURCE_TAG if [ "$SOURCE_TAG" != "HEAD" ] ; then TAG_ID="$(git -C "$SRC_DIR" rev-parse $SOURCE_TAG)" HEAD_ID="$(git -C "$SRC_DIR" rev-parse HEAD)" if [ "$TAG_ID" != "$HEAD_ID" ] ; then generate_patch fi fi return fi if [ "$VERBOSE" = true ] ; then echo "Generating $TARBALL" fi tar czf "$WORK_DIR/SOURCES/$TARBALL" \ --transform "s,^./,$NAME-$VERSION${_PHASE}/," \ --exclude .git \ --exclude bin \ -C "$SRC_DIR" \ . } generate_patch() { PATCH="$NAME-$VERSION-$RELEASE.patch" if [ "$VERBOSE" = true ] ; then echo "Generating $PATCH for all changes since $SOURCE_TAG tag" fi git -C "$SRC_DIR" \ format-patch \ --stdout \ $SOURCE_TAG \ > "$WORK_DIR/SOURCES/$PATCH" } generate_rpm_spec() { RPM_SPEC="$NAME.spec" if [ "$VERBOSE" = true ] ; then echo "Generating $RPM_SPEC" fi # hard-code timestamp commands="s/%{?_timestamp}/${_TIMESTAMP}/g" # hard-code commit ID commands="${commands}; s/%{?_commit_id}/${_COMMIT_ID}/g" # hard-code phase commands="${commands}; s/%{?_phase}/${_PHASE}/g" # hard-code patch if [ "$PATCH" != "" ] ; then commands="${commands}; s/# Patch: tomcatjss-VERSION-RELEASE.patch/Patch: $PATCH/g" fi sed "$commands" "$SPEC_TEMPLATE" > "$WORK_DIR/SPECS/$RPM_SPEC" # rpmlint "$WORK_DIR/SPECS/$RPM_SPEC" } while getopts v-: arg ; do case $arg in v) VERBOSE=true ;; -) LONG_OPTARG="${OPTARG#*=}" case $OPTARG in work-dir=?*) WORK_DIR="$(readlink -f "$LONG_OPTARG")" ;; source-tag=?*) SOURCE_TAG="$LONG_OPTARG" ;; with-timestamp) WITH_TIMESTAMP=true ;; with-commit-id) WITH_COMMIT_ID=true ;; dist=?*) DIST="$LONG_OPTARG" ;; verbose) VERBOSE=true ;; debug) VERBOSE=true DEBUG=true ;; help) usage exit ;; '') break # "--" terminates argument processing ;; work-dir* | source-tag* | dist*) echo "ERROR: Missing argument for --$OPTARG option" >&2 exit 1 ;; *) echo "ERROR: Illegal option --$OPTARG" >&2 exit 1 ;; esac ;; \?) exit 1 # getopts already reported the illegal option ;; esac done # remove parsed options and args from $@ list shift $((OPTIND-1)) if [ "$#" -lt 1 ] ; then BUILD_TARGET=rpm else BUILD_TARGET=$1 fi if [ "$DEBUG" = true ] ; then echo "WORK_DIR: $WORK_DIR" echo "BUILD_TARGET: $BUILD_TARGET" fi if [ "$BUILD_TARGET" != "src" ] && [ "$BUILD_TARGET" != "spec" ] && [ "$BUILD_TARGET" != "srpm" ] && [ "$BUILD_TARGET" != "rpm" ] ; then echo "ERROR: Invalid build target: $BUILD_TARGET" >&2 exit 1 fi SPEC_TEMPLATE="$SRC_DIR/$NAME.spec" VERSION="$(rpmspec -P "$SPEC_TEMPLATE" | grep "^Version:" | awk '{print $2;}')" if [ "$DEBUG" = true ] ; then echo "VERSION: $VERSION" fi RELEASE="$(rpmspec -P "$SPEC_TEMPLATE" --undefine dist | grep "^Release:" | awk '{print $2;}')" if [ "$DEBUG" = true ] ; then echo "RELEASE: $RELEASE" fi spec=$(<"$SPEC_TEMPLATE") regex=$'%global *_phase *([^\n]+)' if [[ $spec =~ $regex ]] ; then _PHASE="${BASH_REMATCH[1]}" fi if [ "$DEBUG" = true ] ; then echo "PHASE: ${_PHASE}" fi if [ "$WITH_TIMESTAMP" = true ] ; then TIMESTAMP="$(date -u +"%Y%m%d%H%M%S%Z")" _TIMESTAMP=".$TIMESTAMP" fi if [ "$DEBUG" = true ] ; then echo "TIMESTAMP: $TIMESTAMP" fi if [ "$WITH_COMMIT_ID" = true ]; then COMMIT_ID="$(git -C "$SRC_DIR" rev-parse --short=8 HEAD)" _COMMIT_ID=".$COMMIT_ID" fi if [ "$DEBUG" = true ] ; then echo "COMMIT_ID: $COMMIT_ID" fi echo "Building $NAME-$VERSION-$RELEASE${_TIMESTAMP}${_COMMIT_ID}" ################################################################################ # Initialize working directory ################################################################################ if [ "$VERBOSE" = true ] ; then echo "Initializing $WORK_DIR" fi mkdir -p $WORK_DIR cd $WORK_DIR rm -rf BUILD rm -rf RPMS rm -rf SOURCES rm -rf SPECS rm -rf SRPMS mkdir BUILD mkdir RPMS mkdir SOURCES mkdir SPECS mkdir SRPMS ################################################################################ # Generate RPM sources ################################################################################ generate_rpm_sources echo "RPM sources:" find "$WORK_DIR/SOURCES" -type f -printf " %p\n" if [ "$BUILD_TARGET" = "src" ] ; then exit fi ################################################################################ # Generate RPM spec ################################################################################ generate_rpm_spec echo "RPM spec:" find "$WORK_DIR/SPECS" -type f -printf " %p\n" if [ "$BUILD_TARGET" = "spec" ] ; then exit fi ################################################################################ # Build source package ################################################################################ OPTIONS=() OPTIONS+=(--quiet) OPTIONS+=(--define "_topdir ${WORK_DIR}") if [ "$WITH_TIMESTAMP" = true ] ; then OPTIONS+=(--define "_timestamp ${_TIMESTAMP}") fi if [ "$WITH_COMMIT_ID" = true ] ; then OPTIONS+=(--define "_commit_id ${_COMMIT_ID}") fi if [ "$DIST" != "" ] ; then OPTIONS+=(--define "dist .$DIST") fi if [ "$DEBUG" = true ] ; then echo "rpmbuild -bs ${OPTIONS[@]} $WORK_DIR/SPECS/$RPM_SPEC" fi # build SRPM with user-provided options rpmbuild -bs "${OPTIONS[@]}" "$WORK_DIR/SPECS/$RPM_SPEC" rc=$? if [ $rc != 0 ]; then echo "ERROR: Unable to build SRPM package" exit 1 fi SRPM="$(find "$WORK_DIR/SRPMS" -type f)" echo "SRPM package:" echo " $SRPM" if [ "$BUILD_TARGET" = "srpm" ] ; then exit fi ################################################################################ # Build binary packages ################################################################################ OPTIONS=() if [ "$VERBOSE" = true ] ; then OPTIONS+=(--define "_verbose 1") fi OPTIONS+=(--define "_topdir ${WORK_DIR}") if [ "$DEBUG" = true ] ; then echo "rpmbuild --rebuild ${OPTIONS[@]} $SRPM" fi # rebuild RPM with hard-coded options in SRPM rpmbuild --rebuild "${OPTIONS[@]}" "$SRPM" rc=$? if [ $rc != 0 ]; then echo "ERROR: Unable to build RPM packages" exit 1 fi # install SRPM to restore sources and spec file removed during rebuild rpm -i --define "_topdir $WORK_DIR" "$SRPM" # flatten folder find "$WORK_DIR/RPMS" -mindepth 2 -type f -exec mv -i '{}' "$WORK_DIR/RPMS" ';' # remove empty subfolders find "$WORK_DIR/RPMS" -mindepth 1 -type d -delete echo "RPM packages:" find "$WORK_DIR/RPMS" -type f -printf " %p\n" tomcatjss-8.0.0/build.xml000066400000000000000000000241011412550020300153350ustar00rootroot00000000000000 tomcatjss-8.0.0/build_tomcatjss000077500000000000000000000021341412550020300166320ustar00rootroot00000000000000#! /bin/bash # This script may ONLY be run on Linux! OS=`uname` if [ ${OS} != "Linux" ]; then printf "The '$0' script is ONLY executable on a 'Linux' machine!\n" exit 255 fi # If Fedora, retrieve the release if [ -f /etc/fedora-release ]; then FEDORA_RELEASE=`cat /etc/fedora-release | awk {'print $3'}` fi ARCH=`uname -p` if [ "${ARCH}" = "x86_64" ]; then if [ -f /etc/fedora-release ] && [ ${FEDORA_RELEASE} -ge 19 ]; then JNIDIR=/usr/lib/java elif [ -f /etc/fedora-release ] && [ ${FEDORA_RELEASE} -ge 16 ]; then JNIDIR=/usr/lib64/java else JNIDIR=/usr/lib/java fi elif [ ${ARCH} != "i686" ] || [ ${ARCH} != "i586" ] || [ ${ARCH} != "i486" ] || [ ${ARCH} != "i386" ]; then JNIDIR=/usr/lib/java else printf "The '$0' script is NOT executable on the '${ARCH}' architecture!\n" exit 255 fi if [ -f /etc/fedora-release ]; then # Script is being run on Fedora ant -f build.xml -Drhel=0 -Djnidir=${JNIDIR} -Dspecfile=tomcatjss.spec rpms elif [ -f /etc/redhat-release ]; then # Script is being run on RHEL ant -f build.xml -Drhel=1 -Djnidir=${JNIDIR} -Dspecfile=tomcatjss.spec rpms fi tomcatjss-8.0.0/core/000077500000000000000000000000001412550020300144465ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/000077500000000000000000000000001412550020300152355ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/000077500000000000000000000000001412550020300161615ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/000077500000000000000000000000001412550020300171025ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/000077500000000000000000000000001412550020300176715ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/apache/000077500000000000000000000000001412550020300211125ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/apache/tomcat/000077500000000000000000000000001412550020300224015ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/apache/tomcat/util/000077500000000000000000000000001412550020300233565ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/apache/tomcat/util/net/000077500000000000000000000000001412550020300241445ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/apache/tomcat/util/net/jss/000077500000000000000000000000001412550020300247435ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/apache/tomcat/util/net/jss/IPasswordStore.java000066400000000000000000000025141412550020300305400ustar00rootroot00000000000000/* BEGIN COPYRIGHT BLOCK * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Copyright (C) 2007 Red Hat, Inc. * All rights reserved. * END COPYRIGHT BLOCK */ package org.apache.tomcat.util.net.jss; import java.io.IOException; import java.util.Enumeration; public interface IPasswordStore { public void init(String pwdPath) throws IOException; public String getPassword(String tag, int iteration); public String getPassword(String tag); public Enumeration getTags(); public Object putPassword(String tag, String password); public void commit() throws IOException, ClassCastException, NullPointerException; } tomcatjss-8.0.0/core/src/main/java/org/apache/tomcat/util/net/jss/PlainPasswordFile.java000066400000000000000000000127401412550020300312000ustar00rootroot00000000000000/* BEGIN COPYRIGHT BLOCK * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Copyright (C) 2007 Red Hat, Inc. * All rights reserved. * END COPYRIGHT BLOCK */ package org.apache.tomcat.util.net.jss; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Enumeration; import java.util.Properties; public class PlainPasswordFile implements IPasswordStore { private String mPwdPath = ""; private Properties mPwdStore; private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PlainPasswordFile.class); public PlainPasswordFile() { mPwdStore = new Properties(); } /** * Initialization method to read passwords(key and element pairs) from a file. *

* Every property occupies one line of the input stream. Each line is terminated by a line terminator ( * \n or \r or \r\n). Lines are processed until end of * file is reached. *

* A line that contains only whitespace or whose first non-whitespace character is an ASCII # * is ignored (thus, # indicates comment line). *

* Every line other than a blank line or a comment line describes one property to be added to the table. * The characters before the delimiter = forms the key and the characters after * the = is assigned as value to the key. *

* As an example, each of the following lines specify the key "Truth" and the associated element * value "Beauty": *

* *

     * Truth = Beauty
     * Truth= Beauty
     * Truth                    =Beauty
     * 
* *

* Note that the space appearing before/after = is ignored. However, the space appearing in between are * stored. *

* Example: * *

     * Welcome Message  = Hello World
     * 
* * assigns value Hello World to key Welcome Message *

* * If the line doesn't have the delimiter =, the method throws an IOException * * @param pwdPath the input file path. * @exception IOException if an error occurred when reading from the * input stream. */ @Override public void init(String pwdPath) throws IOException { logger.debug("PlainPasswordFile: Initializing PlainPasswordFile"); // initialize mPwdStore mPwdPath = pwdPath; try (FileInputStream file = new FileInputStream(mPwdPath); InputStreamReader isr = new InputStreamReader(file); BufferedReader br = new BufferedReader(isr)) { String line; int index = 1; while ((line = br.readLine()) != null) { // Remove any leading or trailing spaces line = line.trim(); if (line.startsWith("#") || line.isEmpty()) continue; String[] parts = line.split("=", 2); if (parts.length < 2) { throw new IOException("Missing delimiter '=' in file " + mPwdPath + " in line " + index); } // Load key value into the password store mPwdStore.put(parts[0].trim(), parts[1].trim()); index++; } } } @Override public String getPassword(String tag) { return getPassword(tag, 0); } @Override public String getPassword(String tag, int iteration) { return mPwdStore.getProperty(tag); } // return an array of String-based tag @Override @SuppressWarnings("unchecked") public Enumeration getTags() { return (Enumeration) mPwdStore.propertyNames(); } @Override public Object putPassword(String tag, String password) { return mPwdStore.setProperty(tag, password); } @Override public synchronized void commit() throws IOException, ClassCastException, NullPointerException { try (FileOutputStream file = new FileOutputStream(mPwdPath); OutputStreamWriter osw = new OutputStreamWriter(file); BufferedWriter bw = new BufferedWriter(osw)) { for (Enumeration e = mPwdStore.keys(); e.hasMoreElements();) { String key = ((String) e.nextElement()).trim(); String val = ((String) mPwdStore.get(key)).trim(); bw.write(key + "=" + val); bw.newLine(); } } } public int getSize() { return mPwdStore.size(); } } tomcatjss-8.0.0/core/src/main/java/org/apache/tomcat/util/net/jss/TomcatJSS.java000066400000000000000000000443361412550020300274270ustar00rootroot00000000000000/* BEGIN COPYRIGHT BLOCK * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Copyright (C) 2017 Red Hat, Inc. * All rights reserved. * END COPYRIGHT BLOCK */ package org.apache.tomcat.util.net.jss; import java.io.File; import java.io.FileReader; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; import org.apache.commons.lang3.StringUtils; import org.mozilla.jss.CryptoManager; import org.mozilla.jss.InitializationValues; import org.mozilla.jss.crypto.AlreadyInitializedException; import org.mozilla.jss.crypto.CryptoToken; import org.mozilla.jss.ssl.SSLAlertEvent; import org.mozilla.jss.ssl.SSLHandshakeCompletedEvent; import org.mozilla.jss.ssl.SSLServerSocket; import org.mozilla.jss.ssl.SSLSocketListener; import org.mozilla.jss.util.IncorrectPasswordException; import org.mozilla.jss.util.Password; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; public class TomcatJSS implements SSLSocketListener { public static Logger logger = LoggerFactory.getLogger(TomcatJSS.class); public final static TomcatJSS INSTANCE = new TomcatJSS(); public static final int MAX_LOGIN_ATTEMPTS = 3; public static TomcatJSS getInstance() { return INSTANCE; } Collection socketListeners = new ArrayList<>(); String certdbDir; CryptoManager manager; String passwordClass; String passwordFile; IPasswordStore passwordStore; String serverCertNickFile; String serverCertNick; String clientAuth = "want"; boolean requireClientAuth; boolean wantClientAuth; boolean enableOCSP; String ocspResponderURL; String ocspResponderCertNickname; int ocspCacheSize = 1000; // entries int ocspMinCacheEntryDuration = 3600; // seconds (default: 1 hour) int ocspMaxCacheEntryDuration = 86400; // seconds (default: 24 hours) int ocspTimeout = 60; // seconds (default: 1 minute) String strictCiphers; boolean boolStrictCiphers; String sslRangeCiphers; String sslOptions; String ssl2Ciphers; String ssl3Ciphers; String tlsCiphers; boolean initialized; public void addSocketListener(SSLSocketListener listener) { socketListeners.add(listener); } public void removeSocketListener(SSLSocketListener listener) { socketListeners.remove(listener); } public Collection getSocketListeners() { return socketListeners; } public String getCertdbDir() { return certdbDir; } public void setCertdbDir(String certdbDir) { this.certdbDir = certdbDir; } public String getPasswordClass() { return passwordClass; } public void setPasswordClass(String passwordClass) { this.passwordClass = passwordClass; } public String getPasswordFile() { return passwordFile; } public void setPasswordFile(String passwordFile) { this.passwordFile = passwordFile; } public String getServerCertNickFile() { return serverCertNickFile; } public IPasswordStore getPasswordStore() { return passwordStore; } public void setPasswordStore(IPasswordStore passwordStore) { this.passwordStore = passwordStore; } public void setServerCertNickFile(String serverCertNickFile) { this.serverCertNickFile = serverCertNickFile; } public String getServerCertNick() { return serverCertNick; } public void setServerCertNick(String serverCertNick) { this.serverCertNick = serverCertNick; } public String getClientAuth() { return clientAuth; } public void setClientAuth(String clientAuth) { this.clientAuth = clientAuth; } public boolean getRequireClientAuth() { return requireClientAuth; } public boolean getWantClientAuth() { return wantClientAuth; } public boolean getEnableOCSP() { return enableOCSP; } public void setEnableOCSP(boolean enableOCSP) { this.enableOCSP = enableOCSP; } public String getOcspResponderURL() { return ocspResponderURL; } public void setOcspResponderURL(String ocspResponderURL) { this.ocspResponderURL = ocspResponderURL; } public String getOcspResponderCertNickname() { return ocspResponderCertNickname; } public void setOcspResponderCertNickname(String ocspResponderCertNickname) { this.ocspResponderCertNickname = ocspResponderCertNickname; } public int getOcspCacheSize() { return ocspCacheSize; } public void setOcspCacheSize(int ocspCacheSize) { this.ocspCacheSize = ocspCacheSize; } public int getOcspMinCacheEntryDuration() { return ocspMinCacheEntryDuration; } public void setOcspMinCacheEntryDuration(int ocspMinCacheEntryDuration) { this.ocspMinCacheEntryDuration = ocspMinCacheEntryDuration; } public int getOcspMaxCacheEntryDuration() { return ocspMaxCacheEntryDuration; } public void setOcspMaxCacheEntryDuration(int ocspMaxCacheEntryDuration) { this.ocspMaxCacheEntryDuration = ocspMaxCacheEntryDuration; } public int getOcspTimeout() { return ocspTimeout; } public void setOcspTimeout(int ocspTimeout) { this.ocspTimeout = ocspTimeout; } public void loadJSSConfig(String jssConf) throws Exception { File configFile = new File(jssConf); loadJSSConfig(configFile); } public void loadJSSConfig(File configFile) throws Exception { Properties config = new Properties(); config.load(new FileReader(configFile)); loadJSSConfig(config); } public void loadJSSConfig(Properties config) throws Exception { String certDb = config.getProperty("certdbDir"); if (certDb != null) setCertdbDir(certDb); String passwordClass = config.getProperty("passwordClass"); if (passwordClass != null) setPasswordClass(passwordClass); String passwordFile = config.getProperty("passwordFile"); if (passwordFile != null) setPasswordFile(passwordFile); String enableOCSP = config.getProperty("enableOCSP"); if (enableOCSP != null) setEnableOCSP(Boolean.parseBoolean(enableOCSP)); String ocspResponderURL = config.getProperty("ocspResponderURL"); if (ocspResponderURL != null) setOcspResponderURL(ocspResponderURL); String ocspResponderCertNickname = config.getProperty("ocspResponderCertNickname"); if (ocspResponderCertNickname != null) setOcspResponderCertNickname(ocspResponderCertNickname); String ocspCacheSize = config.getProperty("ocspCacheSize"); if (StringUtils.isNotEmpty(ocspCacheSize)) setOcspCacheSize(Integer.parseInt(ocspCacheSize)); String ocspMinCacheEntryDuration = config.getProperty("ocspMinCacheEntryDuration"); if (StringUtils.isNotEmpty(ocspMinCacheEntryDuration)) setOcspMinCacheEntryDuration(Integer.parseInt(ocspMinCacheEntryDuration)); String ocspMaxCacheEntryDuration = config.getProperty("ocspMaxCacheEntryDuration"); if (StringUtils.isNotEmpty(ocspMaxCacheEntryDuration)) setOcspMaxCacheEntryDuration(Integer.parseInt(ocspMaxCacheEntryDuration)); String ocspTimeout = config.getProperty("ocspTimeout"); if (StringUtils.isNotEmpty(ocspTimeout)) setOcspTimeout(Integer.parseInt(ocspTimeout)); } public void loadTomcatConfig(String serverXml) throws Exception { File configFile = new File(serverXml); loadTomcatConfig(configFile); } public void loadTomcatConfig(File configFile) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(configFile); loadTomcatConfig(document); } public void loadTomcatConfig(Document document) throws Exception { XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); Element connector = (Element) xpath.evaluate( "/Server/Service[@name='Catalina']/Connector[@SSLEnabled='true']", document, XPathConstants.NODE); String certDb = connector.getAttribute("certdbDir"); if (certDb != null) setCertdbDir(certDb); String passwordClass = connector.getAttribute("passwordClass"); if (passwordClass != null) setPasswordClass(passwordClass); String passwordFile = connector.getAttribute("passwordFile"); if (passwordFile != null) setPasswordFile(passwordFile); String serverCertNickFile = connector.getAttribute("serverCertNickFile"); if (serverCertNickFile != null) setServerCertNickFile(serverCertNickFile); String enableOCSP = connector.getAttribute("enableOCSP"); if (enableOCSP != null) setEnableOCSP(Boolean.parseBoolean(enableOCSP)); String ocspResponderURL = connector.getAttribute("ocspResponderURL"); if (ocspResponderURL != null) setOcspResponderURL(ocspResponderURL); String ocspResponderCertNickname = connector.getAttribute("ocspResponderCertNickname"); if (ocspResponderCertNickname != null) setOcspResponderCertNickname(ocspResponderCertNickname); String ocspCacheSize = connector.getAttribute("ocspCacheSize"); if (StringUtils.isNotEmpty(ocspCacheSize)) setOcspCacheSize(Integer.parseInt(ocspCacheSize)); String ocspMinCacheEntryDuration = connector.getAttribute("ocspMinCacheEntryDuration"); if (StringUtils.isNotEmpty(ocspMinCacheEntryDuration)) setOcspMinCacheEntryDuration(Integer.parseInt(ocspMinCacheEntryDuration)); String ocspMaxCacheEntryDuration = connector.getAttribute("ocspMaxCacheEntryDuration"); if (StringUtils.isNotEmpty(ocspMaxCacheEntryDuration)) setOcspMaxCacheEntryDuration(Integer.parseInt(ocspMaxCacheEntryDuration)); String ocspTimeout = connector.getAttribute("ocspTimeout"); if (StringUtils.isNotEmpty(ocspTimeout)) setOcspTimeout(Integer.parseInt(ocspTimeout)); } /** * Load configuration from jss.conf (if available) or server.xml. */ public void loadConfig() throws Exception { String catalinaBase = System.getProperty("catalina.base"); String jssConf = catalinaBase + "/conf/jss.conf"; File configFile = new File(jssConf); if (configFile.exists()) { logger.info("TomcatJSS: Loading JSS configuration from " + jssConf); loadJSSConfig(configFile); } else { String serverXml = catalinaBase + "/conf/server.xml"; logger.info("TomcatJSS: Loading JSS configuration from " + serverXml); loadTomcatConfig(serverXml); } } public void init() throws Exception { if (initialized) { return; } logger.info("TomcatJSS: initialization"); if (certdbDir == null) { certdbDir = System.getProperty("catalina.base") + File.separator + "alias"; } logger.debug("TomcatJSS: certdbDir: " + certdbDir); if (passwordClass == null) { passwordClass = PlainPasswordFile.class.getName(); } logger.debug("TomcatJSS: passwordClass: " + passwordClass); if (passwordFile == null) { passwordFile = System.getProperty("catalina.base") + File.separator + "conf" + File.separator + "password.conf"; } logger.debug("TomcatJSS: passwordFile: " + passwordFile); if (serverCertNickFile != null) { logger.debug("TomcatJSS: serverCertNickFile: " + serverCertNickFile); } InitializationValues vals = new InitializationValues(certdbDir); vals.removeSunProvider = false; vals.installJSSProvider = true; try { CryptoManager.initialize(vals); } catch (AlreadyInitializedException e) { logger.warn("TomcatJSS: " + e); } manager = CryptoManager.getInstance(); passwordStore = (IPasswordStore) Class.forName(passwordClass).newInstance(); passwordStore.init(passwordFile); login(); if (serverCertNickFile != null) { serverCertNick = new String(Files.readAllBytes(Paths.get(serverCertNickFile))).trim(); logger.debug("serverCertNick: " + serverCertNick); } logger.debug("clientAuth: " + clientAuth); if (clientAuth.equalsIgnoreCase("true")) { requireClientAuth = true; } else if (clientAuth.equalsIgnoreCase("yes")) { requireClientAuth = true; logger.warn("The \"yes\" value for clientAuth has been deprecated. Use \"true\" instead."); } else if (clientAuth.equalsIgnoreCase("want")) { wantClientAuth = true; } logger.debug("requireClientAuth: " + requireClientAuth); logger.debug("wantClientAuth: " + wantClientAuth); if (requireClientAuth || wantClientAuth) { configureOCSP(); } // 12 hours = 43200 seconds SSLServerSocket.configServerSessionIDCache(0, 43200, 43200, null); logger.info("TomcatJSS: initialization complete"); initialized = true; } public void login() throws Exception { logger.debug("TomcatJSS: logging into tokens"); Enumeration tags = passwordStore.getTags(); while (tags.hasMoreElements()) { String tag = tags.nextElement(); if (!tag.equals("internal") && !tag.startsWith("hardware-")) { continue; } login(tag); } } public void login(String tag) throws Exception { CryptoToken token = getToken(tag); if (token.isLoggedIn()) { logger.debug("TomcatJSS: already logged into " + tag); return; } logger.debug("TomcatJSS: logging into " + tag); int iteration = 0; do { String strPassword = passwordStore.getPassword(tag, iteration); if (strPassword == null) { logger.debug("TomcatJSS: no password for " + tag); return; } Password password = new Password(strPassword.toCharArray()); try { token.login(password); return; } catch (IncorrectPasswordException e) { logger.warn("TomcatJSS: incorrect password"); iteration ++; } finally { password.clear(); } } while (iteration < MAX_LOGIN_ATTEMPTS); logger.error("TomcatJSS: failed to log into " + tag); } public CryptoToken getToken(String tag) throws Exception { if (tag.equals("internal")) { return manager.getInternalKeyStorageToken(); } if (tag.startsWith("hardware-")) { String tokenName = tag.substring(9); return manager.getTokenByName(tokenName); } // non-token password entry return null; } public void configureOCSP() throws Exception { logger.info("configuring OCSP"); logger.debug("enableOCSP: " + enableOCSP); if (!enableOCSP) { return; } logger.debug("ocspResponderURL: " + ocspResponderURL); if (StringUtils.isEmpty(ocspResponderURL)) { ocspResponderURL = null; } logger.debug("ocspResponderCertNickname: " + ocspResponderCertNickname); if (StringUtils.isEmpty(ocspResponderCertNickname)) { ocspResponderCertNickname = null; } // Check to see if the ocsp url and nickname are both set or not set if (ocspResponderURL == null && ocspResponderCertNickname != null) { throw new Exception("Missing OCSP responder URL"); } if (ocspResponderURL != null && ocspResponderCertNickname == null) { throw new Exception("Missing OCSP responder certificate nickname"); } manager.configureOCSP( true, ocspResponderURL, ocspResponderCertNickname); logger.debug("ocspCacheSize: " + ocspCacheSize); logger.debug("ocspMinCacheEntryDuration: " + ocspMinCacheEntryDuration); logger.debug("ocspMaxCacheEntryDuration: " + ocspMaxCacheEntryDuration); manager.OCSPCacheSettings(ocspCacheSize, ocspMinCacheEntryDuration, ocspMaxCacheEntryDuration); logger.debug("ocspTimeout: " + ocspTimeout); manager.setOCSPTimeout(ocspTimeout); } @Override public void alertReceived(SSLAlertEvent event) { for (SSLSocketListener listener : socketListeners) { listener.alertReceived(event); } } @Override public void alertSent(SSLAlertEvent event) { for (SSLSocketListener listener : socketListeners) { listener.alertSent(event); } } @Override public void handshakeCompleted(SSLHandshakeCompletedEvent event) { for (SSLSocketListener listener : socketListeners) { listener.handshakeCompleted(event); } } } tomcatjss-8.0.0/core/src/main/java/org/dogtagpki/000077500000000000000000000000001412550020300216425ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/dogtagpki/tomcat/000077500000000000000000000000001412550020300231315ustar00rootroot00000000000000tomcatjss-8.0.0/core/src/main/java/org/dogtagpki/tomcat/Http11NioProtocol.java000066400000000000000000000070301412550020300272450ustar00rootroot00000000000000package org.dogtagpki.tomcat; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import org.apache.tomcat.util.net.jss.TomcatJSS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Http11NioProtocol extends org.apache.coyote.http11.Http11NioProtocol { public static Logger logger = LoggerFactory.getLogger(Http11NioProtocol.class); TomcatJSS tomcatjss = TomcatJSS.getInstance(); public String getCertdbDir() { return tomcatjss.getCertdbDir(); } public void setCertdbDir(String certdbDir) { tomcatjss.setCertdbDir(certdbDir); } public String getPasswordClass() { return tomcatjss.getPasswordClass(); } public void setPasswordClass(String passwordClass) { tomcatjss.setPasswordClass(passwordClass); } public String getPasswordFile() { return tomcatjss.getPasswordFile(); } public void setPasswordFile(String passwordFile) { tomcatjss.setPasswordFile(passwordFile); } public String getServerCertNickFile() { return tomcatjss.getServerCertNickFile(); } public void setServerCertNickFile(String serverCertNickFile) { tomcatjss.setServerCertNickFile(serverCertNickFile); } public boolean getEnabledOCSP() { return tomcatjss.getEnableOCSP(); } public void setEnableOCSP(boolean enableOCSP) { tomcatjss.setEnableOCSP(enableOCSP); } public String getOcspResponderURL() { return tomcatjss.getOcspResponderURL(); } public void setOcspResponderURL(String ocspResponderURL) { tomcatjss.setOcspResponderURL(ocspResponderURL); } public String getOcspResponderCertNickname() { return tomcatjss.getOcspResponderCertNickname(); } public void setOcspResponderCertNickname(String ocspResponderCertNickname) { tomcatjss.setOcspResponderCertNickname(ocspResponderCertNickname); } public int getOcspCacheSize() { return tomcatjss.getOcspCacheSize(); } public void setOcspCacheSize(int ocspCacheSize) { tomcatjss.setOcspCacheSize(ocspCacheSize); } public int getOcspMinCacheEntryDuration() { return tomcatjss.getOcspMinCacheEntryDuration(); } public void setOcspMinCacheEntryDuration(int ocspMinCacheEntryDuration) { tomcatjss.setOcspMinCacheEntryDuration(ocspMinCacheEntryDuration); } public int getOcspMaxCacheEntryDuration() { return tomcatjss.getOcspMaxCacheEntryDuration(); } public void setOcspMaxCacheEntryDuration(int ocspMaxCacheEntryDuration) { tomcatjss.setOcspMaxCacheEntryDuration(ocspMaxCacheEntryDuration); } public int getOcspTimeout() { return tomcatjss.getOcspTimeout(); } public void setOcspTimeout(int ocspTimeout) { tomcatjss.setOcspTimeout(ocspTimeout); } public void setKeystorePassFile(String keystorePassFile) { try { Path path = Paths.get(keystorePassFile); String password = new String(Files.readAllBytes(path)).trim(); setKeystorePass(password); } catch (IOException e) { throw new RuntimeException(e); } } public void setTruststorePassFile(String truststorePassFile) { try { Path path = Paths.get(truststorePassFile); String password = new String(Files.readAllBytes(path)).trim(); setTruststorePass(password); } catch (IOException e) { throw new RuntimeException(e); } } } tomcatjss-8.0.0/core/src/main/java/org/dogtagpki/tomcat/JSSListener.java000066400000000000000000000036701412550020300261470ustar00rootroot00000000000000/* BEGIN COPYRIGHT BLOCK * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Copyright (C) 2019 Red Hat, Inc. * All rights reserved. * END COPYRIGHT BLOCK */ package org.dogtagpki.tomcat; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; import org.apache.tomcat.util.net.jss.TomcatJSS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class JSSListener implements LifecycleListener { final static Logger logger = LoggerFactory.getLogger(JSSListener.class); public String configFile; public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } @Override public void lifecycleEvent(LifecycleEvent event) { String type = event.getType(); if (type.equals(Lifecycle.BEFORE_INIT_EVENT)) { initJSS(); } } public void initJSS() { logger.info("JSSListener: Initializing JSS"); try { TomcatJSS tomcatjss = TomcatJSS.getInstance(); tomcatjss.loadConfig(); tomcatjss.init(); } catch (Exception e) { throw new RuntimeException(e); } } } tomcatjss-8.0.0/docs/000077500000000000000000000000001412550020300144465ustar00rootroot00000000000000tomcatjss-8.0.0/docs/development/000077500000000000000000000000001412550020300167705ustar00rootroot00000000000000tomcatjss-8.0.0/docs/development/Synchronizing-GitLab-Branch.adoc000066400000000000000000000033661412550020300250270ustar00rootroot00000000000000= Synchronizing GitLab Branch = == Overview == This page describes the procedure to synchronize a branch from an upstream repository to a GitLab repository. == Creating Access Token == In the GitLab repository create a project access token with a **write_repository** permission. See link:https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html#creating-a-project-access-token[Creating a project access token]. == Configuring Synchronization == In the GitLab repository create the following variables: * `UPSTREAM_URL`: The URL of the upstream repository. ** Unselect **Protect variable** to synchronize unprotected branches. * `ACCESS_TOKEN`: The value of the access token. ** Unselect **Protect variable** to synchronize unprotected branches. ** Select **Mask variable** to keep the access token hidden. See link:https://docs.gitlab.com/ee/ci/variables/#add-a-cicd-variable-to-a-project[Add a CI/CD variable to a project]. == Running Synchronization Manually == In the GitLab repository run a pipeline with the following parameters: * **Run for branch name or tag**: The branch to be synchronized. * **Variables**: ** `SYNC`: `true` See link:https://docs.gitlab.com/ee/ci/pipelines/#run-a-pipeline-manually[Run a pipeline manually]. == Scheduling Automatic Synchronization == In the GitLab repository create a schedule with the following parameters: * **Interval Pattern**: The frequency of synchronization. ** To synchronize every hour, enter: `0 * * * *` * **Target Branch**: The branch to be synchronized. * **Variables**: ** `SYNC`: `true` Additional schedules can be created for synchronizing other branches. See link:https://docs.gitlab.com/ee/ci/pipelines/schedules.html#configuring-pipeline-schedules[Configuring pipeline schedules]. tomcatjss-8.0.0/rhel.properties000066400000000000000000000000071412550020300165630ustar00rootroot00000000000000rhel=1 tomcatjss-8.0.0/tests/000077500000000000000000000000001412550020300146605ustar00rootroot00000000000000tomcatjss-8.0.0/tests/bin/000077500000000000000000000000001412550020300154305ustar00rootroot00000000000000tomcatjss-8.0.0/tests/bin/ds-artifacts-save.sh000077500000000000000000000007611412550020300213130ustar00rootroot00000000000000#!/bin/bash CONTAINER=$1 INSTANCE=$2 if [ "$INSTANCE" == "" ] then INSTANCE=localhost fi ARTIFACTS=/tmp/artifacts/$CONTAINER mkdir -p $ARTIFACTS/etc mkdir -p $ARTIFACTS/var/log docker exec $CONTAINER ls -la /etc/dirsrv docker cp $CONTAINER:/etc/dirsrv $ARTIFACTS/etc docker exec $CONTAINER ls -la /var/log/dirsrv docker cp $CONTAINER:/var/log/dirsrv $ARTIFACTS/var/log docker exec $CONTAINER journalctl -u dirsrv@$INSTANCE.service > $ARTIFACTS/var/log/dirsrv/slapd-$INSTANCE/systemd.log tomcatjss-8.0.0/tests/bin/ds-create.sh000077500000000000000000000011321412550020300176330ustar00rootroot00000000000000#!/bin/bash -ex # This command needs to be executed as it pulls the machine name # dynamically. dscreate create-template ds.inf sed -i \ -e "s/;instance_name = .*/instance_name = localhost/g" \ -e "s/;root_password = .*/root_password = Secret.123/g" \ -e "s/;suffix = .*/suffix = dc=example,dc=com/g" \ -e "s/;self_sign_cert = .*/self_sign_cert = False/g" \ ds.inf dscreate from-file ds.inf ldapadd -h $HOSTNAME -x -D "cn=Directory Manager" -w Secret.123 << EOF dn: dc=example,dc=com objectClass: domain dc: example dn: dc=pki,dc=example,dc=com objectClass: domain dc: pki EOF tomcatjss-8.0.0/tests/bin/ds-remove.sh000077500000000000000000000000661412550020300176720ustar00rootroot00000000000000#!/bin/bash -ex dsctl slapd-localhost remove --do-it tomcatjss-8.0.0/tests/bin/init-workflow.sh000077500000000000000000000005651412550020300206100ustar00rootroot00000000000000#!/bin/bash -e if [ "$BASE64_MATRIX" == "" ] then MATRIX="{\"os\":[\"latest\"]}" else MATRIX=$(echo "$BASE64_MATRIX" | base64 -d) fi echo "MATRIX: $MATRIX" echo "::set-output name=matrix::$MATRIX" if [ "$BASE64_REPO" == "" ] then REPO="@pki/master" else REPO=$(echo "$BASE64_REPO" | base64 -d) fi echo "REPO: $REPO" echo "::set-output name=repo::$REPO" tomcatjss-8.0.0/tests/bin/pki-artifacts-save.sh000077500000000000000000000010561412550020300214660ustar00rootroot00000000000000#!/bin/bash CONTAINER=$1 INSTANCE=$2 if [ "$INSTANCE" == "" ] then INSTANCE=pki-tomcat fi ARTIFACTS=/tmp/artifacts/$CONTAINER mkdir -p $ARTIFACTS/etc/pki mkdir -p $ARTIFACTS/var/log docker exec $CONTAINER ls -la /etc/pki docker cp $CONTAINER:/etc/pki/pki.conf $ARTIFACTS/etc/pki docker cp $CONTAINER:/etc/pki/$INSTANCE $ARTIFACTS/etc/pki docker exec $CONTAINER ls -la /var/log/pki docker cp $CONTAINER:/var/log/pki $ARTIFACTS/var/log docker exec $CONTAINER journalctl -u pki-tomcatd@$INSTANCE.service > $ARTIFACTS/var/log/pki/$INSTANCE/systemd.log tomcatjss-8.0.0/tests/bin/runner-init.sh000077500000000000000000000010031412550020300202330ustar00rootroot00000000000000#!/bin/bash -ex docker run \ --name=${NAME} \ --hostname=${HOSTNAME} \ --detach \ --privileged \ --tmpfs /tmp \ --tmpfs /run \ -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ -v ${GITHUB_WORKSPACE}:${SHARED} \ -i \ ${IMAGE} # Pause 5 seconds to let the container start up. # The container uses /usr/sbin/init as its entrypoint which requires few seconds # to startup. This avoids the following error: # [Errno 2] No such file or directory: '/var/cache/dnf/metadata_lock.pid' sleep 5 tomcatjss-8.0.0/tomcat-9.0/000077500000000000000000000000001412550020300153115ustar00rootroot00000000000000tomcatjss-8.0.0/tomcat-9.0/src/000077500000000000000000000000001412550020300161005ustar00rootroot00000000000000tomcatjss-8.0.0/tomcat-9.0/src/main/000077500000000000000000000000001412550020300170245ustar00rootroot00000000000000tomcatjss-8.0.0/tomcat-9.0/src/main/java/000077500000000000000000000000001412550020300177455ustar00rootroot00000000000000tomcatjss-8.0.0/tomcat-9.0/src/main/java/org/000077500000000000000000000000001412550020300205345ustar00rootroot00000000000000tomcatjss-8.0.0/tomcat-9.0/src/main/java/org/dogtagpki/000077500000000000000000000000001412550020300225055ustar00rootroot00000000000000tomcatjss-8.0.0/tomcat-9.0/src/main/java/org/dogtagpki/tomcat/000077500000000000000000000000001412550020300237745ustar00rootroot00000000000000tomcatjss-8.0.0/tomcat-9.0/src/main/java/org/dogtagpki/tomcat/JSSContext.java000066400000000000000000000073111412550020300266450ustar00rootroot00000000000000package org.dogtagpki.tomcat; import java.security.KeyManagementException; import java.security.SecureRandom; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import org.mozilla.jss.JSSProvider; import org.mozilla.jss.provider.javax.crypto.JSSKeyManager; import org.mozilla.jss.provider.javax.crypto.JSSTrustManager; import org.mozilla.jss.ssl.javax.JSSEngine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class JSSContext implements org.apache.tomcat.util.net.SSLContext { public static Logger logger = LoggerFactory.getLogger(JSSContext.class); private javax.net.ssl.SSLContext ctx; private String alias; private JSSKeyManager jkm; private JSSTrustManager jtm; public JSSContext(String alias) { logger.debug("JSSContext(" + alias + ")"); this.alias = alias; /* These KeyManagers and TrustManagers aren't used with the SSLEngine; * they're only used to implement certain function calls below. */ try { KeyManagerFactory kmf = KeyManagerFactory.getInstance("NssX509", "Mozilla-JSS"); jkm = (JSSKeyManager) kmf.getKeyManagers()[0]; TrustManagerFactory tmf = TrustManagerFactory.getInstance("NssX509", "Mozilla-JSS"); jtm = (JSSTrustManager) tmf.getTrustManagers()[0]; } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } @Override public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr) throws KeyManagementException { logger.debug("JSSContext.init(...)"); try { String provider = "SunJSSE"; if (JSSProvider.ENABLE_JSSENGINE) { provider = "Mozilla-JSS"; } ctx = javax.net.ssl.SSLContext.getInstance("TLS", provider); ctx.init(kms, tms, sr); } catch (Exception e) { throw new KeyManagementException(e.getMessage(), e); } } @Override public javax.net.ssl.SSLEngine createSSLEngine() { logger.debug("JSSContext.createSSLEngine()"); javax.net.ssl.SSLEngine eng = ctx.createSSLEngine(); if (eng instanceof JSSEngine) { JSSEngine j_eng = (JSSEngine) eng; j_eng.setCertFromAlias(alias); } return eng; } @Override public javax.net.ssl.SSLSessionContext getServerSessionContext() { logger.debug("JSSContext.getServerSessionContext()"); return ctx.getServerSessionContext(); } @Override public javax.net.ssl.SSLServerSocketFactory getServerSocketFactory() { logger.debug("JSSContext.getServerSocketFactory()"); return ctx.getServerSocketFactory(); } @Override public javax.net.ssl.SSLParameters getSupportedSSLParameters() { logger.debug("JSSContext.getSupportedSSLParameters()"); return ctx.getSupportedSSLParameters(); } @Override public java.security.cert.X509Certificate[] getCertificateChain(java.lang.String alias) { logger.debug("JSSContext.getCertificateChain(" + alias + ")"); try { return jkm.getCertificateChain(alias); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { logger.debug("JSSContext.getAcceptedIssuers()"); try { return jtm.getAcceptedIssuers(); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } @Override public void destroy() { logger.debug("JSSContext.destory()"); } } tomcatjss-8.0.0/tomcat-9.0/src/main/java/org/dogtagpki/tomcat/JSSImplementation.java000066400000000000000000000050171412550020300302070ustar00rootroot00000000000000/* BEGIN COPYRIGHT BLOCK * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Copyright (C) 2007 Red Hat, Inc. * All rights reserved. * END COPYRIGHT BLOCK */ package org.dogtagpki.tomcat; import javax.net.ssl.SSLSession; import org.apache.tomcat.util.net.jsse.JSSESupport; import org.apache.tomcat.util.net.SSLHostConfig; import org.apache.tomcat.util.net.SSLHostConfigCertificate; import org.apache.tomcat.util.net.SSLImplementation; import org.apache.tomcat.util.net.SSLSupport; import org.apache.tomcat.util.net.SSLUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class JSSImplementation extends SSLImplementation { public static Logger logger = LoggerFactory.getLogger(JSSUtil.class); public JSSImplementation() { logger.debug("JSSImplementation: instance created"); } @Override public SSLSupport getSSLSupport(SSLSession session) { logger.debug("JSSImplementation.getSSLSupport()"); return new JSSESupport(session); } @Override public SSLUtil getSSLUtil(SSLHostConfigCertificate cert) { logger.debug("JSSImplementation: getSSLUtil()"); logger.debug("JSSImplementation: key alias: " + cert.getCertificateKeyAlias()); logger.debug("JSSImplementation: keystore provider: " + cert.getCertificateKeystoreProvider()); SSLHostConfig hostConfig = cert.getSSLHostConfig(); logger.debug("JSSImplementation: key manager alg: " + hostConfig.getKeyManagerAlgorithm()); logger.debug("JSSImplementation: truststore alg: " + hostConfig.getTruststoreAlgorithm()); logger.debug("JSSImplementation: truststore provider: " + hostConfig.getTruststoreProvider()); return new JSSUtil(cert); } @Override public boolean isAlpnSupported() { // NSS supports ALPN but JSS doesn't yet support ALPN. return false; } } tomcatjss-8.0.0/tomcat-9.0/src/main/java/org/dogtagpki/tomcat/JSSUtil.java000066400000000000000000000077601412550020300261460ustar00rootroot00000000000000/* BEGIN COPYRIGHT BLOCK * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Copyright (C) 2018 Red Hat, Inc. * All rights reserved. * END COPYRIGHT BLOCK */ package org.dogtagpki.tomcat; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLEngine; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.net.SSLContext; import org.apache.tomcat.util.net.SSLHostConfigCertificate; import org.apache.tomcat.util.net.SSLUtilBase; import org.mozilla.jss.JSSProvider; import org.mozilla.jss.provider.javax.crypto.JSSNativeTrustManager; public class JSSUtil extends SSLUtilBase { public static Log logger = LogFactory.getLog(JSSUtil.class); private String keyAlias; private SSLEngine engine; private Set protocols; private Set ciphers; public JSSUtil(SSLHostConfigCertificate cert) { super(cert); keyAlias = certificate.getCertificateKeyAlias(); logger.debug("JSSUtil: instance created"); } private void init() { if (engine != null) { return; } try { JSSContext ctx = new JSSContext(null); ctx.init(null, null, null); engine = ctx.createSSLEngine(); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } protocols = Collections.unmodifiableSet( new HashSet<>(Arrays.asList(engine.getSupportedProtocols())) ); ciphers = Collections.unmodifiableSet( new HashSet<>(Arrays.asList(engine.getSupportedCipherSuites())) ); } @Override public KeyManager[] getKeyManagers() throws Exception { logger.debug("JSSUtil: getKeyManagers()"); KeyManagerFactory jkm = KeyManagerFactory.getInstance("NssX509", "Mozilla-JSS"); return jkm.getKeyManagers(); } @Override public TrustManager[] getTrustManagers() throws Exception { logger.debug("JSSUtil: getTrustManagers()"); if (!JSSProvider.ENABLE_JSSENGINE) { TrustManagerFactory tmf = TrustManagerFactory.getInstance("NssX509"); return tmf.getTrustManagers(); } return new TrustManager[] { new JSSNativeTrustManager() }; } @Override public SSLContext createSSLContextInternal(List negotiableProtocols) throws Exception { logger.debug("JSSUtil createSSLContextInternal(...) keyAlias=" + keyAlias); return new JSSContext(keyAlias); } @Override public boolean isTls13RenegAuthAvailable() { logger.debug("JSSUtil: isTls13RenegAuthAvailable()"); return true; } @Override public Log getLog() { logger.debug("JSSUtil: getLog()"); return logger; } @Override protected Set getImplementedProtocols() { logger.debug("JSSUtil: getImplementedProtocols()"); init(); return protocols; } @Override protected Set getImplementedCiphers() { logger.debug("JSSUtil: getImplementedCiphers()"); init(); return ciphers; } } tomcatjss-8.0.0/tomcatjss.spec000066400000000000000000000107441412550020300164070ustar00rootroot00000000000000################################################################################ Name: tomcatjss ################################################################################ Summary: JSS Connector for Apache Tomcat URL: http://www.dogtagpki.org/wiki/TomcatJSS License: LGPLv2+ BuildArch: noarch # For development (i.e. unsupported) releases, use x.y.z-0.n.. # For official (i.e. supported) releases, use x.y.z-r where r >=1. Version: 8.0.0 Release: 1%{?_timestamp}%{?_commit_id}%{?dist} #global _phase -alpha1 # To generate the source tarball: # $ git clone https://github.com/dogtagpki/tomcatjss.git # $ cd tomcatjss # $ git archive \ # --format=tar.gz \ # --prefix tomcatjss-VERSION/ \ # -o tomcatjss-VERSION.tar.gz \ # Source: https://github.com/dogtagpki/tomcatjss/archive/v%{version}%{?_phase}/tomcatjss-%{version}%{?_phase}.tar.gz # To create a patch for all changes since a version tag: # $ git format-patch \ # --stdout \ # \ # > tomcatjss-VERSION-RELEASE.patch # Patch: tomcatjss-VERSION-RELEASE.patch ################################################################################ # Java ################################################################################ %define java_devel java-11-openjdk-devel %define java_headless java-11-openjdk-headless %define java_home /usr/lib/jvm/jre-11-openjdk ################################################################################ # Build Dependencies ################################################################################ # jpackage-utils requires versioning to meet both build and runtime requirements # jss requires versioning to meet both build and runtime requirements # tomcat requires versioning to meet both build and runtime requirements # Java BuildRequires: ant BuildRequires: apache-commons-lang3 BuildRequires: %{java_devel} BuildRequires: jpackage-utils >= 0:1.7.5-15 # SLF4J BuildRequires: slf4j BuildRequires: slf4j-jdk14 # JSS BuildRequires: jss >= 5.0.0 # Tomcat %if 0%{?rhel} && ! 0%{?eln} BuildRequires: pki-servlet-engine >= 1:9.0.7 %else BuildRequires: tomcat >= 1:9.0.7 %endif ################################################################################ # Runtime Dependencies ################################################################################ # Java Requires: apache-commons-lang3 Requires: %{java_headless} Requires: jpackage-utils >= 0:1.7.5-15 # SLF4J Requires: slf4j Requires: slf4j-jdk14 # JSS Requires: jss >= 5.0.0 # Tomcat %if 0%{?rhel} && ! 0%{?eln} Requires: pki-servlet-engine >= 1:9.0.7 %else Requires: tomcat >= 1:9.0.7 %endif # PKI Conflicts: pki-base < 10.10.0 %if 0%{?rhel} # For EPEL, override the '_sharedstatedir' macro on RHEL %define _sharedstatedir /var/lib %endif %description JSS Connector for Apache Tomcat, installed via the tomcatjss package, is a Java Secure Socket Extension (JSSE) module for Apache Tomcat that uses Java Security Services (JSS), a Java interface to Network Security Services (NSS). ################################################################################ %prep ################################################################################ %autosetup -n tomcatjss-%{version}%{?_phase} -p 1 ################################################################################ %install ################################################################################ # get Tomcat . version number tomcat_version=`/usr/sbin/tomcat version | sed -n 's/Server number: *\([0-9]\+\.[0-9]\+\).*/\1/p'` app_server=tomcat-$tomcat_version ant -f build.xml \ -Dversion=%{version} \ -Dsrc.dir=$app_server \ -Ddist.dir=%{_vpath_builddir} \ -Djnidir=%{_jnidir} \ -Dinstall.doc.dir=%{buildroot}%{_docdir}/%{name} \ -Dinstall.jar.dir=%{buildroot}%{_javadir} \ install ################################################################################ %files ################################################################################ %license LICENSE %defattr(-,root,root) %doc README %doc LICENSE %{_javadir}/* ################################################################################ %changelog * Thu Mar 15 2018 Dogtag PKI Team 7.3.0-0 - To list changes in since : $ git log --pretty=oneline --abbrev-commit --no-decorate ..