Find Jobs
Hire Freelancers

PHP script to execute iptables command

$15 USD

Teljesítve
Kiadva ekkor: körülbelül 4 évvel ezelőtt

$15 USD

Teljesítéskor fizetve
I'm trying to get a web-accessible .php page to trigger an iptables command (which requires root privileges). The php page has one line: exec('sudo iptables -I INPUT 3 -s [login to view URL] -p tcp --destination-port 443 -j DROP'); I used visudo to modify /etc/[login to view URL] I have two questions that you're bidding on: QUESTION 1) Which is the correct format for the [login to view URL] file: www-data ALL=(ALL:ALL) NOPASSWD: /sbin/iptables www-data ALL = NOPASSWD: /sbin/iptables www-data ALL=(ALL) NOPASSWD: /sbin/iptables QUESTION 2) Is there a better way to do this? Should I not be allowing www-data to run iptables? The only command I need to run is "iptables -I INPUT...-j DROP" Please post your bid for answering both questions. And if #2 is "yes", for explaining what to do. Thanks for reading!
Projektazonosító: 25319179

A projektről

3 ajánlat
Távolról teljesíthető projekt
Aktiválva: 4 évvel ezelőtt

Szeretne pénzt keresni?

A Freelancer oldalán történő árajánlatadás előnyei

Határozzon meg költségvetést és időkeretet
Kapja meg fizetését a munkáért
Vázolja ajánlatát
Ingyen regisztrálhat és adhat árajánlatot munkákra
Neki odaítélve:
Felhasználó avatár
Hi, I can provide support for your task. Answers: 1) "www-data ALL=(ALL) NOPASSWD: /sbin/iptables" is the right format. 2) Yes there are better ways. You should at least put your command to script then limit sudoers right to this script only. Giving iptables access as sudoers might get really harmful.
$15 USD 1 napon belül
0,0 (0 értékelés)
0,0
0,0
3 szabadúszó adott átlagosan $18 USD összegű árajánlatot erre a munkára
Felhasználó avatár
As you have mentioned that you want to add iptables entry using php no its not recommended to give any user that is already using a services like www-data privileges to do security related tasks. if you still want to do i can do that for you but my suggestions are to use either firewall that has UI instead which i can again setup for you but not will charge a bit more for it. Second and best solution is to use a backend bash script which runs it using another user which is sudo user and a button in php script this again i can setup for you the script part and if you want to change remote servers iptables from here its again possible using ansible now any solution you want let me know.
$25 USD 7 napon belül
5,0 (1 értékelés)
0,4
0,4
Felhasználó avatár
I am new in freelancer but I've to lots of projects in my career life I believe I can do best job for you if you assign this project to me
$15 USD 2 napon belül
0,0 (0 értékelés)
0,0
0,0

Az ügyfélről

UNITED STATES zászlója
South Lake Tahoe, United States
5,0
233
Fizetési mód hitelesítve
Tagság kezdete: júl. 22, 2002

Ügyfél-hitelesítés

Köszönjük! E-mailben elküldtük a linket, melyen átveheti ajándék egyenlegét.
E-mailje elküldése során valami hiba történt. Kérjük, próbálja újra.
Regisztrált Felhasználók Összes Közzétett Munka
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Előnézet betöltése
Hozzáférést adott a helymeghatározáshoz.
Belépési munkamenete lejárt, és kijelentkeztettük. Kérjük, lépjen be újra.