Showing posts with label http. Show all posts
Showing posts with label http. Show all posts

2.19.2015

Open HTTP port 80 on CentOS

Got from here.
1. Look at the current iptables
# iptables --line -vnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1        0     0 ACCEPT     udp  --  virbr0 *       0.0.0.0/0            0.0.0.0/0           udp dpt:53
2        0     0 ACCEPT     tcp  --  virbr0 *       0.0.0.0/0            0.0.0.0/0           tcp dpt:53
3        0     0 ACCEPT     udp  --  virbr0 *       0.0.0.0/0            0.0.0.0/0           udp dpt:67
4        0     0 ACCEPT     tcp  --  virbr0 *       0.0.0.0/0            0.0.0.0/0           tcp dpt:67
5     195K  212M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
6        3   252 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0
7       74  5440 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
8       16   864 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
9     170K   39M REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

2. Inject rule, as long as it's before the REJECT line
# iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

3. Save
# service iptables save

4. Add httpd_t to the list of permissive domains (So we don't need to turn off selinux)
# yum install policycoreutils-python
# semanage permissive -a httpd_t

10.15.2013

Open up Firewall of Fedora Core 19

Here's the whole write up on FirewallD.
How you would open up http and https, or specific ports for your box:
$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=https
Restart the firewall:
$ sudo systemctl restart firewalld.service
Or on specific ports:
$ sudo firewall-cmd --permanent --zone=public --add-port=9393/tcp
Restart the firewall:
$ sudo systemctl restart firewalld.service