Ask Your Question
0

crayfishx/firewalld add forward port

asked 2017-11-18 19:12:48 -0600

fen9li gravatar image

updated 2017-11-18 23:30:45 -0600

stivesso gravatar image

I can add http & https services as below:

My manifest:

[root@puppet profile]# cat manifests/firewalld.pp
class profile::firewalld {
  class {'::firewalld': }
}
[root@puppet profile]#

My hiera data:

[root@puppet test]# cat data/groups/rubydev-test.yaml
---
# firewall services http & https
firewalld::services:
  'Allow HTTP from public zone':
    ensure: present
    service: http
    zone: public
  'Allow HTTPS from public zone':
    ensure: present
    service: https
    zone: public
[root@puppet test]#

But failed to find a way to add forward port. I need to forward 80/tcp to 4567/tcp on same host. Can you please advise how I can merge the forward port rule into my current settings? Thank you!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-11-19 00:50:34 -0600

stivesso gravatar image

updated 2017-11-19 00:53:44 -0600

Hi Fen9li,

As you are using crashfix/firewalld, the way to add that port forwarding is to use rich rules in the following way (you can add this snippet of yaml code to your rubydev-test.yaml file, I tested and it seems to be working fine...):

firewalld::rich_rules:
  'Port Forwarding 80/tcp to 4567/tcp':
    ensure    :  present
    zone      :  public
    forward_port:
      port      : '80'
      protocol  : 'tcp'
      to_port   : '4567'

I hope to have been a help to you...

edit flag offensive delete link more

Comments

Resolved as expected. Cheers!

fen9li gravatar imagefen9li ( 2017-11-19 02:07:16 -0600 )edit
0

answered 2017-11-19 01:36:06 -0600

fen9li gravatar image

Hi stivesso,

It works perfectly. Thank you very much for your quick answer! Cheers!

fen9li

edit flag offensive delete link more

Comments

Great, you can mark this as resolved by checking (and possibly upvote) my answer...

stivesso gravatar imagestivesso ( 2017-11-19 01:40:35 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-11-18 19:12:48 -0600

Seen: 60 times

Last updated: Nov 19