openstack neutron-修改新創建安全組的默認規則

neutron 創建安全組會有兩條默認的出口規則


Direction

Ether Type

IP Protocol

Port Range

Remote IP Prefix

Remote Security Group

Actions



EgressIPv6AnyAny::/0-Delete Rule

EgressIPv4AnyAny0.0.0.0/0-

遇到的需求要修改它,

找了數據庫,配置文件後,在源代碼中找到了他

位置 neutron/db/securitygroups_db.py

  def create_security_group(self, context, security_group, default_sg=False):



 for ethertype in ext_sg.sg_supported_ethertypes:

    if default_sg:

    # Allow intercommunication

      ingress_rule = sg_models.SecurityGroupRule(

      id=uuidutils.generate_uuid(), tenant_id=tenant_id,

      security_group=security_group_db,

      direction='ingress',

      ethertype=ethertype,

      source_group=security_group_db)

      context.session.add(ingress_rule)

修改這段內容,完成目的。 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章