calebb
[H]F Junkie
- Joined
- Mar 26, 2000
- Messages
- 8,758
So the python code will monitor /var/www/temp folder for a <username>.lock file with the hashed password inside
If found, it takes the username from the filename, and the hashed password inside, executes the sed command (sed -i "s/$username $oldpw/$username $newpw/" <file>) then deletes that lock file?
If I am missing anything, lemme know.
Can this be done with PHP or Perl? Rather than python or ruby? heh
What owner/group will be of the temp folder? and what chmod should I have it as?
You cannot use perl or php since those programs have 'timeouts' - they can only run for a certain amount of time and then they will stop running. Python is a very easy language to learn - especially if you are familiar with programming in general. Just find some intro python tutorials and steal a sample program. Even better, you cn just type "python" and start running python commands line-by-line to test them.... But with Python you can set a program to continue running forever - perhaps a 1 sec sleep between checking the /temp folder.
The permissions for the temp folder depend on the ownership. Apache is run by the www-data user. So if the www-data user is the owner of the temp folder, then you would be fine with 700 or 755 access. Now, if www-data is not the owner of that folder, you would check to see if the w www-data user was a member of the group that owns the temp folder.... if it was... 775 or 770. If none of the above, 777 would be ok.
My advice: chgrp the /temp directory to the same as the /www directory. chown the /temp directory to the www-data. Use 775. Actually, I would need to do some more research, but you might want to skip execute permission - 665 or 660 - that way if someone manages to save malicious code to that directory, it cannot be executed. But that might be security overkill...
Other than that, it sounds like you have a good plan-of-action! I'm surprised nobody else has chimed in with their 2 cents - but this method looks very secure to me and should keep you dc++ node safe