{"id":1815,"date":"2015-11-13T00:00:48","date_gmt":"2015-11-12T15:00:48","guid":{"rendered":"http:\/\/www.magtranetwork.com\/?p=1815"},"modified":"2015-11-13T18:15:39","modified_gmt":"2015-11-13T09:15:39","slug":"aws_ec2_python_pysaml2_example","status":"publish","type":"post","link":"https:\/\/www.magtranetwork.com\/aws\/aws_ec2_python_pysaml2_example.html","title":{"rendered":"AWS EC2 Amazon Linux\u3067Python\u306eSAML2\u30b5\u30fc\u30d3\u30b9\u30d7\u30ed\u30d0\u30a4\u30c0\u30e9\u30a4\u30d6\u30e9\u30eapysaml2\u306eexample\u3092\u5b9f\u884c\u3059\u308b\u30b5\u30f3\u30d7\u30eb"},"content":{"rendered":"

AWS Lambda\u306b\u304a\u3044\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9ePython\u304c\u4f7f\u7528\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u3001\u4eca\u307e\u3067\u4e16\u754c\u7684\u306b\u306f\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u305f\u4e00\u65b9\u3067\u65e5\u672c\u3067\u306f\u3042\u307e\u308a\u4f7f\u7528\u3055\u308c\u3066\u6765\u306a\u304b\u3063\u305fPython\u306b\u3088\u308b\u958b\u767a\u304c\u6d3b\u767a\u5316\u3059\u308b\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u4eca\u65e5\u3053\u306e\u3054\u308d\u3067\u3059\u3002<\/p>\n

AWS Lambda Python\u3092\u4f7f\u7528\u3057\u3066\u5b9f\u73fe\u3067\u304d\u308b\u3053\u3068\u306f\u30b5\u30fc\u30d0\u30ec\u30b9\u30b7\u30b9\u30c6\u30e0(\u5b8c\u5168\u30a4\u30f3\u30d5\u30e9\u30de\u30cd\u30fc\u30b8\u30c9\u30b7\u30b9\u30c6\u30e0)\u3092\u306f\u3058\u3081\u69d8\u3005\u3067\u3059\u304c\u3001AWS Lambda Python\u3068\u89aa\u548c\u6027\u306e\u9ad8\u3044\u8a8d\u8a3c\u30b7\u30b9\u30c6\u30e0\u3092\u69cb\u7bc9\u3059\u308b\u3053\u3068\u3092\u8003\u3048\u305f\u969b\u306bPython\u3067\u69cb\u7bc9\u3055\u308c\u305f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u8a8d\u8a3c\u7cfb\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u306f\u4eca\u5f8c\u591a\u304f\u306a\u308b\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n

\u8a8d\u8a3c\u306e\u65b9\u5f0f\u3082OpenID Connect\u3001SAML2\u3068\u69d8\u3005\u3067\u3059\u304c\u4eca\u56de\u306fPython\u306eSAML2\u306e\u30e9\u30a4\u30d6\u30e9\u30eapysaml2\u306eexample\u3092Amazon Linux\u4e0a\u3067\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u5099\u5fd8\u9332\u3068\u3057\u3066\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

Python\u3067\u4f7f\u7528\u51fa\u6765\u308bSAML2\u30b5\u30fc\u30d3\u30b9\u30d7\u30ed\u30d0\u30a4\u30c0\u306e\u30e9\u30a4\u30d6\u30e9\u30eapysaml2\u306eexample\u306e\u30b5\u30f3\u30d7\u30eb\u5b9f\u884c\u4f8b<\/h2>\n

pysaml2\u306e\u5fc5\u8981\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n

yum\u3067Linux\u306e\u5fc5\u8981\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001pip\u3067python\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n

\r\n[root@localhost ~]# yum install -y gcc make libffi-devel openssl-devel libxml2-devel libtool-ltdl libtool-ltdl-devel openldap-devel\r\n[root@localhost ~]# pip install pip --upgrade\r\n[root@localhost ~]# pip install pysaml2 cherrypy python-ldap mako\r\n<\/pre>\n

pysaml2\u306b\u5fc5\u8981\u306ayum\u3067\u53d6\u5f97\u3067\u304d\u306a\u3044\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n

xmlsec1\u3001xmlsec1-openssl\u306f\u73fe\u6642\u70b9\u3067Amazon Linux\u306eyum\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u3082epel\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u3082\u5b58\u5728\u3057\u306a\u3044\u305f\u3081\u3001CentOS6\u7cfb\u306b\u8a72\u5f53\u3059\u308b\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/p>\n

\r\n[root@localhost ~]# curl -L -O ftp:\/\/ftp.pbone.net\/mirror\/ftp5.gwdg.de\/pub\/opensuse\/repositories\/home:\/bdauvergne:\/rhel6\/CentOS_CentOS-6\/x86_64\/xmlsec1-1.2.16-2.2.x86_64.rpm\r\n[root@localhost ~]# rpm -ivh xmlsec1-1.2.16-2.2.x86_64.rpm\r\n[root@localhost ~]# curl -L -O ftp:\/\/ftp.pbone.net\/mirror\/ftp5.gwdg.de\/pub\/opensuse\/repositories\/home:\/bdauvergne:\/rhel6\/CentOS_CentOS-6\/x86_64\/xmlsec1-openssl-1.2.16-2.2.x86_64.rpm\r\n[root@localhost ~]# rpm -ivh xmlsec1-openssl-1.2.16-2.2.x86_64.rpm\r\n<\/pre>\n

xmlsec1\u3001xmlsec1-openssl\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3060\u3051\u3067\u306fAmazon Linux\u306b\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3057\u3066\u8aad\u307f\u8fbc\u307e\u308c\u306a\u3044\u305f\u3081\u3001\/usr\/lib64\/\u306b\u79fb\u52d5\u3057\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u8cbc\u308b<\/p>\n

\r\n[root@localhost ~]# cd \/usr\/lib64\/\r\n[root@localhost lib64]# ln -s libxmlsec1.so.1 libxmlsec1.so\r\n[root@localhost lib64]# ln -s libxmlsec1-openssl.so.1 libxmlsec1-openssl.so\r\n<\/pre>\n

pysaml2\u672c\u4f53\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3068\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h3>\n

github\u304b\u3089pysaml2\u672c\u4f53\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3001\u9069\u5f53\u306a\u3068\u3053\u308d\u3078\u5c55\u958b\u3059\u308b<\/p>\n

\r\n[root@localhost lib64]# cd ~\r\n[root@localhost ~]# curl -L -O https:\/\/github.com\/rohe\/pysaml2\/archive\/master.zip\r\n[root@localhost ~]# unzip master.zip\r\n<\/pre>\n

example\u3092\u52d5\u4f5c\u3055\u305b\u308b\u305f\u3081\u8a72\u5f53\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3078\u79fb\u52d5\u3059\u308b\u3002
\n\u305d\u306e\u307e\u307e\u5b9f\u884c\u3059\u308b\u3068Amazon Linux\u306e\u5834\u5408\u306f\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u305f\u3081\u3001sp-wsgi\u914d\u4e0b\u306esp.py\u306b\u3064\u3044\u3066\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a72\u5f53\u7b87\u6240\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3059\u308b\u3002<\/p>\n

\r\n[root@localhost ~]# cd pysaml2-master\/example\r\n[root@localhost example]# vim sp-wsgi\/sp.py\r\n#173\u884c\u76ee\u4ed8\u8fd1\u306e\u4e0b\u8a18\u306e\u884c\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\n#cookie = cookie.decode("UTF-8")\r\n<\/pre>\n

example\u3092\u8d77\u52d5\u3055\u305b\u308b\u3002<\/p>\n

\r\n[root@localhost example]# .\/all.sh start\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

AWS Lambda\u306b\u304a\u3044\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9ePython\u304c\u4f7f\u7528\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u3001\u4eca\u307e\u3067\u4e16\u754c\u7684\u306b\u306f\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u305f\u4e00\u65b9\u3067\u65e5\u672c\u3067\u306f\u3042\u307e\u308a\u4f7f\u7528\u3055\u308c\u3066\u6765\u306a\u304b\u3063\u305fPython\u306b\u3088\u308b\u958b\u767a\u304c\u6d3b\u767a\u5316\u3059\u308b\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u4eca\u65e5\u3053\u306e\u3054\u308d\u3067\u3059\u3002 A […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3,22,79,80],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1815"}],"collection":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/comments?post=1815"}],"version-history":[{"count":2,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1815\/revisions"}],"predecessor-version":[{"id":1817,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1815\/revisions\/1817"}],"wp:attachment":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/media?parent=1815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/categories?post=1815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/tags?post=1815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}