jpsider / RestPS

Simple ReST Framework for Powershell
MIT License
113 stars 30 forks source link

Added Client IP authentication #59

Closed cyberblob closed 3 years ago

cyberblob commented 3 years ago

This allows you to restrict RestPS to only be accessed from specific IP's

jpsider commented 3 years ago

Looks like there are still a couple bud failures. Are you able to see them? Want to tackle them or for me to take a crack?

cyberblob commented 3 years ago

All cleared up now.

cyberblob commented 3 years ago

Oh ya we can fix that. It does not need to be hard coded just need to be in bin. Need to add back the param I bet then fix the path. No prob

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Justin Sider @.> Sent: Thursday, August 5, 2021 5:39:51 AM To: jpsider/RestPS @.> Cc: cyberblob @.>; Author @.> Subject: Re: [jpsider/RestPS] Added Client IP authentication (#59)

@jpsider commented on this pull request.


In RestPS/private/Invoke-ValidateIP.ps1https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjpsider%2FRestPS%2Fpull%2F59%23discussion_r683337560&data=04%7C01%7C%7Cbd5819501cd7441b447a08d957fd5b77%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637637567935465560%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wP%2FixXS29Fpvy39yG9SwGK44NPsBL0jJIK2lwWZsC2I%3D&reserved=0:

  • This function provides several way to validate or authenticate a client base on acceptable IP's.
  • .PARAMETER VerifyClientIP
  • A VerifyClientIP is optional - Accepted values are:$false or $true
  • .EXAMPLE
  • Invoke-ValidateIP -VerifyClientIP $true -RestPSLocalRoot c:\RestPS
  • .NOTES
  • This will return a boolean.
  • >

  • [CmdletBinding()]
  • [OutputType([boolean])]
  • param(
  • [Parameter()][Bool]$VerifyClientIP
  • )
  • if ($VerifyClientIP -eq $true)
  • {
  • . c:\restps\bin\Get-RestIPAuth.ps1

Not a huge fan of hard-coding paths, this would not work on Linux.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjpsider%2FRestPS%2Fpull%2F59%23pullrequestreview-723201527&data=04%7C01%7C%7Cbd5819501cd7441b447a08d957fd5b77%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637637567935475515%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2JHLM0grdHLnpNuWZzHgGFr0N9LuMJxDlI03VycBBm8%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAHERQEOKUMZHZDNKWPENYDT3JS7PANCNFSM5BNLJPMA&data=04%7C01%7C%7Cbd5819501cd7441b447a08d957fd5b77%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637637567935475515%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=gn4pEPt5t9al8jntk%2BJiKREtF7AK9VIFQvqUu6Ufbqg%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7C%7Cbd5819501cd7441b447a08d957fd5b77%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637637567935485475%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XwEAyMj0T9BQbuQRoSvXJwI59PuNIDMo5jXW107xgr8%3D&reserved=0 or Androidhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26utm_campaign%3Dnotification-email&data=04%7C01%7C%7Cbd5819501cd7441b447a08d957fd5b77%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637637567935485475%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2lIHDcyqWNDkHY%2Fih0JRVPa5KVT204acrNninMGhiRs%3D&reserved=0.

jpsider commented 3 years ago

RestPS 7.0.42 - was just published to the PowerShell Gallery.