aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/main.go1
-rw-r--r--cmd/geth/usage.go1
-rw-r--r--cmd/utils/flags.go27
3 files changed, 29 insertions, 0 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 1b23cbd9f..d0a9bb08a 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -66,6 +66,7 @@ var (
utils.KeyStoreDirFlag,
utils.ExternalSignerFlag,
utils.NoUSBFlag,
+ utils.SmartCardDaemonPathFlag,
utils.DashboardEnabledFlag,
utils.DashboardAddrFlag,
utils.DashboardPortFlag,
diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go
index 67b0027f2..4cc77b912 100644
--- a/cmd/geth/usage.go
+++ b/cmd/geth/usage.go
@@ -72,6 +72,7 @@ var AppHelpFlagGroups = []flagGroup{
utils.AncientFlag,
utils.KeyStoreDirFlag,
utils.NoUSBFlag,
+ utils.SmartCardDaemonPathFlag,
utils.NetworkIdFlag,
utils.TestnetFlag,
utils.RinkebyFlag,
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 93d162370..7e19ebc0c 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -58,6 +58,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/netutil"
"github.com/ethereum/go-ethereum/params"
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
+ pcsclite "github.com/gballet/go-libpcsclite"
cli "gopkg.in/urfave/cli.v1"
)
@@ -129,6 +130,11 @@ var (
Name: "nousb",
Usage: "Disables monitoring for and managing USB hardware wallets",
}
+ SmartCardDaemonPathFlag = cli.StringFlag{
+ Name: "pcscdpath",
+ Usage: "Path to the smartcard daemon (pcscd) socket file",
+ Value: pcsclite.PCSCDSockName,
+ }
NetworkIdFlag = cli.Uint64Flag{
Name: "networkid",
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)",
@@ -1126,6 +1132,7 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
setWS(ctx, cfg)
setNodeUserIdent(ctx, cfg)
setDataDir(ctx, cfg)
+ setSmartCard(ctx, cfg)
if ctx.GlobalIsSet(ExternalSignerFlag.Name) {
cfg.ExternalSigner = ctx.GlobalString(ExternalSignerFlag.Name)
@@ -1145,6 +1152,26 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
}
}
+func setSmartCard(ctx *cli.Context, cfg *node.Config) {
+ // Skip enabling smartcards if no path is set
+ path := ctx.GlobalString(SmartCardDaemonPathFlag.Name)
+ if path == "" {
+ return
+ }
+ // Sanity check that the smartcard path is valid
+ fi, err := os.Stat(path)
+ if err != nil {
+ log.Error("Failed to verify smartcard daemon path", "path", path, "err", err)
+ return
+ }
+ if fi.Mode()&os.ModeType != os.ModeSocket {
+ log.Error("Invalid smartcard daemon path", "path", path, "type", fi.Mode().String())
+ return
+ }
+ // Smartcard daemon path exists and is a socket, enable it
+ cfg.SmartCardDaemonPath = path
+}
+
func setDataDir(ctx *cli.Context, cfg *node.Config) {
switch {
case ctx.GlobalIsSet(DataDirFlag.Name):