• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ssl with Tomcat

 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my form.

if i need to enable SSL to this forum what should i insert ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting up SSL has nothing to do with your code, as was pointed out in another topic. Setting up SSL is server configuration issue. As I know you are using Tomcat, I've moved this post to the Tomcat forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Topic title updated
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if there is nothing to do with code how doec the client know when doing first request that the server is SSL enale?
when sending data to server then goes as HTTP?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only ramification to the code may be a redirect to the secure URL. But setting up SSL is a server configuration task.
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
server configuration is ok.then what should i insert to this form to enable SSL?
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why anyone doesn't answer my question.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instead of using action="welcome", specify the https protocol ie action="https://server/context/welcome"
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i change the my index.jsp


now it is working as before change.But it doesn't goes to Https.
here is the url after run
http://localhost:8080/Z_MyWeb/welcome.jsp
there is no https?
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anarkali perera wrote:server configuration is ok


Are you sure? What are you getting for https://localhost:8443 ? Check http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.
i tried to again go to C:\Program Files\Java\jdk1.6.0\bin and type keytool -genkey -alias tomcat -keyalg RSA
then it ask password .when i typed changeit it says

keytool error: java.lang.Exception: Key pair not generated, alias <tomcat> already exists.

that means i did enabling ssl correct.

anyway when i type https://localhost:8443 in browser i am getting this


The site's security certificate is not trusted!
You attempted to reach localhost, but the server presented a certificate issued by an entity that is not trusted by your computer's operating system. This may mean that the server has generated its own security credentials, which Google Chrome cannot rely on for identity information, or an attacker may be trying to intercept your communications. You should not proceed, especially if you have never seen this warning before for this site.


there are two buttons.
1)proceed anyway
2)Back to safty

then second time i enterd https://localhost:8443
it highlighted the https part and there is a slash across the https part
that means is it not working?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browser warning is because it is a 'self signed' certificate, not a genuine one. It is a warning to the user that the certificate may not may not be secure. It is fine for development use and I tend to accept my own self signed certificates but be wary of others.
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my index.jsp


when i enter username and pasword it goes to this link
https://server/context/welcome

the page include

The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.

--------------------------------------------------------------------------------

Please try the following:

Click the Refresh button, or try again later.

If you typed the page address in the Address bar, make sure that it is spelled correctly.

To check your connection settings, click the Tools menu, and then click Internet Options. On the Connections tab, click Settings. The settings should match those provided by your local area network (LAN) administrator or Internet service provider (ISP).
See if your Internet connection settings are being detected. You can set Microsoft Windows to examine your network and automatically discover network connection settings (if your network administrator has enabled this setting).
Click the Tools menu, and then click Internet Options.
On the Connections tab, click LAN Settings.
Select Automatically detect settings, and then click OK.
Some sites require 128-bit connection security. Click the Help menu and then click About Internet Explorer to determine what strength security you have installed.
If you are trying to reach a secure site, make sure your Security settings can support it. Click the Tools menu, and then click Internet Options. On the Advanced tab, scroll to the Security section and check settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0.
Click the Back button to try another link.



Cannot find server or DNS Error
Internet Explorer


what is the error?
 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anarkali perera wrote:
Cannot find server or DNS Error
Internet Explorer



It is not able to find this web site: https://server
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have literally pasted in https://server/context/welcome you need to replace this with your server name and context
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what should i enter for server?is it tomcat?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the name of the server that you are running on? If it is 'localhost', put 'localhost'
Basically you would put in here whatever you woudld put in to the browser's address bar to get to that page, but specify https rather than http
IF you are using the default HTTPS port (443) as specified in your server.xml then you do not need to specify a port, otherwise you will need to specify a port such as 8443
https://localhost:8443/context/welcome

I still don't know what your context (web-app name) is and can't help you there.
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using eclips.
my project name is Z_MyWeb.
this is my index.jsp


but still i got when i type username and password
this is the browser link "https://localhost/Z_MyWeb/welcome"
this is the massage

The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.

--------------------------------------------------------------------------------

Please try the following:

Click the Refresh button, or try again later.

If you typed the page address in the Address bar, make sure that it is spelled correctly.

To check your connection settings, click the Tools menu, and then click Internet Options. On the Connections tab, click Settings. The settings should match those provided by your local area network (LAN) administrator or Internet service provider (ISP).
See if your Internet connection settings are being detected. You can set Microsoft Windows to examine your network and automatically discover network connection settings (if your network administrator has enabled this setting).
Click the Tools menu, and then click Internet Options.
On the Connections tab, click LAN Settings.
Select Automatically detect settings, and then click OK.
Some sites require 128-bit connection security. Click the Help menu and then click About Internet Explorer to determine what strength security you have installed.
If you are trying to reach a secure site, make sure your Security settings can support it. Click the Tools menu, and then click Internet Options. On the Advanced tab, scroll to the Security section and check settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0.
Click the Back button to try another link.



Cannot find server or DNS Error
Internet Explorer



 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you read what I wrote about port numbers?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at your previous post here, you have already specified that you expect https://localhost:8443 so why not use that?
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyway if i type just https://localhost:8443/ it goes to the page which i type http://localhost:8080/.

now this is my index.jsp


this is my web.xml


this is the link apear when i run the index.jsp
http://localhost:8080/Z_MyWeb/index.jsp

if i add a new student and enter then this is the link appear on browser
http://localhost:8080/Z_MyWeb/welcome

but if i enter username and password
this is the link appear "https://localhost:8443/Z_MyWeb/welcome"
and it gives this

The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.

--------------------------------------------------------------------------------

Please try the following:

Click the Refresh button, or try again later.

If you typed the page address in the Address bar, make sure that it is spelled correctly.

To check your connection settings, click the Tools menu, and then click Internet Options. On the Connections tab, click Settings. The settings should match those provided by your local area network (LAN) administrator or Internet service provider (ISP).
See if your Internet connection settings are being detected. You can set Microsoft Windows to examine your network and automatically discover network connection settings (if your network administrator has enabled this setting).
Click the Tools menu, and then click Internet Options.
On the Connections tab, click LAN Settings.
Select Automatically detect settings, and then click OK.
Some sites require 128-bit connection security. Click the Help menu and then click About Internet Explorer to determine what strength security you have installed.
If you are trying to reach a secure site, make sure your Security settings can support it. Click the Tools menu, and then click Internet Options. On the Advanced tab, scroll to the Security section and check settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0.
Click the Back button to try another link.


Cannot find server or DNS Error
Internet Explorer

 
Misha Ver
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anarkali, I would suggest you to start from the beginning.

1) Make you that know what does “Cannot find server or DNS Error” means
2) Make sure that you configured SSL properly, check http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html or similar page for your Tomcat version
3) After you successfully completed the steps 1 and 2, your code below should work for http://localhost:8080/Z_MyWeb/ and https://localhost: 8443/Z_MyWeb/
4) The very last part would be to enforce SSL for you application

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic