cristinaITdeveloper / react-native-ipsec-ikev2

MIT License
10 stars 4 forks source link

not working #1

Open yasirwahid opened 3 years ago

yasirwahid commented 3 years ago

Hey, i have tried react-native-ip-sec-vpn and its listeners are working but cant seem to connect the vpn in android.

then i have tried this library and its example project is crashing, when i installed the library in a new custom app its listeners of state change are not working , seems like nothing is happening what i have done wrong?

i have copy pasted example app.js code.

brobin002 commented 3 years ago

Same issue, did you find a solution?

usamabinishaq commented 2 years ago

Hi I am Facing Same issue Did you find any solution

cristinaITdeveloper commented 2 years ago

Sorry, but the project is only a test and unfortunately it doesn't work. I will remove it from github.

darknessproduction commented 2 years ago

Actually I made it working. Just use a valid certificate. I used CA as b64ca and certificate from .sswan as b64userCert

darknessproduction commented 2 years ago

Just tested it on android TV box (android 9) and friend's phone on android 12 :)

darknessproduction commented 2 years ago

@cristinaITdeveloper thanks for the work btw

  connectVpn = () => {
    if(selectedServer == null){
      Alert.alert('Error', 'You have to choose a server')
    } else {
      setIsConnecting(true)
      connect(
        'example', 
        selectedServer.address, 
        selectedServer.username, 
        selectedServer.password, 
        selectedServer.vpnType, 
        selectedServer.secret, 
        false, 
        0, 
        selectedServer.b64CaCert, 
        selectedServer.b64UserCert,
        ''
      )
      .then((r) => {
        setIsConnecting(false);
        console.log(r, 'connected');
      })
      .catch((error) => {
        setIsConnecting(false);
        console.log('eeeerrrr', error);
      })
    }
  }

I used CA cert (ikev2vpnca.cer) generated by this: openssl pkcs12 -in vpnclient.p12 -cacerts -nokeys -out ikev2vpnca.cer And User cert is taken from here. /root/vpnclient.sswan (for Android) It's automatically created with the oneliner to set up vpn: https://github.com/hwdsl2/setup-ipsec-vpn

darknessproduction commented 2 years ago

And vpnType & secret could be empty as they are not used: https://github.com/cristinaITdeveloper/react-native-ipsec-ikev2/blob/c6239c2de8f00431a414290f03f22caa98929034/android/src/main/java/com/sijav/reactnativeipsecvpn/RNIpSecVpn.java#L139

darknessproduction commented 2 years ago

Cristina, are you going to continue working on this?

cristinaITdeveloper commented 2 years ago

@darknessproduction unfortunately I can't work on it at the moment. If you want you can contribute on this.

Grkmyldz148 commented 2 years ago

@darknessproduction Hi, what version of React Native are you using?

darknessproduction commented 2 years ago

@Grkmyldz148

{ "name": "darkpass", "version": "0.0.1", "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "lint": "eslint ." }, "dependencies": { "react": "16.13.1", "react-native": "0.63.2", "react-native-ikev2-ipsec": "^1.1.15" }, "devDependencies": { "@babel/core": "^7.8.4", "@babel/runtime": "^7.8.4", "@react-native-community/eslint-config": "^1.1.0", "babel-jest": "^25.1.0", "eslint": "^6.5.1", "metro-react-native-babel-preset": "^0.59.0", "prettier": "2.0.5" }, "jest": { "preset": "react-native" } }