Where to use TLS ?

agolangf · · 546 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hello gophers!</p> <p>My mind has been running in circles with TLS scenarios and I thinking maybe some of you might have gone through this and know which way to go would be best.</p> <p>Basically, there&#39;s a Golang Backend, an Angular Frontend running on Nginx or Apache, all behind an Amazon server.</p> <p>I know you can put TLS on the Amazon Load Balancer, that would mean all requests made to the frontend or backend would be protected as far as I understand ?</p> <p>If we were to take the Balancer out of the equation, would that mean we&#39;d have to put TLS on both Nginx and the Golang Backend ?</p> <p>Thanks!</p> <hr/>**评论:**<br/><br/>tmornini: <pre><p>Here&#39;s the simple answer:</p> <p>EVERYWHERE</p> <p>TLS is incredibly cheap these days. Use it everywhere, or you&#39;ll eventually expose data.</p> <p>Assuming that any AWS network is &#34;private&#34; enough to run unencrypted data across is trusting yourself, coworkers, and AWS too much.</p> <p>Did you know that MOST security backs are inside jobs?</p> <p>Encrypt everything, or you&#39;ll eventually regret it.</p></pre>elazarl: <pre><p>Except if <a href="https://xenforo.com/community/threads/adsense-ctr-cut-in-half-after-switching-to-ssl.83732/" rel="nofollow">you want to keep your ads revenue</a>.</p></pre>epiris: <pre><p>I don&#39;t really agree with this, it can end up being less secure. If you don&#39;t currently have a security product, you soon will after following this advice. If you don&#39;t have the expertise or team for it you are asking for a compromise.</p></pre>tmornini: <pre><p>Let me get this straight: encryption causes security issues?</p> <p>Explain that, please.</p></pre>epiris: <pre><p>I&#39;ve already been down voted and it&#39;s been explained else where. If you want to reduce my comment to &#34;encryption causes security issues&#34; then go for it. I&#39;m not feeding trolls on here anymore. If you really want to learn I&#39;ll take the time to explain but add ask a more specific queation and read the other reply I said was a good post first.</p></pre>cittatva: <pre><p>Honestly not trolling, if like to know more about this. Afaik, TLS can be a pain the ads to update certificates and you have to figure out some way to consistently deploy it and make sure it&#39;s enforced, but it&#39;s the only way to ensure data, like login credentials, isn&#39;t transmitted in the clear. If there&#39;s info contradicting this or edge cases I&#39;m not thinking about I&#39;d like to know about it. </p></pre>tmornini: <pre><p>Are you talking about complexity? I don&#39;t see a link you posted.</p> <p>Assuming it is complexity, there&#39;s little concern is you use automated deployments. Yes, it had to be done correctly and carefully -- but that&#39;s a truism for security in general.</p></pre>epiris: <pre><p>Your solution to mitigate the increased surface area of your application from complexity is.. to increase complexity? Okay.</p></pre>tmornini: <pre><p>There is ZERO increased surface area from TLS the way I&#39;d define it.</p> <p>And if you&#39;re now suggesting that automated deployment reduces security, it&#39;s obvious you&#39;re simply trolling.</p> <p>Repeatability is, perhaps, the best security tool of all.</p></pre>Redundancy_: <pre><p>Use CloudFront CDN with SSL to an ELB -HTTP-&gt; Go, put your static files on S3</p> <p>You get:</p> <ul> <li>DDOS / malformed request protection &amp; WAF</li> <li>Caching of static responses and metrics</li> <li>Automatic updates by Amazon for SSL security patches</li> <li>Auto-scaling support from the ELB if you need it later (and you bake AMI&#39;s etc)</li> <li>Split traffic between API and content based on path</li> <li>Don&#39;t pay for application servers for static content, upload / update separately</li> <li>Better global response times and costs for bandwidth</li> </ul></pre>Adyjay: <pre><p>Thanks, I&#39;ll look into that!</p></pre>tmornini: <pre><p>This is fantastic advice, but use HTTPS everywhere.</p> <p>EDIT: corrected HTTP -&gt; HTTPS as pointed out by <a href="/u/Redundancy_" rel="nofollow">/u/Redundancy_</a> below</p></pre>Redundancy_: <pre><p>I think you meant HTTPS everywhere, so I&#39;ll respond to that.</p> <p>There are a few reasons that I didn&#39;t advise that - </p> <ul> <li>You should probably be using a VPC with security groups for your application servers, which provides quite a lot of security. Put your ELBs in a VPC with the application, set up your security groups so that the ELB is the only externally accessible entity (only public IPs assigned, only ports open) and do SG-SG port based access for the ELB-App.</li> <li>If you don&#39;t trust AWS, your only solution would be end-to-end encryption that they couldn&#39;t cache or route in a CDN. A CDN has to look at the content to work. <ul> <li>NB: You really need to make sure that your caching directives (particularly &#39;private&#39;) are set correctly</li> </ul></li> <li>If you&#39;re not an expert and watching all the advisories, you should probably leave most of your SSL configuration to others, and reduce your stack with the use of managed and correctly configured / updated frontend load-balancers etc.</li> <li>Using SSL inside your application pushes hostname concerns into your application, which limits your flexibility quite a lot and can force some strange configuration settings. <ul> <li>For example: if you have only a single non-wildcard certificate, you&#39;ll really twist yourself in knots trying to use it on the CDN, the ELB and the application.</li> </ul></li> </ul> <p>I would personally say that unless you&#39;re dealing with something really sensitive (in which case you should be talking to AWS directly and have an Ops/InfoSec team) you&#39;ve got better things to worry about than AWS and all their security certifications and practices. You can worry about other employees trying to snoop on traffic, but most of the logging available is URL only and locking things like the ELB security groups and DNS down is more valuable, but the application code and things that happen inside the instance are way easier for someone on the inside to get at and do something with, which HTTPS won&#39;t help you with. So I&#39;d (personally) be starting with account role security, security groups and instance roles and application code auditing. Please don&#39;t give your instances full admin roles, and only let them talk to things that they need to (outgoing is usually a challenge, but you can monitor and alert on that in Cloudwatch logs these days iirc).</p> <p>Your mileage, requirements and preferences will (of course) vary, so be sure to research and make informed choices yourself based on your needs.</p></pre>epiris: <pre><p>I agree with all of this, great set of posts man. Encrypt at the edge of your network, it can actually be more secure because their is less complexity. A lot of the things you resort to with complete end of end encryption increases the attack surface greatly, SNI, managing certificates and lines of trust.. client cert Auth ends up in the mix. It adds up fast. </p></pre>tmornini: <pre><blockquote> <p>it can actually be more secure because their is less complexity</p> </blockquote> <p>And it is less secure because there is less encryption.</p> <p>If you want really good security, encrypt everything, and be careful and methodical about it.</p> <p>Works great when you have 100% automated deployment and you know what you&#39;re doing.</p> <p>The idea that it &#34;can be&#34; more secure because lower complexity is non-sensical and reductionist.</p> <p>Less is better than more -- except when it isn&#39;t.</p></pre>epiris: <pre><p>Oh man, you really shouldn&#39;t announce security related things as facts when not a SME. I don&#39;t mean offense here, but as someone in IT Security it is very obvious to me and I can pretentiously assert this with confidence based on your two comments in this thread. Please don&#39;t take this as a personal attack. You may not think much of it because you have good intent and it sounds reasonable to you but misinformation about security is dangerous. Your comment could be the little piece of empowerment that persuades someone to make a bad security related architectural decision. Just something to consider in the future.</p></pre>tmornini: <pre><p>Ad Hominem, really?</p> <p>What, EXACTLY, are you suggesting I&#39;m wrong about?</p></pre>Thaxll: <pre><p>Don&#39;t use SSL on the Go app, only Nginx.</p></pre>atesushiforlunch: <pre><p>This is really bad advice if the front- and backend happen to run on different servers in a non-private environment.</p></pre>Adyjay: <pre><p>Yeah, that&#39;s one of the reasons I&#39;m still not sure how to go with this. </p> <p>If the server is on Nginx running in 443 (HTTPS) and the Backend on 8080, even if it&#39;s the same machine, isn&#39;t the JS on the Frontend calling the Backend from the client ? Meaning the data should be encrypted in both cases, but the backend having priority ? </p> <p>Nginx is basically just serving static files.</p></pre>Tacticus: <pre><blockquote> <p>Nginx is basically just serving static files.</p> </blockquote> <p>SSL prevents tampering as well as providing security.</p></pre>da_rob: <pre><p>To the outside world there is ONLY ONE server. Nginx has to be configured as a reverse proxy to the Go backend, and your users&#39; browsers will only ever talk to Nginx.</p></pre>tmornini: <pre><p>And to skilled hackers, including bad people who work for you, there&#39;s all the servers and all the traffic on all the networks.</p> <p>Security isn&#39;t either/or it&#39;s all-or-nothing.</p> <p>Encrypt everything!</p></pre>da_rob: <pre><p>Dude, I&#39;m talking about the &#34;one machine&#34; scenario.</p></pre>tmornini: <pre><p>Haha, apologies. :-)</p></pre>da_rob: <pre><p>No worries, wasn&#39;t really clear from this thread.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

546 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传