Giving people limited shell access to your server

At work, I develop all kinds of backend software. We have a team of testers for high-level testing (in addition to the many unit-tests we have).

At some point, I had written a Perl script that was going to run daily, from cron, processing some input and generating some output. Since our testers currently don’t have shell access to our development servers, the challenge was to find a simple way for them to test this script, with different inputs, and verifying that the output was correct.

I looked around on the internet for a simple solution to this. I couldn’t find any. So I wrote a solution myself: WRATS – Web Restricted Access To Server.

With WRATS, you can allow people to perform the following actions via a browser:

  • Read a file
  • Edit a file
  • Execute a file
  • Browse a directory and read all files in that directory

By default, all access is denied. You have to grant permission to each action on each item individually. For example, you can allow people to read the file /data/input.txt or edit the file /var/www/test/status.

There is no authentication in WRATS. This is by design – adding pluggable authentication would have made it too complex and too much work. If you want to make sure WRATS can only be used by certain users, I suggest you use your web server to do that.

WRATS has been designed with security in mind. For example, it is not possible to specify both edit rights and execute rights on a single file – that would make it possible to execute arbitrary code. Also, filenames passed by the user are strictly checked before any action is performed.

WRATS allowed our testers to edit the input file, execute the script, and read the output file. They were happy, because they didn’t have to come to me anymore to ask me to run the script for them with the input they had emailed me just before, and I was happy, because of the same reason. And the rest of the team was happy, because WRATS can be used for other projects in the future as well.

You can find WRATS on my github page. I hope it’ll be useful to you one day!

Posted in software development | Tagged , , , , , , , | Leave a comment

Pancake draft: cube draft for two players

Magic: the Gathering has been one of my favourite games ever since I learned to play it in 1994. When I was in highschool, I played a lot with local friends. However, when I went to university, our play group slowly fell apart and I played less and less.  For about ten years, I didn’t play Magic at all.

Somewhere in 2011, I decided to see if Magic was still popular, and it turned out that it was. I couldn’t resist, and started playing again.

I learned of an interesting alternative to Booster draft: Cube draft. Not having a big play group nearby, I investigated whether there are any good ways to draft with 2 players. There are some ways, like Winston draft, Solomon draft and Continuous draft. However, these drafts don’t give you the “pick one card from many” experience that Booster draft gives you.

My friend Merlijn and I discussed how to make a two-player cube draft format that is more similar to an eight-player draft in the “choose which card you want” stage. We didn’t want to choose between piles that contain relatively many junk cards, or split piles to have the other player choose which pile they want. After some testing with my Cube, this is what we ended up with. We call it the Pancake Draft.

Start by creating 18 “boosters” of 11 random cards from the Cube each.

The two players, A and B, each take one booster, 1 and 2, and choose one card from it. They draft this card to their card pool.

Step 1

Then, the stacks (now 10 cards each) are exchanged.

Step 2

Each player now chooses 2 cards from the stack of 10, that was opened by the other player, to add to their card pool. The stacks are now 8 cards each.

Step 3

The next step is for each player to choose 2 cards from their pile to put in the trash, face down. These two cards will not be used in the draft.

Step 4

Then, the stacks are swapped again, so each player gets their original stack back. There are 6 cards left in each stack.

Step 5

Then, each player chooses two cards to draft to their pool.

Step 6

Finally, the remaining four cards are put face down in the trash.

This way, each player drafts several cards out of several stack sizes: 1 of 11, 2 of 10, and 2 of 6. In total, each player gets 5 cards from each pair of stacks. 18 stacks means 9 times 5 equals 45 cards each. Add basic land and play with 40+ card decks, as usual.

To reach this, we went through a few iterations.

First, we tried having boosters of 9 cards. The first player picks 2 out of 9, then the second player picks 4 out of the remaining 7, and the first player gets the last 3. The main disadvantage of this method was that both players would end up with a lot of junk, which made it difficult to even build a reasonable deck.

Then, we tried boosters of 9 cards again, with the picks being 1 out of 9, then 2 out of 8, then 2 out of 6, and the remaining 4 cards would go to the trash. This made our decks significantly better. However, it was still trivial to read what your opponent was drafting. This made the draft boring and easy: just draft 2 colours your opponent is not drafting, and both players end up with tons of playable cards.

The “trash 2 cards” part after the second pick helps immensely with this problem. It serves two goals: obscuring what you picked, and allowing the possibility to hate draft cards that you really don’t want to play against.

We are happy with this two-player Cube draft format! It allows us to experience almost the “real” draft feeling even if it’s just the two of us playing.

There are some changes that can be made to the numbers involved. For example, playing 12 card boosters instead of 11. Or trashing 3 cards instead of 2. This might make the format even better. We are still experimenting with it, and would like to hear other people’s thoughts about that.

Have you tried Pancake Cube drafting? I’d love to hear your feedback in the comments!

Posted in games, magic | Tagged , , , , , , , , , , , , , | 7 Comments

Diablo 3: practical melee Wizard guide for buying budget gear