Posts

Showing posts from 2017

Fresh Server Setup with Nginx, Passenger and Rails

Whenever you get a fresh server to setup it takes too much time to setup everything and sometimes you miss the essential task to perform on the server so for that this blog can help you. Once you are done with the creating the EC2 instance you'll get a pem file using that file login to the server. Login to server: chmod 400 /path_to_pem/you_pem_file_name.pem ssh -i /path_to_pem/you_pem_file_name.pem username @ec2-some_ip_seperated_by_(-)_(-).compute-1.amazonaws.com Note: username is the name of root user for ubuntu machine it “ubuntu” and for AMI(Amazon Machine Instances) is “ec2”. If you are successfully logged in to the server please do the followings: Add user(deploy) Now you need to add a user deploy in the server for deployment sudo -i export EDITOR=vim echo "export EDITOR=vim" >/etc/profile.d/editor.sh apt-get update useradd -d /home/deploy -m deploy passwd deploy apt-get install vim visudo deploy ALL=(ALL:ALL) ALL su deploy

Upload a file in S3 without any form

Uploading a file in S3 is a normal scenario but all I got is uploading the file using a form but what if I want it to upload it without any form. There are very simple steps to upload a file or object in S3 without any form. def s3_resource @s3 = Aws :: S3 :: Resource .new( region : ENV [ 'aws_region' ]) end def s3_bucket s3_resource @s3 .bucket( ENV [ 'aws_bucket' ]) end def upload_file_to_s3 ( file ) s3_resource file_name = File .basename( file ) obj = @s3 .bucket( ENV [ 'aws_bucket' ]).object( 'certificates/' + file_name ) obj .upload_file( file ) end As you can see these methods The first method s3_resource   is just creating a instance of your S3. The second method s3_bucket is initializing your bucket. Now the third one upload_file_to_s3(file) basically uploads your file in S3. In the third method In the first line initiating the s3_resource. In the second line fetching the file_name which can be abc.txt because

SAML IdP initiated SSO Resources Rails

I have been searching a lot for this to implement SAML IdP initiated SSO in Rails. Firstly what I found several resources on it for rails they are very few: 1.) ruby-saml   gem is to implement Service Provider in SAML. 2.) saml_idp gem is to implementing SAML IdP using  but this gem does not provide the way to implement IdP initiated SSO it is for SP initiated SSO. 3.) libsaml which provides the core functionality in SAML IdP but found very hard to implement SAML IdP initiated SSO because @benoist the owner of this gem does not documented it properly even all gems provided for SAML doest not have a proper documentatio. 4.) Another gem is saml_tool which actually provides the way to generate metadata and assertion for SAML request and response. 5.) And Yes, there was a great example for saml idp which saml_tools_demo which describes the use of saml_tools gem. Using Saml_idp and saml_tool gem I finally implemented SAML IdP initiated SSO. And I have described the way