<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mac on shocksolution.com</title><link>https://shocksolution.com/tags/mac/</link><description>Recent content in Mac on shocksolution.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 22 Apr 2021 18:54:25 +0000</lastBuildDate><atom:link href="https://shocksolution.com/tags/mac/index.xml" rel="self" type="application/rss+xml"/><item><title>Node.js: Connecting to MySQL on a socket with Sequelize</title><link>https://shocksolution.com/posts/node-js-connecting-to-mysql-on-a-socket-with-sequelize/</link><pubDate>Thu, 22 Apr 2021 18:54:25 +0000</pubDate><guid>https://shocksolution.com/posts/node-js-connecting-to-mysql-on-a-socket-with-sequelize/</guid><description>&lt;p&gt;According to its official description, &amp;ldquo;&lt;a href="https://sequelize.org/master/index.html"&gt;Sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.&lt;/a&gt;&amp;rdquo; Sequelize is widely used in Node.js web applications to abstract the database layer. I recently found a &amp;ldquo;corner case&amp;rdquo; for Sequelize which is possible to accomplish, but is not well documented anywhere on the web. I need to use Sequelize to connect to a MySQL server via a UNIX socket. I&amp;rsquo;m developing some plugins for Confluence that use the &lt;a href="https://bitbucket.org/atlassian/atlassian-connect-express/src/master/"&gt;atlassian-connect-express&lt;/a&gt; toolkit, which has a datastore that wraps Sequelize. The way Atlassian has chosen to wrap Sequelize is rather unfortunate, probably because they are trying to maintain backwards compatibility with JugglingDB. Essentially, the Atlassian Connect Express only looks at the URL, and ignores any option passed to Sequelize. Therefore, you have to pass everything you need via the URL, and this is where it&amp;rsquo;s tricky. Here&amp;rsquo;s the form of the URL that you need to connect to MySQL via a UNIX socket with Sequelize:&lt;/p&gt;</description></item><item><title>curl or libcurl: SSL certificate problem: unable to get local issuer certificate</title><link>https://shocksolution.com/posts/curl-or-libcurl-ssl-unable-to-get-local-issuer-certificate/</link><pubDate>Tue, 10 Mar 2020 17:00:17 +0000</pubDate><guid>https://shocksolution.com/posts/curl-or-libcurl-ssl-unable-to-get-local-issuer-certificate/</guid><description>&lt;p&gt;curl, or an application that uses libcurl, may have a problem with an SSL certificate that works fine when using a web browser to access the same URL. Typical error output from curl looks like this:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;button class="code-copy" type="button" hidden aria-label="Copy code to clipboard"&gt;&#10; &lt;span class="code-copy-label" aria-hidden="true"&gt;Copy&lt;/span&gt;&#10; &lt;/button&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ curl -v https://my-subdomain.mysecuresite.com&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Trying xxx.xxx.xxx.xxx:443…&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TCP_NODELAY set&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Connected to my-subdomain.mysecuresite.com (xxx.xxx.xxx.xxx) port 443 (#0)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ALPN, offering h2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ALPN, offering http/1.1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; successfully set certificate verify locations:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CAfile: /etc/ssl/certs/ca-certificates.crt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; CApath: none&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TLSv1.3 (OUT), TLS handshake, Client hello (1):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TLSv1.3 (IN), TLS handshake, Server hello (2):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TLSv1.2 (IN), TLS handshake, Certificate (11):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; TLSv1.2 (OUT), TLS alert, unknown CA (560):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; SSL certificate problem: unable to get local issuer certificate&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Closing connection 0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; curl: (60) SSL certificate problem: unable to get local issuer certificate&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; More details here: https://curl.haxx.se/docs/sslcerts.html &#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; curl failed to verify the legitimacy of the server and therefore could not&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; establish a secure connection to it. To learn more about this situation and&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; how to fix it, please visit the web page mentioned above.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10; &lt;/div&gt;&lt;h2 id="troubleshooting-strategy"&gt;Troubleshooting Strategy&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;A good starting point for any SSL error on a public-facing URL is to &lt;a href="https://%3Cwww.ssllabs.com/ssltest/%3E"&gt;analyze the URL at SSL Labs&lt;/a&gt;.&lt;/li&gt;&#10;&lt;li&gt;Does the error happen for all certificates issued by a specific Certificate Authority (CA)? If so, the system running curl may need to have a root certificate for that CA added or updated in its certificate repository. That&amp;rsquo;s a relatively rare problem, but might occur if the system running curl is very old. There&amp;rsquo;s a &lt;a href="https://stackoverflow.com/questions/24611640/curl-60-ssl-certificate-unable-to-get-local-issuer-certificate"&gt;comprehensive thread about this issue on Stack Overflow&lt;/a&gt;.&lt;/li&gt;&#10;&lt;li&gt;If the error only happens for one specific site, it&amp;rsquo;s likely that the site is missing an intermediate certificate. The command to diagnose this issue is also found in that Stack Overflow thread:&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;button class="code-copy" type="button" hidden aria-label="Copy code to clipboard"&gt;&#10; &lt;span class="code-copy-label" aria-hidden="true"&gt;Copy&lt;/span&gt;&#10; &lt;/button&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl s_client -connect myhost.com:443 -servername myhost.com -showcerts&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10; &lt;/div&gt;&lt;p&gt;The output should show a series of certificates, starting with the site certificate, and ending with the root certificate for the Certification Authority. If this chain only shows the site certificate, that&amp;rsquo;s the problem.&lt;/p&gt;</description></item><item><title>openssl unable to read/load/import SSL private key from GoDaddy</title><link>https://shocksolution.com/posts/openssl-unable-to-read-load-import-ssl-private-key-from-godaddy/</link><pubDate>Mon, 02 Dec 2019 13:24:00 +0000</pubDate><guid>https://shocksolution.com/posts/openssl-unable-to-read-load-import-ssl-private-key-from-godaddy/</guid><description>&lt;p&gt;&lt;a href="https://%3C%3Cwww.openssl.org/&amp;amp;gt%3E;"&gt;openssl&lt;/a&gt; is the standard open-source, command-line tool for manipulating SSL/TLS certificates on Linux, MacOS, and other UNIX-like systems. I recently ran into an interesting problem using openssl to convert a private key obtained from GoDaddy. Someone else used GoDaddy&amp;rsquo;s &amp;ldquo;wizard&amp;rdquo; interface to generate a certificate signing request (CSR) and private key, and saved the files on their Windows workstation. They purchased an SSL cert from GoDaddy, and shared all the files with me for installation on servers. GoDaddy saved the private key in the newer &lt;a href="https://en.wikipedia.org/wiki/PKCS_8"&gt;PKCS #8 format (pkcs8)&lt;/a&gt;, and one system required the key in the older &lt;a href="https://en.wikipedia.org/wiki/PKCS_1"&gt;PKCS #1 (pkcs1) format&lt;/a&gt;. It&amp;rsquo;s easy to tell the difference.&lt;/p&gt;</description></item><item><title>Mac OS X hack: download multiple files with curl</title><link>https://shocksolution.com/posts/mac-os-x-hack-download-multiple-files-with-curl/</link><pubDate>Mon, 29 Oct 2012 11:03:26 +0000</pubDate><guid>https://shocksolution.com/posts/mac-os-x-hack-download-multiple-files-with-curl/</guid><description>&lt;p&gt;Updated 2017-08-01 to fix typo and use new demo URL. Also note that &lt;a href="https://brew.sh/"&gt;the Homebrew package manager&lt;/a&gt; has matured since this post was first published in 2012. Once you&amp;rsquo;ve configured Homebrew, installing a tool like wget is as simple as running &lt;code&gt;brew install wget&lt;/code&gt; &lt;a href="http://%3C%3Cwww.gnu.org/software/wget/manual/wget.html&amp;amp;gt%3E;" title="wget%20manual"&gt;wget&lt;/a&gt; is an incredibly useful GNU tool on Linux. Unfortunately, it doesn&amp;rsquo;t come with OS X (as of Mountain Lion). OS X includes &lt;a href="http://curl.haxx.se/docs/manpage.html" title="curl%20manual"&gt;curl&lt;/a&gt;, which is a very handy tool but lacks at least one important feature of wget: the ability to use wildcards to get multiple files at the same time. For example, let&amp;rsquo;s say you want to &lt;a href="ftp://ftp.dos.state.fl.us/public/doc/cor/"&gt;download a subset of files from an FTP server&lt;/a&gt;. With wget, you could type:&lt;/p&gt;</description></item><item><title>Linux kernel 3.1 config for Gentoo guest on VMWare Fusion</title><link>https://shocksolution.com/posts/linux-kernel-3-1-config-for-gentoo-guest-on-vmware-fusion/</link><pubDate>Mon, 24 Oct 2011 03:23:48 +0000</pubDate><guid>https://shocksolution.com/posts/linux-kernel-3-1-config-for-gentoo-guest-on-vmware-fusion/</guid><description>&lt;p&gt;The following kernel configuration was posted by Alessandro Di Marco as a comment on a previous post in which I provided a Linux kernel config for an earlier version of the kernel. In the interest of sharing his contribution, I&amp;rsquo;m placing it in its own post. I don&amp;rsquo;t know the author personally and I have not tried this config.  Like any other free software, you are using it at your own risk and neither Alessandro nor I provide any warranty. Download the file from the link below, change the file extension from .txt. to .config and load the config into one of the standard kernel configuration tools (such as &lt;strong&gt;make menuconfig&lt;/strong&gt;) and look over all the options before using it. &lt;a href="https://shocksolution.com/files/gentoo_kernel31_config.txt"&gt;Gentoo Kernel 3.1 Config&lt;/a&gt;&lt;/p&gt;</description></item><item><title>X.org configuration for a Gentoo guest on VMWare Fusion</title><link>https://shocksolution.com/posts/xorg-configuration-for-a-gentoo-guest-on-vmware-fusion/</link><pubDate>Thu, 22 Oct 2009 03:25:37 +0000</pubDate><guid>https://shocksolution.com/posts/xorg-configuration-for-a-gentoo-guest-on-vmware-fusion/</guid><description>&lt;p&gt;Here is an &lt;a href="https://shocksolution.com/files/xorg.conf" title="xorg.conf for Gentoo guest in VMWare Fusion"&gt;xorg.conf for a Gentoo guest running in VMWare Fusion&lt;/a&gt; on MacOS 10.6 (Snow Leopard).  It&amp;rsquo;s surprisingly simple to set up X when the hardware is fake ;)  Gentoo runs great on a Macbook Pro 13&amp;quot;.  I was concerned at first about the lack of 3D acceleration, but I tried a few 3D applications and found the performance to be acceptable.  &lt;a href="http://%3Cwww.blender.org/%3E" title="Blender"&gt;Blender&lt;/a&gt; ran really smoothly with a simple model (once I found out that command-click is equivalent to middle click).  Rotating a field of several hundred spheres in &lt;a href="http://%3Cwww.paraview.org/%3E" title="Paraview"&gt;Paraview&lt;/a&gt; was a little slow, but still very acceptable. I also bought a Logitech wireless mouse, and found that the middle button works just as you&amp;rsquo;d expect (paste) in Gentoo running in Fusion.  I didn&amp;rsquo;t have to install the Logitech drivers in OS X.&lt;/p&gt;</description></item><item><title>Kernel configuration for a Gentoo guest in VMWare Fusion</title><link>https://shocksolution.com/posts/kernel-configuration-gentoo-guest-vmware-fusion/</link><pubDate>Fri, 09 Oct 2009 22:48:23 +0000</pubDate><guid>https://shocksolution.com/posts/kernel-configuration-gentoo-guest-vmware-fusion/</guid><description>&lt;p&gt;I recently installed Gentoo Linux (amd64) as a guest on my Mac (OS 10.6 Snow Leopard) using VMWare Fusion.  I thought I&amp;rsquo;d post the kernel config that I am using, since I didn&amp;rsquo;t find any out there that I trusted.  If you can use this as a starting point, then it should save you some time and trouble.  It&amp;rsquo;s a pretty minimal configuration&amp;ndash;I think I removed all the extra drivers and stuff.  You could lean it out a little more by removing the audio and a few other extras that I thought I might use.  Let me know if you have any trouble with it. &lt;a href="https://shocksolution.com/files/26Sept2009_Vmware_Gentoo_amd64.config" title="Gentoo amd64 kernel config for VMWare Fusion"&gt;Gentoo amd64 kernel config for VMWare Fusion&lt;/a&gt; So far I am very pleased with its performance.  My only disappointment is that VMWare doesn&amp;rsquo;t support Linux graphics hardware acceleration.&lt;/p&gt;</description></item></channel></rss>