正如标题所说,谷歌没有提供任何有用的信息.
如何为Sinatra应用程序设置和配置HTTPS/SSL?
如何创建HTTPS路由?
我以前从来没有为我的应用程序使用HTTPS,也没有调整Rack /的经验,所以我很感激详细的答案.
尽管有使用SSL/https /等的所有建议.我决定在我的应用程序的http顶部实现我自己的安全层...这个概念的工作原理如下:
User registers -> a new RSA Keypair is generated
the Private Key gets encrypted with AES using the users login Password
(which the server doesnt know - it has only the sha256 for authentication...)
Server stores the hash of the users password
and the Encrypted Private Key and Public Key
User logs in -> authenticates with nickname+password hash
(normal nick/password -> IP-bound sessionid authentication)
Server replies: sessionid, the Encrypted RSA Private Key
and an Encrypted randomly generated Session …Run Code Online (Sandbox Code Playgroud) 我或多或少地遵循了这个教程...我安装了乘客宝石,执行了乘客安装ginx模块,成功安装了nginx并将其插入到配置中:
server {
listen 80;
server_name localhost;
root /home/admin/sintest/public; # <--- be sure to point to 'public'!
passenger_enabled on;
}
Run Code Online (Sandbox Code Playgroud)
在/ home/admin/sintest我有:一个空的公共文件夹,config.ru:
require 'sinatra'
set :env, :production
disable :run
require './app.rb' #the app itself
run Sinatra::Application
Run Code Online (Sandbox Code Playgroud)
和测试sinatra app.rb:
require 'sinatra'
get '/' do
"hello world!"
end
Run Code Online (Sandbox Code Playgroud)
现在,当我运行nginx并打开http:// localhost时,我得到的是:403 Forbidden
我究竟做错了什么?我错过了什么吗?
我目前正在学习反应性香蕉的FRP,并希望创建一个随机函数流.我想出来了:
-- | take number generator, and some pulse event stream, generate random function stream
mkRandom :: (Random a,RandomGen g) => g -> Event t b -> Event t ((a,a) -> a)
mkRandom rng es = (\f -> \r -> fst $ f r) <$> (accumE first $ next <$> es)
where first = flip randomR rng
next _ prev range = randomR range g
where (a,g) = prev range
Run Code Online (Sandbox Code Playgroud)
它似乎工作,我可以像这样使用它:
randFuncs = mkRandom rnd (pulse 1000 time)
some = …Run Code Online (Sandbox Code Playgroud) 在之前的一个问题中,我询问了我自己的安全层概念中的弱点......它依赖于JavaScript加密函数,并且由于现在的答案,引人注目的一点很明显,在Javascript中完成的所有事情都可以被操纵并且不可信任. ..
现在的问题是 - 我仍然需要使用它们,即使我依靠SSL进行传输......
所以我想问一下 - 有没有办法让服务器检查该网站是否正在使用来自服务器的"正确"javascript?
任何我想到的东西(如散列等)都可能显然是伪造的......并且服务器似乎没有任何可能知道在它发送一些数据之后在客户端发生了什么,通过HTTP头部解决( - > cookie交换和东西)
在反应香蕉<1.0.0,这工作:
-- takes a start value, minimum and maximum value, flag whether counter is
-- cyclic, an increment and decrement event stream and returns a behavior
mkCounter :: (Enum a,Ord a) => a -> Maybe a -> Maybe a -> Bool
-> Event t b -> Event t c -> Behavior t a
mkCounter start minVal maxVal cyclic incE decE = counter
let incF curr | isNothing maxVal = succ
| Just maxv <- maxVal, curr<maxv = succ
| Just …Run Code Online (Sandbox Code Playgroud) 想象一下,服务器正在向其合作伙伴提供用户的公钥,以实现加密通信.但是,服务器无权访问私钥.
无论如何 - 假设服务器被黑客攻击并且它不发送所请求的公钥:
Alice请求Bob的公钥
Server发送Eve的公钥Bob请求Alice的公钥
服务器发送Eve的公钥Alice向Bob
Server解压缩消息发送消息,读取并重新打包 - >发送给Bob ...Bob向Alice
Server 发送消息解压缩消息,读取并重新打包 - >发送给Alice ...
我的问题是 - 如何防止这种滥用?Alice如何确定她正在使用Bob的公钥,反之亦然?
cryptography ×2
haskell ×2
rsa ×2
ruby ×2
security ×2
sinatra ×2
aes ×1
encryption ×1
https ×1
javascript ×1
nginx ×1
public-key ×1
ssl ×1