# WEBRick auto generated SSL certificate

**URL:** <https://www.ruby-forum.com/t/webrick-auto-generated-ssl-certificate/114511>\
**Category:** Rails\
**Created:** [September 13, 2007, 5:23pm UTC](https://www.ruby-forum.com/t/webrick-auto-generated-ssl-certificate/114511 "2007-09-13T17:23:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [September 13, 2007, 5:23pm UTC](https://www.ruby-forum.com/t/webrick-auto-generated-ssl-certificate/114511/1 "2007-09-13T17:23:22Z")

</div>

Where do I look for/find the parameters that ::SSLCertName will accept  
for WEBrick’s auto-generated certificate?

Specifically, I am trying to find out if there is a way to generate or  
pass a unique certificate serial number each time the secure server  
starts as Firefox borks after the first certificate due to them all  
having the same serial number (presumably 0).

Regards,

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [September 13, 2007, 5:33pm UTC](https://www.ruby-forum.com/t/webrick-auto-generated-ssl-certificate/114511/2 "2007-09-13T17:33:03Z")

</div>

James B. wrote:

> Where do I look for/find the parameters that ::SSLCertName will accept  
> for WEBrick’s auto-generated certificate?

OK. I found /ruby/1.8/webrick/ssl.rb and on line 54 I see:

cert.serial = 0

Now, the module call is:

module Utils  
def create\_self\_signed\_cert(bits, cn, comment)

So from the server script I see this:

:SSLCertName =\> [[ “CN”, WEBrick::Utils::getservername] ]

So there does not seem to me to be any way to pass a serial number to  
ssl.rb. So is there a way to extend ssl.rb in the script or need I  
modify ssl.rb for my installation to get a random (and hopefully unique)  
certificate serial number?

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [September 13, 2007, 6:26pm UTC](https://www.ruby-forum.com/t/webrick-auto-generated-ssl-certificate/114511/3 "2007-09-13T18:26:40Z")

</div>

See Rails Trac Ticket #9551

Patch file for webrick/ssl.rb attached for anyone who cares.
