George Opritescu

Developer from somewhere

terraform verbose mode

If you’re facing such an error:

UnauthorizedOperation: You are not authorized to perform this operation.

Run terraform like this:

TF_LOG=1 terraform apply

And this will most likely help you further with your debugging.

Read More

decoding encoded amazon authorization messages

If you receive something like this as a result of an aws operation:

You are not authorized to perform this operation. Encoded authorization failure message: (redacted)

Then, you can decode it like this:

aws sts decode-authorization-message --encoded-message redacted

To have the above command work, make sure your user has the sts:DecodeAuthorizationMessage grant.

Read More

Could not load got :badfile

Received an error like this in the console:

Could not load module WebAssist.Repo, got: badfile
[error] beam/beam_load.c(1278): Error loading module 'Elixir.WebAssist.Repo':
  module name in object code is Elixir.Webassist.Repo

Turns out, the module name was Webassist, and not WebAssist.

Read More

amazon sns http endpoint post

Turns out the requests coming from Amazon SNS have

1
Content-Type: text/plain
, even though they are JSON. One way to handle them in a rails app is this:

amazon_params = JSON.parse(request.raw_post)

Notice that we’re using

1
raw_post
, because params won’t have the body parsed.

Read More

curl post json body from file

curl -H "Content-Type: application/json" -X POST -d @file.json url
Read More

setting default ruby via rvm

rvm --default use 2.3.0
Read More

sftp permission denied on chrooted centos

I had the following in my sshd_config:

Match Group myftpgroup
  Allowtcpforwarding no
  Chrootdirectory %h
  Forcecommand internal-sftp

Imagining a user called john, this was the setup:

  • /home was owned by root
  • /home/john was owned by root
  • the files inside john were john’s own files

With all these in place, this was what I received when sftp-ing:

sftp> put README.md
Uploading README.md to /new/README.md
remote open("/new/README.md"): Permission denied

Turns out, it was caused by selinux, and the fix was to run this cmd:

setsebool -P ssh_chroot_rw_homedirs on
Read More

enabling a user to connect to a machine using his ssh key

Assuming your user name is john, pasting the contents of the user’s public key in

1
/home/john/.ssh/authorized_keys
on the server, will allow him to login using only his ssh key.

Read More
ssh

ignore git files only locally

If you have untracked files that you’d like ignored, add them to

1
.git/info/exclude
. Same syntax as in a .gitignore file.

Read More
git

preparing with automatic deployments for a new server with chef

To be able to do a pull on a newly created machine, without you having to do an initial ssh to github, or some other host, you can do this in a recipe:

ssh_known_hosts_entry 'github.com'

This comes from the ssh_known_hosts cookbook

Read More