Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
Big M for Dockerfile, start add vm command
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Jan 14, 2021
1 parent a7fbe25 commit 6d2d17d
Show file tree
Hide file tree
Showing 12 changed files with 385 additions and 23 deletions.
File renamed without changes.
112 changes: 92 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,104 @@
# The reason of choosing gitpod/workspace-full, Because it contains everything, like brew, apt/apt-get, npm & more...
FROM gitpod/workspace-full
FROM debian:latest

# pkgs
ARG PKGS="curl wget ruby-full"
ARG UPD="sudo apt-get update"
ARG GITHUB_URL="https://raw.githubusercontent.com"
# vars
ARG UPD="apt-get update"
ARG UPD_s="sudo $UPD"
ARG INS="apt-get install"
ARG INS_s="sudo $INS"
ARG APT_REPO="add-apt-repository"
ARG APT_REPO_s="sudo $APT_REPO"
ENV GITHUB_URL="https://raw.githubusercontent.com"
ENV PKGS="zip unzip multitail curl lsof wget ssl-cert asciidoctor apt-transport-https ca-certificates gnupg-agent bash-completion build-essential htop jq software-properties-common less llvm locales man-db nano vim ruby-full "
ENV BUILDS="build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev"

RUN $UPD && \
sudo apt-get install $PKGS -y && \
brew install dep && \
gem install bundler && \
RUN $UPD && $INS -y $PKGS && $UPD && \
locale-gen en_US.UTF-8 && \
mkdir /var/lib/apt/abdcodedoc-marks && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* && \
$UPD

# install cli apps (gh, corgit, manx and verx) & install deps from gemfile
ENV LANG=en_US.UTF-8

### git ###
RUN $INS -y git && \
rm -rf /var/lib/apt/lists/* && \
$UPD

# sudo
RUN $UPD && $INS -y sudo && \
adduser --disabled-password --gecos '' smx && \
adduser smx sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

### docker ###
LABEL abdcodex/layer=tool-docker
LABEL abdcodex/test=tools/tool-docker.yml
USER root

RUN $UPD_s
RUN curl -o /var/lib/apt/abdcodedoc-marks/docker.gpg -fsSL https://download.docker.com/linux/debian/gpg && \
sudo apt-key add /var/lib/apt/abdcodedoc-marks/docker.gpg && \
$APT_REPO_s "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \
$UPD_s && \
$INS_s -y docker-ce docker-ce-cli containerd.io docker-compose && \
sudo cp /var/lib/dpkg/status /var/lib/apt/abdcodedoc-marks/tool-docker.status && \
sudo apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* && \
$UPD_s

ENV HOME="/home/smx"
WORKDIR $HOME
USER smx

### homebrew ###
LABEL abdcodex/layer=tool-brew
LABEL abdcodex/test=tools/tool-brew.yml

RUN $UPD_s
ENV TRIGGER_BREW_REBUILD=1
RUN mkdir ~/.cache && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
ENV PATH="$PATH:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin/" \
MANPATH="$MANPATH:/home/linuxbrew/.linuxbrew/share/man" \
INFOPATH="$INFOPATH:/home/linuxbrew/.linuxbrew/share/info" \
HOMEBREW_NO_AUTO_UPDATE=1

### nodejs & npm ###
RUN curl -sL https://deb.nodesource.com/setup_15.x -o nodesource_setup.sh && \
sudo bash nodesource_setup.sh && \
$INS_s nodejs build-essential -y && \
$UPD_s

# install pkgs
RUN $UPD_s && \
brew install dep && \
sudo gem install bundler && \
$UPD_s

# install cli apps (gh, corgit, manx and verx) & install ruby deps from gemfile
RUN brew install gh && \
/bin/bash -c "$(curl -fsSL $GITHUB_URL/Dev-x-Team/corgit/main/setup)" && \
npm i -g @abdfnx/manx && \
sudo npm i -g @abdfnx/manx && \
/bin/bash -c "$(curl -fsSL $GITHUB_URL/abdfnx/verx/HEAD/install.sh)" && \
bundle install && \
$UPD
$UPD_s

COPY Gemfile ./
RUN sudo bundle install && sudo rm -rf Gemfile*

# secman
### secman ###
RUN /bin/bash -c "$(curl -fsSL $GITHUB_URL/abdfnx/secman/HEAD/tools/install_linux.sh)" && \
$UPD
$UPD_s

# zsh & omz (oh my zsh)
RUN brew install zsh && \
# zsh
RUN brew install zsh
ENV src=".zshrc"
RUN zsh && \
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" && \
$UPD
$UPD_s && \
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && \
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

RUN echo 'ZSH_THEME="af-magic"' >> $src && \
echo 'plugins=( git zsh-syntax-highlighting zsh-autosuggestions )' >> $src

RUN /bin/bash -c "source $src"

WORKDIR /core
ENTRYPOINT ["zsh"]
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ source 'https://rubygems.org'

gem 'colorize'
gem 'open-uri', '~> 0.1.0'
gem 'optparse'
74 changes: 71 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# [<img src=".github/assets/secman.svg" align="center">][smUrl]

[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/abdfnx/secman/discussions)
[![MIT LICENSE](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)
[![MIT LICENSE](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/abdfnx/secman/blob/main/LICENSE)

> stores, retrieves, generates, and synchronizes passwords and files securely and is written in [<img src=".github/assets/go.svg" align="center" width="30">][goUrl] 💪! The most important difference is secman is not GPG based. Instead it uses a master password to securely store your passwords. It also supports encrypting arbitrary files.
`secman is meant to be secure enough that you can publicly post your vault.`

## Installation
## Installation ⬇

## secman with [docker][dkUrl] (_Recommended_)

> you can create secman virtual machine by [docker][dkUrl]
```sh
❯ docker pull abdcodedoc/secman:latest
❯ docker run -t -i --privileged abdcodedoc/secman
```

## without docker

`secman` requires [Go][goUrl] version 1.11 or later.

Expand Down Expand Up @@ -142,7 +153,7 @@ secman can also create randomly generated passwords. The default length of secma

### Deleting a vault entry

```sh
```code
❯ secman
├──bb
| └──ff
Expand Down Expand Up @@ -170,6 +181,62 @@ remove is used for removing sites from the password vault. `secman rm` is an ali

All subcommands support the `--help` flag.

## `secman-sync`

#### auth

you should authenticate by [`gh cli`](https://cli.github.com) to use **sync** feature

```sh
❯ gh auth login
```

#### sync

```sh
❯ secman-sync sync
```

if you sync your passwords for first time, `create` command will create a private github repo and store the passwords on it

`secman-sync sy` is an alias of `secman-sync sync`

#### clone

```sh
❯ secman-sync clone
```

if you lose your passwords, or you use more than device, you can clone your private repo

`secman-sync cn` is an alias of `secman-sync clone`

#### push

```sh
❯ secman-sync push
```

if there's a new password/s, it's well push it to the repo, like git

`secman-sync ph` is an alias of `secman-sync push`

#### pull

```sh
❯ secman-sync pull
```

we know what `pull` do

alias: `secman-sync pl`

#### getting help

```sh
❯ secman-sync --help | -h
```

## CRYPTOGRAPHY DETAILS

### Generating Passwords
Expand Down Expand Up @@ -236,3 +303,4 @@ SOFTWARE.

[goUrl]: https://goland.org
[smUrl]: https://secman.web.app
[dkUrl]: https://docker.com
161 changes: 161 additions & 0 deletions core/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
FROM buildpack-deps

### base ###
RUN yes | unminimize \
&& apt-get install -yq \
asciidoctor \
bash-completion \
build-essential \
htop \
jq \
less \
llvm \
locales \
man-db \
nano \
software-properties-common \
sudo \
vim \
&& locale-gen en_US.UTF-8 \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*
ENV LANG=en_US.UTF-8

### sm user ###
# '-l': see https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
RUN useradd -l -u 33333 -G sudo -md /home/sm -s /bin/bash -p sm sm \
# passwordless sudo for users in the 'sudo' group
&& sed -i.bkp -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers
ENV HOME=/home/sm
WORKDIR $HOME
# custom Bash prompt
RUN { echo && echo "PS1='\[\e]0;\u \w\a\]\[\033[01;32m\]\u\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] \\\$ '" ; } >> .bashrc

### C/C++ ###
RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& apt-add-repository -yu "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic-6.0 main" \
&& apt-get install -yq \
clang-format-6.0 \
clang-tools-6.0 \
cmake \
&& ln -s /usr/bin/clangd-6.0 /usr/bin/clangd \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*

### Java & Maven ###
RUN add-apt-repository -yu ppa:webupd8team/java \
&& echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections \
&& apt-get install -yq \
gradle \
oracle-java8-installer \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*

ARG MAVEN_VERSION=3.5.4
ENV MAVEN_HOME=/usr/share/maven
ENV PATH=$MAVEN_HOME/bin:$PATH
RUN mkdir -p $MAVEN_HOME \
&& curl -fsSL https://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \
| tar -xzvC $MAVEN_HOME --strip-components=1

### PHP ###
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq \
composer \
php \
php-all-dev \
php-ctype \
php-curl \
php-date \
php-gd \
php-gettext \
php-intl \
php-json \
php-mbstring \
php-mysql \
php-net-ftp \
php-pgsql \
php-sqlite3 \
php-tokenizer \
php-xml \
php-zip \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*
# PHP language server is installed by theia-php-extension

### Yarn ###
RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& apt-add-repository -yu "deb https://dl.yarnpkg.com/debian/ stable main" \
&& apt-get install --no-install-recommends -yq yarn=1.12.3-1 \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*

### sm user (2) ###
USER sm
# use sudo so that user does not get sudo usage info on (the first) login
RUN sudo echo "Running 'sudo' for sm: success"

### Go ###
ENV GO_VERSION=1.11.2 \
GOPATH=$HOME/go-packages \
GOROOT=$HOME/go
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
RUN curl -fsSL https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz | tar -xzv \
&& go get -u -v \
github.com/acroca/go-symbols \
github.com/cweill/gotests/... \
github.com/davidrjenni/reftools/cmd/fillstruct \
github.com/fatih/gomodifytags \
github.com/haya14busa/goplay/cmd/goplay \
github.com/josharian/impl \
github.com/nsf/gocode \
github.com/ramya-rao-a/go-outline \
github.com/rogpeppe/godef \
github.com/uudashr/gopkgs/cmd/gopkgs \
github.com/zmb3/gogetdoc \
golang.org/x/lint/golint \
golang.org/x/tools/cmd/godoc \
golang.org/x/tools/cmd/gorename \
golang.org/x/tools/cmd/guru \
sourcegraph.com/sqs/goreturns
# user Go packages
ENV GOPATH=/workspace:$GOPATH \
PATH=/workspace/bin:$PATH

### Node.js ###
ARG NODE_VERSION=8.14.0
ENV PATH=/home/sm/.nvm/versions/node/v8.14.0/bin:$PATH
RUN curl -fsSL https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \
&& bash -c ". .nvm/nvm.sh \
&& npm config set python /usr/bin/python --global \
&& npm config set python /usr/bin/python \
&& npm install -g typescript"

### Python ###
ENV PATH=$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH
RUN curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash \
&& { echo; \
echo 'eval "$(pyenv init -)"'; \
echo 'eval "$(pyenv virtualenv-init -)"'; } >> .bashrc \
&& pyenv install 3.6.6 \
&& pyenv global 3.6.6 \
&& pip install virtualenv pipenv python-language-server[all]==0.19.0 \
&& rm -rf /tmp/*

### Ruby ###
ENV RUBY_VERSION=2.6.0
RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - \
&& curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - \
&& curl -fsSL https://get.rvm.io | bash -s stable \
&& bash -lc " \
rvm requirements \
&& rvm install $RUBY_VERSION \
&& rvm use $RUBY_VERSION --default \
&& rvm rubygems current \
&& gem install bundler --no-document"

### Rust ###
RUN curl -fsSL https://sh.rustup.rs | sh -s -- -y \
&& .cargo/bin/rustup update \
&& .cargo/bin/rustup component add rls-preview rust-analysis rust-src \
&& .cargo/bin/rustup completions bash | sudo tee /etc/bash_completion.d/rustup.bash-completion > /dev/null

### checks ###
# no root-owned files in the home directory
RUN notOwnedFile=$(find . -not "(" -user sm -and -group sm ")" -print -quit) \
&& { [ -z "$notOwnedFile" ] \
|| { echo "Error: not all files/dirs in $HOME are owned by 'sm' user & group"; exit 1; } }
Empty file added packages/backup/backup.go
Empty file.
Empty file added packages/backup/backup.rb
Empty file.
Loading

0 comments on commit 6d2d17d

Please sign in to comment.