Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There was a series of <a href="http://railscasts.com" rel="nofollow noreferrer">RailsCasts</a> episodes that covered background tasks.</p> <p>Most fittingly to your problem is perhaps <a href="http://railscasts.com/episodes/127-rake-in-background" rel="nofollow noreferrer">"Rake in Background"</a>, which could be a good starting point? As the name suggests, it covers triggering rake tasks from Ruby on Rails.</p> <p>The most obvious solution to changing system-settings would be to have a daemon running as root, which accepts a few (very limited and strictly sanitised) inputs, such as a new hostname, or the new IP address for the server.. The other episodes <a href="http://railscasts.com/episodes/128-starling-and-workling" rel="nofollow noreferrer">"Starling and Workling"</a> and <a href="http://railscasts.com/episodes/129-custom-daemon" rel="nofollow noreferrer">"Custom Daemon"</a> may help with this too.</p> <p>A cleaner solution would be to use <code>sudo</code>. There's two (similar) ways to do this I can think of:</p> <p>Allow sudo access to certain commands (like <code>hostname</code>, <code>ifconfig</code>) to the user that will run the rake tasks. This can have big security problems. My favourite example of this is allowing sudo access to vim, which seems innocuous, until you run <code>sudo vim</code>, then <code>!bash</code> and suddenly you have full-root access to a machine via text editor..</p> <p>The other way (that is easier to do securely) - have a rake task (or a few separate scripts) that performs the required tasks (changing hostname, for example). Say, <code>/usr/bin/myapp_systemtasks</code> owned by <code>root:root</code>, then allow sudo access to that script. Make sure you are very careful to sanitise the input that script accepts (to prevent things like shell-escaping).</p> <p>So, there are ways to do it, but at the end of the day you are making a web-interface to system-level configurations, which is very difficult to do securely.. Whatever you decide to do, make sure it's well tested (by you, and others)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload