<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=MITM%3A_mitmproxy_generate_certificate</id>
	<title>MITM: mitmproxy generate certificate - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=MITM%3A_mitmproxy_generate_certificate"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=MITM:_mitmproxy_generate_certificate&amp;action=history"/>
	<updated>2026-04-21T05:54:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.onnocenter.or.id/wiki/index.php?title=MITM:_mitmproxy_generate_certificate&amp;diff=51926&amp;oldid=prev</id>
		<title>Onnowpurbo: Created page with &quot;==Using a custom server certificate==  You can use your own (leaf) certificate by passing the --cert [domain=]path_to_certificate option to mitmproxy. Mitmproxy then uses the...&quot;</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=MITM:_mitmproxy_generate_certificate&amp;diff=51926&amp;oldid=prev"/>
		<updated>2018-10-03T01:56:38Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Using a custom server certificate==  You can use your own (leaf) certificate by passing the --cert [domain=]path_to_certificate option to mitmproxy. Mitmproxy then uses the...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Using a custom server certificate==&lt;br /&gt;
&lt;br /&gt;
You can use your own (leaf) certificate by passing the --cert [domain=]path_to_certificate option to mitmproxy. Mitmproxy then uses the provided certificate for interception of the specified domain instead of generating a certificate signed by its own CA.&lt;br /&gt;
&lt;br /&gt;
The certificate file is expected to be in the PEM format. You can include intermediary certificates right below your leaf certificate, so that your PEM file roughly looks like this:&lt;br /&gt;
&lt;br /&gt;
 -----BEGIN PRIVATE KEY-----&lt;br /&gt;
 &amp;lt;private key&amp;gt;&lt;br /&gt;
 -----END PRIVATE KEY-----&lt;br /&gt;
 -----BEGIN CERTIFICATE-----&lt;br /&gt;
 &amp;lt;cert&amp;gt;&lt;br /&gt;
 -----END CERTIFICATE-----&lt;br /&gt;
 -----BEGIN CERTIFICATE-----&lt;br /&gt;
 &amp;lt;intermediary cert (optional)&amp;gt;&lt;br /&gt;
 -----END CERTIFICATE-----&lt;br /&gt;
&lt;br /&gt;
For example, you can generate a certificate in this format using these instructions:&lt;br /&gt;
&lt;br /&gt;
 openssl genrsa -out cert.key 2048&lt;br /&gt;
 # (Specify the mitm domain as Common Name, e.g. \*.google.com)&lt;br /&gt;
 openssl req -new -x509 -key cert.key -out cert.crt&lt;br /&gt;
 cat cert.key cert.crt \&amp;gt; cert.pem&lt;br /&gt;
&lt;br /&gt;
Now, you can run mitmproxy with the generated certificate:&lt;br /&gt;
&lt;br /&gt;
For all domain names&lt;br /&gt;
&lt;br /&gt;
 mitmproxy --cert *=cert.pem&lt;br /&gt;
&lt;br /&gt;
For specific domain names&lt;br /&gt;
&lt;br /&gt;
 mitmproxy --cert *.example.com=cert.pem&lt;br /&gt;
&lt;br /&gt;
Note: *.example.com is for all the subdomains. You can also use www.example.com for a particular subdomain.&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>