fazdamoa / azure-ci-vpn

A simple solution to spin up a container instance in Azure, set up a SOCKS proxy to it, then spin it down.
The Unlicense
2 stars 0 forks source link

AuthorizationFailed - Help #1

Open pauloswear opened 4 months ago

pauloswear commented 4 months ago

Hello, how are you?

I am trying to up a proxy server using your bash script, after container is upped i try run curl in another terminal and it shows:

json
curl: (7) Failed to connect to localhost port 3128 after 0 ms: Couldn't connect to server

Container up status:

Creating SSH Container...

{
  "confidentialComputeProperties": null,
  "containers": [
    {
      "command": null,
      "environmentVariables": [
        {
          "name": "name",
          "secureValue": null,
          "value": "openssh-server"
        },
        {
          "name": "hostname",
          "secureValue": null,
          "value": "openssh-server"
        },
        {
          "name": "USER_NAME",
          "secureValue": null,
          "value": "sshuser"
        },
        {
          "name": "SUDO_ACCESS",
          "secureValue": null,
          "value": "true"
        },
        {
          "name": "PUBLIC_KEY",
          "secureValue": null,
          "value": "ssh-rsa *********** ftb@ftbpc"
        }
      ],
      "image": "fazdamoa/ftbvpn:v1",
      "instanceView": {
        "currentState": {
          "detailStatus": "",
          "exitCode": null,
          "finishTime": null,
          "startTime": "2024-04-10T16:37:23.279000+00:00",
          "state": "Running"
        },
        "events": [
          {
            "count": 1,
            "firstTimestamp": "2024-04-10T16:37:05+00:00",
            "lastTimestamp": "2024-04-10T16:37:05+00:00",
            "message": "pulling image \"fazdamoa/ftbvpn@sha256:***********\"",
            "name": "Pulling",
            "type": "Normal"
          },
          {
            "count": 1,
            "firstTimestamp": "2024-04-10T16:37:12+00:00",
            "lastTimestamp": "2024-04-10T16:37:12+00:00",
            "message": "Successfully pulled image \"fazdamoa/ftbvpn@sha256:***********\"",
            "name": "Pulled",
            "type": "Normal"
          },
          {
            "count": 1,
            "firstTimestamp": "2024-04-10T16:37:23+00:00",
            "lastTimestamp": "2024-04-10T16:37:23+00:00",
            "message": "Started container",
            "name": "Started",
            "type": "Normal"
          }
        ],
        "previousState": null,
        "restartCount": 0
      },
      "livenessProbe": null,
      "name": "ftbvpn",
      "ports": [
        {
          "port": 2222,
          "protocol": "TCP"
        }
      ],
      "readinessProbe": null,
      "resources": {
        "limits": null,
        "requests": {
          "cpu": 1.0,
          "gpu": null,
          "memoryInGb": 0.5
        }
      },
      "securityContext": null,
      "volumeMounts": null
    }
  ],
  "diagnostics": null,
  "dnsConfig": null,
  "encryptionProperties": null,
  "extensions": null,
  "id": "/subscriptions/***********/resourceGroups/ftbvpn/providers/Microsoft.ContainerInstance/containerGroups/ftbvpn",
  "identity": null,
  "imageRegistryCredentials": null,
  "initContainers": [],
  "instanceView": {
    "events": [],
    "state": "Running"
  },
  "ipAddress": {
    "autoGeneratedDomainNameLabelScope": "Unsecure",
    "dnsNameLabel": "ftbvpn",
    "fqdn": "ftbvpn.uksouth.azurecontainer.io",
    "ip": "172.166.12.116",
    "ports": [
      {
        "port": 2222,
        "protocol": "TCP"
      }
    ],
    "type": "Public"
  },
  "location": "uksouth",
  "name": "ftbvpn",
  "osType": "Linux",
  "priority": null,
  "provisioningState": "Succeeded",
  "resourceGroup": "ftbvpn",
  "restartPolicy": "OnFailure",
  "sku": "Standard",
  "subnetIds": null,
  "tags": {},
  "type": "Microsoft.ContainerInstance/containerGroups",
  "volumes": null,
  "zones": null
}
Waiting for container to accept connections...

Can you provide any additional instruction?

Thanks

fazdamoa commented 4 months ago

I've just tested the script and it is working in my WSL, although I made some changes to the url of the container.

Once the container is spun up, it takes about 30 seconds - a minute to actually accept ssh. Then you should automatically connect and it will say

You are now SSHing to the container.
Press ctrl + c ONCE to exit and delete

Once you see this, you should be able to curl on localhost and access via foxyproxy...

pauloswear commented 4 months ago

Thanks for the update. In the docs it need to be replaced:

Docs changes: (creds.txt)

spuser should be replaced with spusername rg should be defined as ftbvpn


Problems:

I still can't connect using WSL also, see the screenshot below ( I am not pressing any key )

https://prnt.sc/x_uCiKAmIIWD


Question:

The ssh user generated is ftb or is inside container value?

Example:

    {
      "name": "USER_NAME",
      "secureValue": null,
      "value": "sshuser"
    },

Also, in creds.txt means:

pubkey='ssh-rsa AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ftb@ftbpc'

If i generate some key from puttyGen I have from output something like this:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM96qmvutgBKwH1wRLLj68EejDnNUF7Bf/d5LMJBGOK4Fi/6/UxJCbouNWyvohh59S9vcfVy3CankJcfPuZX6NDWCGP/CCaQSG1UkHAJnscYFOBjUwedt1hDDHx0i8+fmhWAnd7B+7ca81mBSYuZI4S7YDNIwPrpjOeqFTQHVHpxvPaDkoumJLFQvsse0gOhfZWkVYXYfSZrJ3kodwGMdSfQb6uSvv7dmi+9WXnIWlgd46VmCF3TUO4L3G//C+dAQ6ir85htsxM4dZQgK2KYziOcNObA+q6IpsaCwb/PKZCeZhuHBhfmv2x33KDFqVSEXgBXzTLoaXonjzLBKhQGED rsa-key-20240412

Should I replace pubkey like this?

pubkey=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM96qmvutgBKwH1wRLLj68EejDnNUF7Bf/d5LMJBGOK4Fi/6/UxJCbouNWyvohh59S9vcfVy3CankJcfPuZX6NDWCGP/CCaQSG1UkHAJnscYFOBjUwedt1hDDHx0i8+fmhWAnd7B+7ca81mBSYuZI4S7YDNIwPrpjOeqFTQHVHpxvPaDkoumJLFQvsse0gOhfZWkVYXYfSZrJ3kodwGMdSfQb6uSvv7dmi+9WXnIWlgd46VmCF3TUO4L3G//C+dAQ6ir85htsxM4dZQgK2KYziOcNObA+q6IpsaCwb/PKZCeZhuHBhfmv2x33KDFqVSEXgBXzTLoaXonjzLBKhQGED