-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd-ssl-to-java.html
More file actions
153 lines (123 loc) · 6.07 KB
/
add-ssl-to-java.html
File metadata and controls
153 lines (123 loc) · 6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html lang="en">
<head>
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="https://tedops.github.io/theme/stylesheet/style.min.css">
<link rel="stylesheet" type="text/css" href="https://tedops.github.io/theme/pygments/github.min.css">
<link rel="stylesheet" type="text/css" href="https://tedops.github.io/theme/font-awesome/css/font-awesome.min.css">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="" />
<meta name="author" content="Ted Sheibar" />
<meta name="description" content="How To Add an SSL Cert to the Java Keystore" />
<meta name="keywords" content="bash, java, ssl, cert, keystore">
<meta property="og:site_name" content="tedops"/>
<meta property="og:title" content="Adding SSL Certificate to Java Keystore"/>
<meta property="og:description" content="How To Add an SSL Cert to the Java Keystore"/>
<meta property="og:locale" content="en_US"/>
<meta property="og:url" content="https://tedops.github.io/add-ssl-to-java.html"/>
<meta property="og:type" content="article"/>
<meta property="article:published_time" content="2015-11-23 00:00:00-08:00"/>
<meta property="article:modified_time" content="2015-11-23 00:00:00-08:00"/>
<meta property="article:author" content="https://tedops.github.io/author/ted-sheibar.html">
<meta property="article:section" content="Java"/>
<meta property="article:tag" content="bash"/>
<meta property="article:tag" content="java"/>
<meta property="article:tag" content="ssl"/>
<meta property="article:tag" content="cert"/>
<meta property="article:tag" content="keystore"/>
<meta property="og:image" content="theme/img/profile.png">
<title>tedops – Adding SSL Certificate to Java Keystore</title>
</head>
<body>
<aside>
<div>
<a href="https://tedops.github.io">
<img src="theme/img/profile.png" alt="ted sheibar" title="ted sheibar">
</a>
<h1><a href="https://tedops.github.io">ted sheibar</a></h1>
<p>Release Engineer • SRE • Python Enthusiast</p>
<nav>
<ul class="list">
<li><a href="https://www.docker.com/" target="_blank">Docker</a></li>
<li><a href="https://mesos.apache.org/" target="_blank">Mesos</a></li>
<li><a href="https://www.python.org/" target="_blank">Python</a></li>
<li><a href="https://docs.saltstack.com/en/latest/" target="_blank">SaltStack</a></li>
</ul>
</nav>
<ul class="social">
<li><a class="sc-github" href="https://github.com/tedops" target="_blank"><i class="fa fa-github"></i></a></li>
<li><a class="sc-linkedin" href="https://www.linkedin.com/pub/theodore-sheibar/76/363/215" target="_blank"><i class="fa fa-linkedin"></i></a></li>
<li><a class="sc-twitter" href="http://twitter.com/tedops" target="_blank"><i class="fa fa-twitter"></i></a></li>
</ul>
</div>
</aside>
<main>
<nav>
<a href="https://tedops.github.io"> Home
</a>
<a href="/archives.html">Archives</a>
<a href="/authors.html">Authors</a>
<a href="/categories.html">Categories</a>
<a href="/tags.html">Tags</a>
</nav>
<article>
<header>
<h1 id="add-ssl-to-java">Adding SSL Certificate to Java Keystore</h1>
<p>
Posted on Mon 23 November 2015 in <a href="https://tedops.github.io/category/java.html">Java</a>
</p>
</header>
<div>
<p>This is something that crops up from time to time and is annoying to go Stack Overflow mining each time I need it. So I'm putting it here for my sake, and hope it helps you too:</p>
<pre class="code bash literal-block">
<span class="nv">SITE</span><span class="o">=</span><span class="s2">"github.com"</span>
<span class="c1"># get github cert from the server
</span>openssl x509 -in <<span class="o">(</span>openssl s_client -connect <span class="nv">$SITE</span>:443 -prexit 2>/dev/null<span class="o">)</span> -out ~/<span class="nv">$SITE</span>.crt
<span class="c1"># add it to the java keystore (yes, the storepass is literally 'changeit')
</span>/usr/java/default/bin/keytool -noprompt -importcert -file ~/<span class="nv">$SITE</span>.crt <span class="se">\
</span> -alias github -keystore /usr/java/default/jre/lib/security/cacerts -storepass changeit
<span class="c1"># clean up
</span>rm ~/<span class="nv">$SITE</span>.crt
</pre>
<p><strong>NOTE:</strong> Remove the <tt class="docutils literal"><span class="pre">-noprompt</span></tt> flag if you'd prefer to see the cert before accepting it.</p>
</div>
<div class="tag-cloud">
<p>
<a href="https://tedops.github.io/tag/bash.html">bash</a>
<a href="https://tedops.github.io/tag/java.html">java</a>
<a href="https://tedops.github.io/tag/ssl.html">ssl</a>
<a href="https://tedops.github.io/tag/cert.html">cert</a>
<a href="https://tedops.github.io/tag/keystore.html">keystore</a>
</p>
</div>
</article>
<footer>
<p>© Ted Sheibar </p>
<p> Powered by <a href="http://getpelican.com" target="_blank">Pelican</a> - <a href="https://github.com/alexandrevicenzi/flex" target="_blank">Flex</a> theme by <a href="http://alexandrevicenzi.com" target="_blank">Alexandre Vicenzi</a>
</p> </footer>
</main>
<!-- Google Analytics -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-73404444-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Blog",
"name": " tedops ",
"url" : "https://tedops.github.io",
"image": "theme/img/profile.png",
"description": ""
}
</script>
</body>
</html>