Diary

[Mac] rbenv openssl [BUILD FAILED] [make: *** [all] Error 2]

1 Mins read

Needed an old environment so hit this issue setting up Xcode and Ruby on a legacy Mac. Leaving a note.

20220315

■Environment
macOS High Sierra 10.13.6
Homebrew 3.4.1-67-gb31d8e9
rbenv 1.2.0

Got this error:

Downloading openssl-1.1.1l.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
Installing openssl-1.1.1l...

BUILD FAILED (Mac Os X 10.13.6 using ruby-build 20220218)

Inspect or clean up the working tree at /var/folders/rc/9hwgt2nd0rxgjzvt9kc0zgph0000gn/T/ruby-build.20220315231102.889.ggie1q
Results logged to /var/folders/rc/9hwgt2nd0rxgjzvt9kc0zgph0000gn/T/ruby-build.20220315231102.889.log

Last 10 log lines:
/usr/include/CommonCrypto/CommonRandom.h:35:9: error: unknown type name 'CCCryptorStatus'
typedef CCCryptorStatus CCRNGStatus;
        ^
crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
    if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
                                              ^
2 errors generated.
make[1]: *** [crypto/rand/rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2

So you need OpenSSL 1.0. This command installs “rbenv/tap/openssl@1.0 1.0.2t”:

#Install OpenSSL1.0
brew install rbenv/tap/openssl@1.0

#Set environment variable [hoge is your username]
echo 'export PATH="/usr/local/opt/openssl@1.0/bin:$PATH"' >> /Users/hoge/.bash_profile
#Reflect environment variable
source .bash_profile

#If needed, reflect environment variable
export LDFLAGS="-L/usr/local/opt/openssl@1.0/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.0/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig"

#This is needed for subsequent commands!
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl@1.0`"

#Install whatever Ruby version you want
rbenv install 2.6.9

On macOS, OpenSSL affects other things too.

OpenSSL also impacts the mysql2 library used by Rails and others. Watch out if you’re using MySQL 5.6 or 5.7!

Before running bundle install, you need to set this in your .bundle/config file:

BUNDLE_BUILD__MYSQL2: "--with-ldflags=-L/usr/local/opt/openssl@1.0/lib --with-cppflags=-I/usr/local/opt/openssl@1.0/include"
Read more
Diary

[GitHub] SSH Public Key Gets Deleted [git@github.com: Permission denied (publickey).]

1 Mins read

Github


$ ssh -T git@github.com
$ git@github.com: Permission denied (publickey).

Huh?

The .ssh directory itself looks fine.

Checked logs with

ssh -vT git@github.com

or

ssh -vvv git@github.com

Error traces point to the key.

Checked Github SSH Key on the web page.

It’s gone!

Turns out SSH public keys have an expiration date and get automatically deleted.

Recreated and set it up. Problem solved.

Read more
Diary

[Github] Repository Access Method Changed [remote: Support for password authentication was removed on August 13, 2021.]

1 Mins read

Github’s access method has changed.

「git push -u origin develop」

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.

Password authentication is now deprecated and replaced with access token method.

You need to log into Github on the web and create an access token.

1.Open the settings page( https://github.com/settings/tokens )
2.Click [Generate new token]
3.Enter an appropriate token name in the note field
4.Set permissions (need at least [repo] permission if modifying repositories)
5.Click [Generate token]
6.Save the generated token ★Important! Copy the token displayed here

★[repo] permission required to access repositories
★[workflows] permission required to update GitHub Actions
★Due to security constraints, token expiration can only be set up to max 360 days

git push -u origin develop
Username for 'https://github.com': hogehoge
Password for 'https://hogehoge@github.com':★

hogehoge = username
★ = token
You can now access with these credentials

Read more
Diary

.htaccess IP Control AWS ELB Load Balancer Environment

1 Mins read

Apache 2.4.39

[.htaccess] Or [httpd.conf]

# Set allowed IPs to 0.0.0.0
# AWS ELB admin screen access control
<location "/wp-admin">
  # Admin IP
  SetEnvIf X-Forwarded-For "0.0.0.0.*" allowed_ip_admin
  SetEnvIf X-Forwarded-For "0.0.0.0.*" allowed_ip_admin
  Order Deny,Allow
  Deny from all
  Allow from env=allowed_ip_admin
</location>

Read more