Changeset cde5353 for apps


Ignore:
Timestamp:
Apr 8, 2019 8:37:58 PM (12 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6237fc8
Parents:
5490de1
Message:

i2ptunnel: Config UI for encrypted ls2

Location:
apps/i2ptunnel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java

    r5490de1 rcde5353  
    538538        return getBooleanProperty(tunnel, "i2cp.encryptLeaseSet");
    539539    }
     540   
     541    /**
     542     *  @since 0.9.40
     543     */
     544    public int getEncryptMode(int tunnel) {
     545        if (getEncrypt(tunnel))
     546            return 1;
     547        if (getProperty(tunnel, "i2cp.leaseSetType", "1").equals("5")) {
     548            String pw = getBlindedPassword(tunnel);
     549            if (pw != null && pw.length() > 0)
     550                return 3;
     551            return 2;
     552            // LS auth (rv 4-7) TODO
     553        }
     554        return 0;
     555    }
     556   
     557    /**
     558     *  @since 0.9.40
     559     */
     560    public String getBlindedPassword(int tunnel) {
     561        return getProperty(tunnel, "i2cp.leaseSetSecret", "");
     562    }
    540563
    541564    /**
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/TunnelConfig.java

    r5490de1 rcde5353  
    256256            _booleanOptions.remove("i2cp.encryptLeaseSet");
    257257    }
     258
     259    /** @since 0.9.40 */
     260    public void setEncryptMode(int mode) {
     261        switch (mode) {
     262        case 0:
     263        default:
     264            setEncrypt(false);
     265            _otherOptions.remove("i2cp.leaseSetSecret");
     266            break;
     267
     268        case 1:
     269            setEncrypt(true);
     270            _otherOptions.remove("i2cp.leaseSetType");
     271            // doesn't work, after this in the form
     272            _otherOptions.remove("i2cp.leaseSetSecret");
     273            break;
     274
     275        case 4:
     276        case 6:
     277            // TODO
     278            // Fallthrough
     279        case 2:
     280            setEncrypt(false);
     281            _otherOptions.put("i2cp.leaseSetType", "5");
     282            // doesn't work, after this in the form
     283            _otherOptions.remove("i2cp.leaseSetSecret");
     284            break;
     285
     286        case 5:
     287        case 7:
     288            // TODO
     289            // Fallthrough
     290        case 3:
     291            setEncrypt(false);
     292            _otherOptions.put("i2cp.leaseSetType", "5");
     293            break;
     294        }
     295    }
     296   
     297    /** @since 0.9.40 */
     298    public void setBlindedPassword(String s) {
     299        if (s != null && s.length() > 0)
     300            _otherOptions.put("i2cp.leaseSetSecret", s);
     301        else
     302            _otherOptions.remove("i2cp.leaseSetSecret");
     303    }
     304
    258305    public void setDCC(boolean val) {
    259306        if (val)
     
    804851         PROP_MAX_TOTAL_CONNS_MIN, PROP_MAX_TOTAL_CONNS_HOUR, PROP_MAX_TOTAL_CONNS_DAY,
    805852         PROP_MAX_STREAMS, I2PClient.PROP_SIGTYPE,
    806         "inbound.randomKey", "outbound.randomKey", "i2cp.leaseSetSigningPrivateKey", "i2cp.leaseSetPrivateKey",
    807          I2PTunnelServer.PROP_ALT_PKF
     853         "inbound.randomKey", "outbound.randomKey", "i2cp.leaseSetSigningPrivateKey", "i2cp.leaseSetPrivateKey",
     854         I2PTunnelServer.PROP_ALT_PKF,
     855         "i2cp.leaseSetSecret"
    808856        };
    809857    private static final String _httpServerOpts[] = {
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java

    r5490de1 rcde5353  
    211211    public boolean getEncrypt(int tunnel) {
    212212        return _helper.getEncrypt(tunnel);
     213    }
     214   
     215    /**
     216     *  @since 0.9.40
     217     */
     218    public String getEncryptMode(int tunnel) {
     219        return Integer.toString(_helper.getEncryptMode(tunnel));
     220    }
     221   
     222    /**
     223     *  @since 0.9.40
     224     */
     225    public String getBlindedPassword(int tunnel) {
     226        return _helper.getBlindedPassword(tunnel);
    213227    }
    214228   
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java

    r5490de1 rcde5353  
    826826    }
    827827
     828    /** @since 0.9.40 */
     829    public void setEncryptMode(String val) {
     830        if (val != null) {
     831            try {
     832                _config.setEncryptMode(Integer.parseInt(val.trim()));
     833            } catch (NumberFormatException nfe) {}
     834        }
     835    }
     836   
     837    /** @since 0.9.40 */
     838    public void setNofilter_blindedPassword(String s) {
     839        _config.setBlindedPassword(s);
     840    }
     841
    828842    /** @since 0.8.9 */
    829843    public void setDCC(String moo) {
  • apps/i2ptunnel/jsp/editServer.jsi

    r5490de1 rcde5353  
    495495        <tr>
    496496            <td colspan="2">
    497                 <label title="<%=intl._t("Only clients with the encryption key will be able to connect")%>"><input value="1" type="checkbox" id="startOnLoad" name="encrypt"<%=(editBean.getEncrypt(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
    498                 <%=intl._t("Only allow clients with the encryption key to connect to this server")%></label>
     497                <%
     498                   String curEncryptMode = editBean.getEncryptMode(curTunnel);
     499                  %>
     500                <span class="multiOption"><label title="<%=intl._t("Allow all clients to connect to this service")%>"><input value="0" type="radio" name="encryptMode"<%=(curEncryptMode.equals("0") ? " checked=\"checked\"" : "")%> class="tickbox" />
     501                    <%=intl._t("Disable")%></label></span>
     502                <span class="multiOption"><label title="<%=intl._t("Only clients with the encryption key will be able to connect")%>"><input value="1" type="radio" name="encryptMode"<%=(curEncryptMode.equals("1") ? " checked=\"checked\"" : "")%> class="tickbox" />
     503                    <%=intl._t("Encrypted")%></label></span>
     504                <%
     505                    int curSigType = editBean.getSigType(curTunnel, tunnelType);
     506                    if (curSigType == 7 || curSigType == 11) {
     507                  %>
     508                <span class="multiOption"><label title="<%=intl._t("Prevents snooping by floodfills")%>"><input value="2" type="radio" name="encryptMode"<%=(curEncryptMode.equals("2") ? " checked=\"checked\"" : "")%> class="tickbox" />
     509                    <%=intl._t("Blinded")%></label></span>
     510                <span class="multiOption"><label title="<%=intl._t("Only clients with the password will be able to connect")%>"><input value="3" type="radio" name="encryptMode"<%=(curEncryptMode.equals("3") ? " checked=\"checked\"" : "")%> class="tickbox" />
     511                    <%=intl._t("Blinded with password")%></label></span>
     512                  <%
     513                     if (editBean.isAdvanced()) {
     514                         // TODO, unimplemented
     515                    %>
     516                <span class="multiOption"><label title="<%=intl._t("Only clients with the encryption key will be able to connect")%>"><input value="4" type="radio" name="encryptMode"<%=(curEncryptMode.equals("4") ? " checked=\"checked\"" : "")%> class="tickbox" />
     517                    <%=intl._t("Blinded with shared key")%></label></span>
     518                <span class="multiOption"><label title="<%=intl._t("Only clients with the password and key will be able to connect")%>"><input value="5" type="radio" name="encryptMode"<%=(curEncryptMode.equals("5") ? " checked=\"checked\"" : "")%> class="tickbox" />
     519                    <%=intl._t("Blinded with shared key and password")%></label></span>
     520                <span class="multiOption"><label title="<%=intl._t("Only clients with the encryption key will be able to connect")%>"><input value="6" type="radio" name="encryptMode"<%=(curEncryptMode.equals("6") ? " checked=\"checked\"" : "")%> class="tickbox" />
     521                    <%=intl._t("Blinded with per-user key")%></label></span>
     522                <span class="multiOption"><label title="<%=intl._t("Only clients with the password and key will be able to connect")%>"><input value="7" type="radio" name="encryptMode"<%=(curEncryptMode.equals("7") ? " checked=\"checked\"" : "")%> class="tickbox" />
     523                    <%=intl._t("Blinded with shared password and per-user key")%></label></span>
     524                <%
     525                        } // isAdvanced()
     526                    } // curSigType
     527                  %>
    499528            </td>
    500529        </tr>
     
    519548            </td>
    520549        </tr>
     550
     551        <%
     552            if (curSigType == 7 || curSigType == 11) {
     553          %>
     554        <tr>
     555            <td>
     556                <b><%=intl._t("Blinded Password")%>:</b>
     557                <input type="password" name="nofilter_blindedPassword" title="<%=intl._t("Set password required to access this service")%>" value="<%=editBean.getBlindedPassword(curTunnel)%>" class="freetext password" />
     558            </td><td> </td>
     559        </tr>
     560        <%
     561            } // curSigType
     562          %>
    521563
    522564        <tr>
Note: See TracChangeset for help on using the changeset viewer.