דילוג לתוכן

עזרה בהגדרות חומת אש לשרת

תכנות
5 3 357 2
  • אני מחפש סקריפט לFirewall (להריץ דרך powershell / cmd במקום להקים ידנית)
    לבצע חסימת שרת Windows Server המאוחסן בOVH
    לאפשר גישה רק מכתובות IP מישראל (+ KVM של ovh)
    וחסימה של שאר העולם

  • (למרות זה...)

    צ'אטGPT מציע לי את זה

    # Define the URL of the CSV file
    $csvUrl = "https://www.nirsoft.net/countryip/il.csv"
    
    # Download the CSV file content
    $csvContent = Invoke-WebRequest -Uri $csvUrl -UseBasicParsing | Select-Object -ExpandProperty Content
    
    # Convert the CSV content to objects
    $ipRanges = $csvContent | ConvertFrom-Csv -Delimiter "`t" -Header "StartIP", "EndIP", "Size", "Date", "Company"
    
    foreach ($range in $ipRanges) {
        $startIP = $range.StartIP
        $endIP = $range.EndIP
        $company = $range.Company
    
        # Create a firewall rule for the IP range
        New-NetFirewallRule -DisplayName "Allow $company $startIP-$endIP" -Direction Inbound -Action Allow -RemoteAddress "$startIP-$endIP"
    }
    
    Write-Output "Firewall rules have been created successfully."
    

    אני לא יושב על ווינדוס כרגע ולא בדקתי שזה עובד, אבל לפום ריהטא זה נראה הגיוני

    צריך גם להגדיר שברירת המחדל יהיה לחסום.
    משהו כזה:

    Set-NetFirewallProfile -DefaultInboundAction Block -DefaultOutboundAction Allow
    
  • (למרות זה...)

    צ'אטGPT מציע לי את זה

    # Define the URL of the CSV file
    $csvUrl = "https://www.nirsoft.net/countryip/il.csv"
    
    # Download the CSV file content
    $csvContent = Invoke-WebRequest -Uri $csvUrl -UseBasicParsing | Select-Object -ExpandProperty Content
    
    # Convert the CSV content to objects
    $ipRanges = $csvContent | ConvertFrom-Csv -Delimiter "`t" -Header "StartIP", "EndIP", "Size", "Date", "Company"
    
    foreach ($range in $ipRanges) {
        $startIP = $range.StartIP
        $endIP = $range.EndIP
        $company = $range.Company
    
        # Create a firewall rule for the IP range
        New-NetFirewallRule -DisplayName "Allow $company $startIP-$endIP" -Direction Inbound -Action Allow -RemoteAddress "$startIP-$endIP"
    }
    
    Write-Output "Firewall rules have been created successfully."
    

    אני לא יושב על ווינדוס כרגע ולא בדקתי שזה עובד, אבל לפום ריהטא זה נראה הגיוני

    צריך גם להגדיר שברירת המחדל יהיה לחסום.
    משהו כזה:

    Set-NetFirewallProfile -DefaultInboundAction Block -DefaultOutboundAction Allow
    

    @yossiz כתב בעזרה בהגדרות חומת אש לשרת:

    https://www.nirsoft.net/countryip/il.csv

    זה הרשימה המלאה?
    נטפרי למשל לא מופיעים שם (1,2)
    וכן הכתובות הקבועה/פרטית שלי (מתחיל ב89.208)

  • @yossiz כתב בעזרה בהגדרות חומת אש לשרת:

    https://www.nirsoft.net/countryip/il.csv

    זה הרשימה המלאה?
    נטפרי למשל לא מופיעים שם (1,2)
    וכן הכתובות הקבועה/פרטית שלי (מתחיל ב89.208)

    @mekev אתה צודק, צריך לחפש מקור יותר טוב
    (המקור של המידע היה ממני, לא מ-GPT אז אני מקבל על עצמי את האשמה)

  • כאן לכאורה יש את המלאה
    https://www.ip2location.com/free/visitor-blocker
    מעניין שאין להם לווינדוס, ללינוקס יש להם קובץ מוכן לפיירוול
    אז לכאורה צריך להוריד משם CIDR

    מקור
    https://tchumim.com/topic/10228

בא תתחבר לדף היומי!