How do I set up Jetty 6 & Jboss 4.0.5 virtual hosting? - jboss

I have 2 webapps deployed in the same JBoss/Jetty server. In Jetty 5.1.14 I had the following jetty-web.xml which configured one of the apps to run as a virtual host (on the same port):
<Configure class="org.jboss.jetty.JBossWebApplicationContext">
<Call name="addVirtualHost"><Arg>app2.localhost.com</Arg></Call>
</Configure>
This worked perfectly fine. Unfortunately, it doesn't work with Jetty 6.1.17 at all. First of all, "JBossWebApplicationContext" seems to now be called "JBossWebAppContext", and secondly the documentation I could find suggests that I should be using a jetty-web.xml that looks like this:
<Configure class="org.jboss.jetty.JBossWebAppContext">
<Set name="VirtualHosts">
<Array type="java.lang.String">
<Item>app2.localhost.com</Item>
</Array>
</Set>
</Configure>
But this doesn't work either. The two webapps deploy without error, but when I try to access the 2nd app under the virtual hostname, it just accesses the first app instead. Both applications are in the root context (this is not negotiable).
How can I make virtual hosts work?
(BTW, I had a friend post this on serverfault a few days ago, but nobody answered.)

This syntax works if you include it in the jetty6-web.xml for each web-app.
<Configure class="org.jboss.jetty.JBossWebAppContext">
<Set name="VirtualHosts">
<Array type="java.lang.String">
<Item>host1.domain.com</Item>
<Item>host2.domain.com</Item>
</Array>
</Set>
</Configure>
ALL webapps need the virtual hosts defined if they are running in the same container. For some reason deploying one WAR with virtual hosts and one without doesn't work.

Related

ASP.NET Core 3.1 - "site can’t provide a secure connection" when setting application url using .UseUrls()

I'm running the app using "dotnet run". If I don't set the url programmatically using .UseUrls() then it picks it up from launchSettings.json and all good. However if I set THE SAME url using .UseUrls() I get the message below on the brower.
There are no errors from the code i.e. both cases report " Now listening on: http://localhost:6001". Any ideas?
Remove Strict-Transport-Security from your Web.config
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Strict-Transport-Security"
value="max-age=16070400; includeSubDomains" />
</customHeaders>
</httpProtocol>
</system.webServer>
My mistake - launchSettings.json was using https://localhost:6001 and the code was using http://localhost:6001. Doh!

Shibboleth integration

currently We have CAS SSO to our existing .net application, but now client is asking for Shibboleth SSO instead CAS. I'm totally new to Shibboleth.
Client has given the below details:
entityid= urn:mace:incommon:xxx.edu
metadata URL for test environment is:
https://shibboleth-test.xxx.edu/idp/shibboleth
By using guidelines from Shibboleth site, below are the steps i followed.
Installed Shibbolth Service provider (shibboleth-sp-2.6.1.4-win64.msi)
Installed Java with JCE
Installed Shibboleth Idp (in which jetty also checked)(shibboleth-identity-provider-3.3.3-x64.msi)
Web Application with self signed certificate
attached my Shibboleth2.xml file
<SPConfig xmlns="urn:mace:shibboleth:2.0:native:sp:config" xmlns:conf="urn:mace:shibboleth:2.0:native:sp:config" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" clockSkew="180"> <InProcess logger="native.logger"> <ISAPI normalizeRequest="true" safeHeaderNames="true">
<Site id="2" name="shibboleth-test.xxx.edu" scheme="https" port="443" />
</ISAPI> </InProcess> <RequestMapper type="Native"> <RequestMap> <Host name="shibboleth-test.xxx.edu" scheme="https" port="443">
<Path name="secure" authType="shibboleth" requireSession="true"/>
</Host>
</RequestMap></RequestMapper><ApplicationDefaults entityID="urn:mace:incommon:xxx.edu" REMOTE_USER="eppn persistent-id targeted-id" cipherSuites="ECDHE+AESGCM:ECDHE:!aNULL:!eNULL:!LOW:!EXPORT:!RC4:!SHA:!SSLv2"> <Sessions lifetime="28800" timeout="3600" relayState="ss:mem" checkAddress="false" handlerSSL="true" cookieProps="https"> <SSO entityID=""urn:mace:incommon:xxx.edu" discoveryProtocol="SAMLDS" discoveryURL="https://ds.example.org/DS/WAYF"> SAML2 SAML1 </SSO>
<!-- SAML and local-only logout. -->
<Logout>SAML2 Local</Logout>
<!-- Extension service that generates "approximate" metadata based on SP configuration. -->
<Handler type="MetadataGenerator" Location="/Metadata" signing="false"/>
<!-- Status reporting service. -->
<Handler type="Status" Location="/Status" acl="127.0.0.1 ::1 <my system IP">/>
<!-- Session diagnostic service. -->
<Handler type="Session" Location="/Session" showAttributeValues="false"/>
<!-- JSON feed of discovery information. -->
<Handler type="DiscoveryFeed" Location="/DiscoFeed"/>
</Sessions>
<Errors supportContact="root#localhost"
helpLocation="/about.html" styleSheet="/shibboleth-sp/main.css"/> <!-- Map to extract attributes from SAML assertions. --> <AttributeExtractor type="XML" validate="true" reloadChanges="false" path="attribute-map.xml"/>
<AttributeResolver type="Query" subjectMatch="true"/> <AttributeFilter type="XML" validate="true" path="attribute-policy.xml"/>
<CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>
</ApplicationDefaults>
<SecurityPolicyProvider type="XML" validate="true" path="security-policy.xml"/>
<ProtocolProvider type="XML" validate="true" reloadChanges="false" path="protocols.xml"/>
</SPConfig>
Problems I'm facing......
When i try to access https://shibboleth-test.xxx.edu/Shibboleth.sso/Status
getting error no metadataprovider available.
Noticed Problems:
1.when i try to add Metadataprovider Shibboleth daemon 2 service is getting
stopped and unable to start.if i remove it's is running.
2.Shibboleth Idp 3 deamon is getting stopped very frequently
When i run 'SC interrogate shibd_idp' in command prompt, results are
control service failed 1062
the service has not been started.
I donno what is wrong with my work.
Can any one please tell me what are the steps to be followed to accomplish this integration.
Thanks in advance,
Hema
There will be a tag in shibboleth2.xml called metadata provider, you will need to open that.
If you have done this but shill service is not getting started then you can check the log and give additional info in question.
Another reason I can think of is connection problem. Try downloading idP's metadata and store it physically in the SP configuration folder. Manually map the file, using following tag
<MetadataProvider type="XML" file="partner-metadata.xml"/>
All the issues has been resolved after we upgraded from Shibboleth 2.6 to 3.0.2. we are getting the Shibboleth Identity provider login page.We are able to see the attributes in Session.Now we are working on how to retrieve the attributes in our application and how to redirect to our application home page.Currently we created 1 sample html page under secure folder in our application. once we logged in we are able to this html page.But when i tried to redirect to our application home page, it's giving 500 error. Can any one knows like how to redirect to our app home page and retrieve the attributes in the application.

Eclipse + RunJettyRun + Spring MVC: how to set SSL for testing?

I am using Eclipse (Luna) and RunJettyRun to develop a Spring MVC website on Windows 7. I would like to test whether it works on SSL for certain pages or directories.
I have a self-assigned SSL certificate (file: .keystore) in C:\Users\Me with the default password "changeit".
In my Spring's security context, I have the following:
<http auto-config="false" use-expressions="true" request-matcher="regex" >
....
<intercept-url pattern="^\/login$" requires-channel="https" />
<port-mappings>
<port-mapping http="8080" https="8443"/>
</port-mappings>
</http>
When I click http://localhost:8080/login, I am redirected to https://localhost:8443/login (which works as expected) and I get the following message in Chrome:
This webpage is not available
This is understandable because I haven't setup anything for port 8443.
How to set SSL for port 8443 in my situation? Googled quite a bit, but what I found is mostly about setup for standalone Jetty.
Thanks for any pointers and input!

How do you configure the FROM field in a jetty email configuration?

I'm configuring version 1.4-M3 of Archiva running standalone with Jetty.
The configuration works (I get the emails). However, they're being reported from "root#localhost". As you can see in the configuration below I have mail.from defined, but somehow it is not being picked up. No mail header contains the address archiva#mymailserver.com.
What is the correct configuration so emails are shown as being sent from archiva#mymailserver.com?
<New id="validation_mail" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>mail/Session</Arg>
<Arg>
<New class="org.eclipse.jetty.jndi.factories.MailSessionReference">
<Set name="user">myuser</Set>
<Set name="password">OBF:1yxf1vnw1v1p1vu51vv51v2p1vn61ym5</Set>
<Set name="properties">
<New class="java.util.Properties">
<Put name="mail.smtp.host">mail.server</Put>
<Put name="mail.smtp.auth">true</Put>
<Put name="mail.port">25</Put>
<Put name="mail.from">archiva#mymailserver.com</Put>
<Put name="mail.mime.address.strict">false</Put>
<Put name="mail.debug">false</Put>
<Put name="mail.transport.protocol">smtp</Put>
</New>
</Set>
</New>
</Arg>
According to Archiva's documentation, the email address is configured using the following property:
email.from.address=$user.name#localhost
Blockquote
All emails sent by the system will be from the following address
As of Archiva 2.1.x and 2.2.x, I don't see that property listed within the Properties tab of the Users Runtime Configuration section. That means that you'll need to manually set this property in archiva.xml. In case you're using a servlet container, such as Tomcat, I don't mean the archiva.xml that's located within conf/Catalina/localhost. I'm referring to the archiva.xml that's located immediately within the conf directory.
Source - Archiva's Email Configuration page

Azure upgrade from 1.3 to 1.7 issue

I have recently upgraded our Azure solution to use the new 1.7 SDK. CSPack warned that it was running on a legacy syntax and required a definition in the service definition to run under full IIS. Here's what I added.
<Sites>
<Site name="Web" physicalDirectory="..\Portal\MyApp.Portal">
<Bindings>
<Binding name="HttpIn" endpointName="HttpIn" />
</Bindings>
</Site>
</Sites>
The web role is an MVC3 application with the following mail settings defined in web.config.
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="smtp.gmail.com" userName="support#myapp.com" enableSsl="true" port="587" password="mypassword"/>
</smtp>
</mailSettings>
These settings are pulled fine from web.config for sending emails from code by just declaring a SMTP client and using it to send emails,
SmtpClient client = new SmtpClient();
But when I add the section to the service definition the setting are not used and I get a SMTP host was not specified every time an email is attempted. The new SmtpClient() has none of the settings from config. I can not figure out how to fix this nor can I find any info elsewhere.
Try changing the name of your site to anything other than "Web".
There's a poorly documented feature of this syntax that a site with the name of "Web" will have all of it's settings like physicalDirectory ignored. If this works it might pay to think about whether or not you actually need the physicalDirectory specified.