<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="/feed_style.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
        <tabi:base_url>&#x2F;</tabi:base_url>
        <tabi:separator>
            •
        </tabi:separator>
        <tabi:about_feeds>This is a web feed, also known as an Atom feed. Subscribe by copying the URL from the address bar into your newsreader. Visit About Feeds to learn more and get started. It&#x27;s free.</tabi:about_feeds>
        <tabi:visit_the_site>Visit website</tabi:visit_the_site>
        <tabi:recent_posts>Recent posts</tabi:recent_posts>
        <tabi:last_updated_on>Updated on $DATE</tabi:last_updated_on>
        <tabi:default_theme></tabi:default_theme>
        <tabi:post_listing_date>date</tabi:post_listing_date>
        <tabi:current_section>PWM</tabi:current_section>
    </tabi:metadata><link rel="extra-stylesheet" href="/skins/indigo_ingot.css?h=d429472afbb246441b1a" /><title>Andrew Wippler's Sketchpad - PWM</title>
        <subtitle>Ideas, blog, etc. </subtitle>
    <link href="/tags/pwm/atom.xml" rel="self" type="application/atom+xml"/>
    <link href="/tags/pwm/" rel="alternate" type="text/html"/>
    <generator uri="https://www.getzola.org/">Zola</generator><updated>2016-08-26T14:49:51+00:00</updated><id>/tags/pwm/atom.xml</id><entry xml:lang="en">
        <title>Securing PWM</title>
        <published>2016-08-26T14:49:51+00:00</published>
        <updated>2016-08-26T14:49:51+00:00</updated>
        <author>
            <name>Andrew Wippler</name>
        </author>
        <link rel="alternate" href="/2016-08-26-securing-pwm/" type="text/html"/>
        <id>/2016-08-26-securing-pwm/</id>
        
            <content type="html">&lt;p&gt;In &lt;a class=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;andrewwippler.com&#x2F;2016&#x2F;08&#x2F;19&#x2F;password-management-portal-for-end-users&#x2F;&quot;&gt;last week&#x27;s post&lt;&#x2F;a&gt; we set up PWM insecurely. In this post, we are going to secure it down and install mysql to store the reset questions. This guide assumes you have this CentOS 7 server publicly accessible with ports 80 and 443 available to the entire world. First, we will need to install mysql, set up a database, and add a user to that database. To do that, we need to edit our &lt;code&gt;manifest.pp&lt;&#x2F;code&gt; and append the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; class { &amp;#39;::mysql::server&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     root_password           =&amp;gt; &amp;#39;My4cc0unt$$password!&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     remove_default_accounts =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     package_name            =&amp;gt; &amp;#39;mariadb-server&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     package_ensure          =&amp;gt; &amp;#39;installed&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     service_name            =&amp;gt; &amp;#39;mariadb&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; mysql::db { &amp;#39;pwm&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     user     =&amp;gt; &amp;#39;pwm&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     password =&amp;gt; &amp;#39;pwm_passworD2!&amp;#39;, # Can&amp;#39;t do a password hash here :(
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; class { &amp;#39;mysql::bindings&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     java_enable =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;file { &amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;lib&#x2F;mysql-connector-java.jar&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ensure  =&amp;gt; link,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     target  =&amp;gt; &amp;#39;&#x2F;usr&#x2F;share&#x2F;java&#x2F;mysql-connector-java.jar&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     require =&amp;gt; Class[&amp;#39;mysql::bindings&amp;#39;]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We will also need to install additional modules:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install puppetlabs-firewall
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install jfryman-nginx
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install jfryman-selinux
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install danzilio-letsencrypt
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Now we can set up our web server and directories by appending the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;file {&amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&amp;quot;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ensure =&amp;gt; &amp;#39;directory&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     owner  =&amp;gt; &amp;#39;nginx&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;file {&amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&#x2F;index.html&amp;quot;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ensure  =&amp;gt; &amp;#39;file&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     owner   =&amp;gt; &amp;#39;nginx&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     content =&amp;gt; &amp;#39;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;URL=&#x2F;pwm&amp;quot; &#x2F;&amp;gt;&amp;lt;&#x2F;head&amp;gt;&amp;lt;&#x2F;html&amp;gt;&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     require =&amp;gt; File[&amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&amp;quot;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;firewall { &amp;#39;100 allow http, https access&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     dport  =&amp;gt; [80, 443],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     proto  =&amp;gt; tcp,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     action =&amp;gt; accept,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;selinux::fcontext {&amp;#39;set-httpd-context&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     context  =&amp;gt; &amp;quot;httpd_sys_content_t&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     pathname =&amp;gt; &amp;quot;&#x2F;var&#x2F;www(&#x2F;.*)?&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;selinux::boolean {&amp;#39;httpd_can_network_connect&amp;#39;: }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;class { &amp;#39;nginx&amp;#39;: }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;nginx::resource::upstream { &amp;#39;pwm&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     members =&amp;gt; [ &amp;#39;localhost:8080&amp;#39; ],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;nginx::resource::vhost { &amp;quot;${::hostname}.${::domain}&amp;quot;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ensure           =&amp;gt; present,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     www_root         =&amp;gt; &amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&#x2F;&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     #ssl              =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     index_files      =&amp;gt; [],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     try_files        =&amp;gt; [&amp;#39;$uri&amp;#39;,&amp;#39;$uri&#x2F;index.html&amp;#39;,&amp;#39;@pwm&amp;#39;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     #rewrite_to_https =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     #ssl_cert         =&amp;gt; &amp;quot;&#x2F;etc&#x2F;letsencrypt&#x2F;live&#x2F;${::fqdn}&#x2F;fullchain.pem&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     #ssl_key          =&amp;gt; &amp;quot;&#x2F;etc&#x2F;letsencrypt&#x2F;live&#x2F;${::fqdn}&#x2F;privkey.pem&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;nginx::resource::location{&amp;#39;@pwm&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     proxy =&amp;gt; &amp;#39;http:&#x2F;&#x2F;pwm&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     vhost =&amp;gt; &amp;quot;${::hostname}.${::domain}&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ssl   =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;``` Leave the ssl options commented out for now. We need the web server set up before running letsencrypt. After we save the file and run another&lt;&#x2F;code&gt;puppet apply manifest.pp` we can add the letsencrypt information and uncomment the ssl information.&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;class { ::letsencrypt:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     email   =&amp;gt; &amp;#39;andrew.wippler@example.com&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     require =&amp;gt; Class[&amp;#39;nginx&amp;#39;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;letsencrypt::certonly { &amp;#39;pwm cert&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     domains       =&amp;gt; [&amp;quot;${::fqdn}&amp;quot;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     plugin        =&amp;gt; &amp;#39;webroot&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     webroot_paths =&amp;gt; [&amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&amp;quot;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     manage_cron   =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; }
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Apply the manifest one more time and enjoy your new instance of PWM. As a reference, my entire manifest can be seen below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;include git
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;include java
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;tomcat::install { &amp;#39;&#x2F;opt&#x2F;tomcat8&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  source_url =&amp;gt; &amp;#39;https:&#x2F;&#x2F;www.apache.org&#x2F;dist&#x2F;tomcat&#x2F;tomcat-8&#x2F;v8.5.3&#x2F;bin&#x2F;apache-tomcat-8.5.3.tar.gz&amp;#39;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;tomcat::instance { &amp;#39;tomcat8-pwm&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  catalina_home =&amp;gt; &amp;#39;&#x2F;opt&#x2F;tomcat8&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  catalina_base =&amp;gt; &amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;tomcat::war { &amp;#39;pwm.war&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  catalina_base =&amp;gt; &amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  war_source    =&amp;gt; &amp;#39;&#x2F;path&#x2F;to&#x2F;pwm.war&amp;#39;, # or http:&#x2F;&#x2F;domain.tld&#x2F;pwm.war
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  before        =&amp;gt; File[&amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;lib&#x2F;mysql-connector-java.jar&amp;#39;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;augeas { &amp;#39;web.xml&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  incl =&amp;gt; &amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;webapps&#x2F;pwm&#x2F;WEB-INF&#x2F;web.xml&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  context =&amp;gt; &amp;#39;&#x2F;files&#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;webapps&#x2F;pwm&#x2F;WEB-INF&#x2F;web.xml&#x2F;web-app&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  lens    =&amp;gt; &amp;#39;Xml.lns&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  changes =&amp;gt; &amp;#39;set context-param[1]&#x2F;param-value&#x2F;#text &#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;webapps&#x2F;pwm&#x2F;WEB-INF&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;class { &amp;#39;::mysql::server&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  root_password           =&amp;gt; &amp;#39;My4cc0unt$$password!&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  remove_default_accounts =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  package_name            =&amp;gt; &amp;#39;mariadb-server&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  package_ensure   	  =&amp;gt; &amp;#39;installed&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  service_name            =&amp;gt; &amp;#39;mariadb&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;mysql::db { &amp;#39;pwm&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  user     =&amp;gt; &amp;#39;pwm&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  password =&amp;gt; &amp;#39;pwm_passworD2!&amp;#39;, # Can&amp;#39;t do a password hash here :(
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;class { &amp;#39;mysql::bindings&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  java_enable =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;file { &amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;lib&#x2F;mysql-connector-java.jar&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  ensure  =&amp;gt; link,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  target  =&amp;gt; &amp;#39;&#x2F;usr&#x2F;share&#x2F;java&#x2F;mysql-connector-java.jar&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  require =&amp;gt; Class[&amp;#39;mysql::bindings&amp;#39;]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;file {&amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&amp;quot;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  ensure =&amp;gt; &amp;#39;directory&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  owner  =&amp;gt; &amp;#39;nginx&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;file {&amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&#x2F;index.html&amp;quot;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  ensure  =&amp;gt; &amp;#39;file&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  owner   =&amp;gt; &amp;#39;nginx&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  content =&amp;gt; &amp;#39;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;0;URL=&#x2F;pwm&amp;quot; &#x2F;&amp;gt;&amp;lt;&#x2F;head&amp;gt;&amp;lt;&#x2F;html&amp;gt;&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  require =&amp;gt; File[&amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&amp;quot;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;firewall { &amp;#39;100 allow http, https access&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  dport   =&amp;gt; [80, 443],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  proto  =&amp;gt; tcp,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  action =&amp;gt; accept,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;selinux::fcontext {&amp;#39;set-httpd-context&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  context  =&amp;gt; &amp;quot;httpd_sys_content_t&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  pathname =&amp;gt; &amp;quot;&#x2F;var&#x2F;www(&#x2F;.*)?&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;selinux::boolean {&amp;#39;httpd_can_network_connect&amp;#39;: }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;class { &amp;#39;nginx&amp;#39;: }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;nginx::resource::upstream { &amp;#39;pwm&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  members =&amp;gt; [ &amp;#39;localhost:8080&amp;#39; ],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;nginx::resource::vhost { &amp;quot;${::hostname}.${::domain}&amp;quot;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ensure           =&amp;gt; present,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     index_files      =&amp;gt; [],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     www_root         =&amp;gt; &amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&#x2F;&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ssl              =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     try_files        =&amp;gt; [&amp;#39;$uri&amp;#39;, &amp;#39;$uri&#x2F;index.html&amp;#39;, &amp;#39;@pwm&amp;#39;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     rewrite_to_https =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ssl_cert         =&amp;gt; &amp;quot;&#x2F;etc&#x2F;letsencrypt&#x2F;live&#x2F;${::fqdn}&#x2F;fullchain.pem&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ssl_key          =&amp;gt; &amp;quot;&#x2F;etc&#x2F;letsencrypt&#x2F;live&#x2F;${::fqdn}&#x2F;privkey.pem&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;nginx::resource::location{&amp;#39;@pwm&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     proxy =&amp;gt; &amp;#39;http:&#x2F;&#x2F;pwm&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     vhost =&amp;gt; &amp;quot;${::hostname}.${::domain}&amp;quot;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;     ssl   =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;class { ::letsencrypt:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    email   =&amp;gt; &amp;#39;andrew.wippler@example.com&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    require =&amp;gt; Class[&amp;#39;nginx&amp;#39;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;letsencrypt::certonly { &amp;#39;pwm cert&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    domains       =&amp;gt; [&amp;quot;${::fqdn}&amp;quot;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    plugin        =&amp;gt; &amp;#39;webroot&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    webroot_paths =&amp;gt; [&amp;quot;&#x2F;var&#x2F;www&#x2F;${::hostname}&amp;quot;],
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    manage_cron   =&amp;gt; true,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</content>
        </entry><entry xml:lang="en">
        <title>Password management portal for end users</title>
        <published>2016-08-19T14:00:00+00:00</published>
        <updated>2016-08-19T14:00:00+00:00</updated>
        <author>
            <name>Andrew Wippler</name>
        </author>
        <link rel="alternate" href="/2016-08-19-password-management-portal-for-end-users/" type="text/html"/>
        <id>/2016-08-19-password-management-portal-for-end-users/</id>
        
            <content type="html">&lt;p&gt;We in IT have heard it often, the #1 request coming into help desk ticket systems is password resets, account lockouts, and the like. PWM is a password reset web application written in Java for use with LDAP directories. You can configure it to work with Active Directory, OpenLDAP, FreeIPA, and others. There are already a handful of good tutorials on how to set up PWM (&lt;a class=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;www.serveradventures.com&#x2F;the-adventures&#x2F;installing-pwm-open-source-password-self-service-for-ldap&quot;&gt;I think of this one in particular&lt;&#x2F;a&gt;); however, I want to demonstrate the &lt;code&gt;puppet apply&lt;&#x2F;code&gt; command in this tutorial.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;&#x2F;h3&gt;
&lt;p&gt;This guide assumes you have an Active Directory server with TLS set up (to change passwords) which is beyond the scope of this post. It also assumes you have a CentOS 7 instance which can communicate to the Active Directory server. It also assumes this is in an environment without a puppet master&#x2F;server. The end manifest can be uploaded to a master and used that way.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;obtaining-pwm&quot;&gt;Obtaining PWM&lt;&#x2F;h3&gt;
&lt;p&gt;PWM is available in zip format &lt;a class=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;www.pwm-project.org&#x2F;artifacts&#x2F;pwm&#x2F;&quot;&gt;on their website&lt;&#x2F;a&gt; or in source format &lt;a class=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pwm-project&#x2F;pwm&quot;&gt;on GitHub&lt;&#x2F;a&gt;. We are going to use the war file so grab the zip from off of their website, extract it, and place it on a webserver or locally on the server.&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;yum install wget unzip -y
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;wget http:&#x2F;&#x2F;www.pwm-project.org&#x2F;artifacts&#x2F;pwm&#x2F;pwm-1.8.0-SNAPSHOT-2016-05-23T22%3A36%3A58Z-pwm-bundle.zip
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;unzip pwm*.zip
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;installing-puppet-and-puppet-modules&quot;&gt;Installing puppet and puppet modules&lt;&#x2F;h3&gt;
&lt;p&gt;Our next step is to get puppet and relevant puppet modules&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;rpm -ivh http:&#x2F;&#x2F;yum.puppetlabs.com&#x2F;puppetlabs-release-pc1-el-7.noarch.rpm
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;yum install puppet -y
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;source &#x2F;etc&#x2F;profile
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install puppetlabs-mysql
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install puppetlabs-java
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install puppetlabs-git
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install puppetlabs-concat
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;puppet module install puppetlabs-tomcat --ignore-dependencies
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We are &lt;code&gt;--ignore-dependencies&lt;&#x2F;code&gt; because there is a conflicting staging module that the &lt;code&gt;mysql&lt;&#x2F;code&gt; module already installed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;vim manifest.pp
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The contents of this file are as below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;include git
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;include java
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;tomcat::install { &amp;#39;&#x2F;opt&#x2F;tomcat8&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  source_url =&amp;gt; &amp;#39;https:&#x2F;&#x2F;www.apache.org&#x2F;dist&#x2F;tomcat&#x2F;tomcat-8&#x2F;v8.5.3&#x2F;bin&#x2F;apache-tomcat-8.5.3.tar.gz&amp;#39;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;tomcat::instance { &amp;#39;tomcat8-pwm&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  catalina_home =&amp;gt; &amp;#39;&#x2F;opt&#x2F;tomcat8&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  catalina_base =&amp;gt; &amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;tomcat::war { &amp;#39;pwm.war&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  catalina_base =&amp;gt; &amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  war_source    =&amp;gt; &amp;#39;&#x2F;path&#x2F;to&#x2F;pwm.war&amp;#39;, # or http:&#x2F;&#x2F;domain.tld&#x2F;pwm.war
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;augeas {&amp;#39;web.xml&amp;#39;:
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;	incl    =&amp;gt; &amp;#39;&#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;webapps&#x2F;pwm&#x2F;WEB-INF&#x2F;web.xml&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;	context =&amp;gt; &amp;#39;&#x2F;files&#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;webapps&#x2F;pwm&#x2F;WEB-INF&#x2F;web.xml&#x2F;web-app&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;	lens    =&amp;gt; &amp;#39;Xml.lns&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;	changes =&amp;gt; &amp;#39;set context-param[1]&#x2F;param-value&#x2F;#text &#x2F;opt&#x2F;tomcat8&#x2F;pwm&#x2F;webapps&#x2F;pwm&#x2F;WEB-INF&amp;#39;,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We can now enforce the environment by issuing a &lt;code&gt;puppet apply manifest.pp&lt;&#x2F;code&gt;. This will install PWM (insecurely), java, git, and tomcat. PWM is insecure in this state as passwords can be intercepted before they hit the web server. &lt;a class=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;andrewwippler.com&#x2F;2016&#x2F;08&#x2F;26&#x2F;securing-pwm&#x2F;&quot;&gt;In a follow-up tutorial next week&lt;&#x2F;a&gt;, I will explain how to install mysql (to store the password reset questions) as well as placing nginx in front of tomcat to offer SSL and http to https redirection.&lt;&#x2F;p&gt;
</content>
        </entry>
</feed>
